Compare commits
3 Commits
2711375a4a
...
a146863098
Author | SHA1 | Date | |
---|---|---|---|
a146863098 | |||
e785359af3 | |||
1f18533629 |
2
Makefile
2
Makefile
@ -4,7 +4,7 @@ LIBS:=ncurses readline history
|
||||
|
||||
CC:=gcc
|
||||
CFLAGS:=-Wall -Wextra -Wpedantic
|
||||
CFLAGS +=$(if $(DEBUG),-O0 -ggdb,-O3 -flto=auto -fomit-frame-pointer)
|
||||
CFLAGS +=$(if $(DEBUG),-O0 -ggdb -Wall -Wpedantic,-O3 -flto=auto -fomit-frame-pointer)
|
||||
CFLAGS +=$(if $(SAN),-fsanitize=${SAN})
|
||||
CPPFLAGS:=-I config/ -I ${CHDRD} ${shell pkg-config --cflags ${LIBS}}
|
||||
LDLIBS=${shell pkg-config --libs ${LIBS}}
|
||||
|
@ -418,7 +418,7 @@ void makefilelist(void) {
|
||||
if((s = inviewpath(newpath)) != NULL) {
|
||||
addsrcfile(s);
|
||||
} else {
|
||||
fprintf(stderr, PROGRAM_NAME, ": cannot find file %s\n", newpath);
|
||||
fprintf(stderr, PROGRAM_NAME ": cannot find file %s\n", newpath);
|
||||
errorsfound = true;
|
||||
}
|
||||
}
|
||||
@ -494,7 +494,7 @@ static void scan_dir(const char *adir, bool recurse_dir) {
|
||||
/* see if this is a source file */
|
||||
static bool issrcfile(char *path) {
|
||||
struct stat statstruct;
|
||||
char *file = basename(path);
|
||||
const char *file = basename(path);
|
||||
char *s = strrchr(file, '.');
|
||||
bool looks_like_source = false;
|
||||
|
||||
|
@ -102,7 +102,7 @@ static int myexecvp(char *a, char **args) {
|
||||
char msg[MSGLEN + 1];
|
||||
|
||||
/* modify argv[0] to reference the last component of its path name */
|
||||
args[0] = basename(args[0]);
|
||||
args[0] = (char *)basename(args[0]);
|
||||
|
||||
/* execute the program or shell script */
|
||||
execvp(a, args); /* returns only on failure */
|
||||
|
@ -356,6 +356,7 @@ static int global_input(const int c) {
|
||||
break;
|
||||
case EOF:
|
||||
myexit(0);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -368,7 +369,7 @@ int change_input(const int c) {
|
||||
|
||||
switch(c) {
|
||||
case '*': /* invert page */
|
||||
for(int i = 0; i < (nextline-1); i++) {
|
||||
for(unsigned i = 0; i < (nextline-1); i++) {
|
||||
change[topref + i] = !change[topref + i];
|
||||
}
|
||||
window_change |= CH_RESULT;
|
||||
|
140
src/invlib.c
140
src/invlib.c
@ -943,9 +943,6 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
|
||||
}
|
||||
newitem = item2;
|
||||
}
|
||||
#if 0 /* this write is only need by commented-out code later */
|
||||
set1p = item;
|
||||
#endif
|
||||
newsetp = newitem;
|
||||
}
|
||||
file = invcntl->postfile;
|
||||
@ -994,103 +991,6 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
|
||||
}
|
||||
item = newitem;
|
||||
break; /* end of bool_OR */
|
||||
#if 0
|
||||
case AND:
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
if (set1p->lineoffset < posting.lineoffset) {
|
||||
set1p++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->lineoffset > posting.lineoffset) {
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else if (set1p->type < posting.type) {
|
||||
*set1p++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->type > posting.type) {
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else { /* identical postings */
|
||||
*newsetp++ = *set1p++;
|
||||
newsetc++;
|
||||
set1c++;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
}
|
||||
break; /* end of AND */
|
||||
|
||||
case falseT:
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
if (set1p->lineoffset < posting.lineoffset) {
|
||||
*newsetp++ = *set1p++;
|
||||
newsetc++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->lineoffset > posting.lineoffset) {
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else if (set1p->type < posting.type) {
|
||||
*newsetp++ = *set1p++;
|
||||
newsetc++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->type > posting.type) {
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else { /* identical postings */
|
||||
set1c++;
|
||||
set1p++;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
}
|
||||
newsetc += numitems - set1c;
|
||||
while (set1c++ < numitems) {
|
||||
*newsetp++ = *set1p++;
|
||||
}
|
||||
break; /* end of falseT */
|
||||
|
||||
case REVERSEfalseT: /* core falseT incoming set */
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
if (set1p->lineoffset < posting.lineoffset) {
|
||||
set1p++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->lineoffset > posting.lineoffset) {
|
||||
*newsetp++ = posting;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else if (set1p->type < posting.type) {
|
||||
set1p++;
|
||||
set1c++;
|
||||
}
|
||||
else if (set1p->type > posting.type) {
|
||||
*newsetp++ = posting;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
else { /* identical postings */
|
||||
set1c++;
|
||||
set1p++;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
set2c++;
|
||||
}
|
||||
}
|
||||
while (set2c++ < *num) {
|
||||
*newsetp++ = posting;
|
||||
newsetc++;
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
}
|
||||
item = newitem;
|
||||
break; /* end of REVERSEfalseT */
|
||||
#endif
|
||||
}
|
||||
numitems = newsetc;
|
||||
*num = newsetc;
|
||||
@ -1098,50 +998,12 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
|
||||
return ((POSTING *)item);
|
||||
}
|
||||
|
||||
#if 0
|
||||
POSTING *
|
||||
boolsave(int clear) /* flag about whether to clear core */
|
||||
{
|
||||
int i;
|
||||
POSTING *ptr;
|
||||
POSTING *oldstuff, *newstuff;
|
||||
|
||||
if (numitems == 0) {
|
||||
if (clear)
|
||||
boolclear();
|
||||
return(NULL);
|
||||
}
|
||||
/* if clear then give them what we have and use boolready to realloc */
|
||||
if (clear) {
|
||||
ptr = item;
|
||||
/* free up the space we didn't give them */
|
||||
if (item == item1)
|
||||
item1 = NULL;
|
||||
else
|
||||
item2 = NULL;
|
||||
boolready();
|
||||
return(ptr);
|
||||
}
|
||||
i = (enditem - item) * sizeof(*ptr) + 100;
|
||||
if ((ptr = malloc(i)) == NULL) {
|
||||
invcannotalloc(i);
|
||||
return(ptr);
|
||||
}
|
||||
/* move present set into place */
|
||||
oldstuff = item;
|
||||
newstuff = ptr;
|
||||
while (oldstuff < enditem)
|
||||
*newstuff++ = *oldstuff++;
|
||||
return(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void invcannotalloc(unsigned n) {
|
||||
fprintf(stderr, PROGRAM_NAME ": cannot allocate %u bytes\n", n);
|
||||
}
|
||||
|
||||
static void invcannotopen(char *file) {
|
||||
fprintf(stderr, PROGRAM_NAME "%s: cannot open file %s\n", file);
|
||||
fprintf(stderr, PROGRAM_NAME ": cannot open file %s\n", file);
|
||||
}
|
||||
|
||||
static void invcannotwrite(char *file) {
|
||||
|
@ -24,7 +24,6 @@ static struct PARTIAL_LINE {
|
||||
|
||||
static inline void previous_history_proxy(void);
|
||||
static inline void next_history_proxy(void);
|
||||
static inline int rebuild_reference(void);
|
||||
|
||||
|
||||
bool interpret(int c) {
|
||||
|
Loading…
Reference in New Issue
Block a user