@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* get a file's base name from its path name */ | /* get a file's base name from its path name */ | ||||
@@ -38,7 +38,7 @@ char * | |||||
basename(char *path) | basename(char *path) | ||||
{ | { | ||||
char *s; | char *s; | ||||
if ((s = strrchr(path, '/')) != 0) { | if ((s = strrchr(path, '/')) != 0) { | ||||
return(s + 1); | return(s + 1); | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
@@ -102,7 +102,7 @@ cscope: cannot create inverted index; ignoring -q option\n"); | |||||
invertedindex = NO; | invertedindex = NO; | ||||
errorsfound = YES; | errorsfound = YES; | ||||
fprintf(stderr, "\ | fprintf(stderr, "\ | ||||
cscope: removed files %s and %s\n", | |||||
cscope: removed files %s and %s\n", | |||||
newinvname, newinvpost); | newinvname, newinvpost); | ||||
unlink(newinvname); | unlink(newinvname); | ||||
unlink(newinvpost); | unlink(newinvpost); | ||||
@@ -165,7 +165,7 @@ opendatabase(void) | |||||
myexit(1); | myexit(1); | ||||
} | } | ||||
blocknumber = -1; /* force next seek to read the first block */ | blocknumber = -1; /* force next seek to read the first block */ | ||||
/* open any inverted index */ | /* open any inverted index */ | ||||
if (invertedindex == YES && | if (invertedindex == YES && | ||||
invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) { | invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) { | ||||
@@ -232,7 +232,7 @@ build(void) | |||||
/* or this is an unconditional build */ | /* or this is an unconditional build */ | ||||
if ((oldrefs = vpfopen(reffile, "rb")) != NULL | if ((oldrefs = vpfopen(reffile, "rb")) != NULL | ||||
&& unconditional == NO | && unconditional == NO | ||||
&& fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2 | |||||
&& fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2 | |||||
&& (strcmp(olddir, currentdir) == 0 /* remain compatible */ | && (strcmp(olddir, currentdir) == 0 /* remain compatible */ | ||||
|| strcmp(olddir, newdir) == 0)) { | || strcmp(olddir, newdir) == 0)) { | ||||
/* get the cross-reference file's modification time */ | /* get the cross-reference file's modification time */ | ||||
@@ -294,10 +294,10 @@ cscope: -q option mismatch between command line and old symbol database\n"); | |||||
goto outofdate; | goto outofdate; | ||||
} | } | ||||
/* see if the directory lists are the same */ | /* see if the directory lists are the same */ | ||||
if (samelist(oldrefs, srcdirs, nsrcdirs) == NO | |||||
|| samelist(oldrefs, incdirs, nincdirs) == NO | |||||
if (samelist(oldrefs, srcdirs, nsrcdirs) == NO | |||||
|| samelist(oldrefs, incdirs, nincdirs) == NO | |||||
/* get the old number of files */ | /* get the old number of files */ | ||||
|| fscanf(oldrefs, "%lu", &oldnum) != 1 | |||||
|| fscanf(oldrefs, "%lu", &oldnum) != 1 | |||||
/* skip the string space size */ | /* skip the string space size */ | ||||
|| (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) { | || (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) { | ||||
goto outofdate; | goto outofdate; | ||||
@@ -320,7 +320,7 @@ cscope: -q option mismatch between command line and old symbol database\n"); | |||||
} | } | ||||
fclose(oldrefs); | fclose(oldrefs); | ||||
return; | return; | ||||
outofdate: | outofdate: | ||||
/* if the database format has changed, rebuild it all */ | /* if the database format has changed, rebuild it all */ | ||||
if (fileversion != FILEVERSION) { | if (fileversion != FILEVERSION) { | ||||
@@ -339,7 +339,7 @@ cscope: converting to new symbol database file format\n"); | |||||
scanpast('\t'); /* skip the header */ | scanpast('\t'); /* skip the header */ | ||||
oldfile = getoldfile(); | oldfile = getoldfile(); | ||||
} else { /* force cross-referencing of all the source files */ | } else { /* force cross-referencing of all the source files */ | ||||
force: | |||||
force: | |||||
reftime = 0; | reftime = 0; | ||||
oldfile = NULL; | oldfile = NULL; | ||||
} | } | ||||
@@ -377,7 +377,7 @@ cscope: converting to new symbol database file format\n"); | |||||
/* get the next source file name */ | /* get the next source file name */ | ||||
for (fileindex = firstfile; fileindex < lastfile; ++fileindex) { | for (fileindex = firstfile; fileindex < lastfile; ++fileindex) { | ||||
/* display the progress about every three seconds */ | /* display the progress about every three seconds */ | ||||
if (interactive == YES && fileindex % 10 == 0) { | if (interactive == YES && fileindex % 10 == 0) { | ||||
progress("Building symbol database", fileindex, lastfile); | progress("Building symbol database", fileindex, lastfile); | ||||
@@ -396,14 +396,14 @@ cscope: converting to new symbol database file format\n"); | |||||
/* if this file was modified */ | /* if this file was modified */ | ||||
crossref(file); | crossref(file); | ||||
++built; | ++built; | ||||
/* skip its old crossref so modifying the last source | /* skip its old crossref so modifying the last source | ||||
* file does not cause all included files to be built. | * file does not cause all included files to be built. | ||||
* Unfortunately a new file that is alphabetically | * Unfortunately a new file that is alphabetically | ||||
* last will cause all included files to be build, but | * last will cause all included files to be build, but | ||||
* this is less likely */ | * this is less likely */ | ||||
oldfile = getoldfile(); | oldfile = getoldfile(); | ||||
} else { | |||||
} else { | |||||
/* copy its cross-reference */ | /* copy its cross-reference */ | ||||
putfilename(file); | putfilename(file); | ||||
if (invertedindex == YES) { | if (invertedindex == YES) { | ||||
@@ -430,10 +430,10 @@ cscope: converting to new symbol database file format\n"); | |||||
/* add a null file name to the trailing tab */ | /* add a null file name to the trailing tab */ | ||||
putfilename(""); | putfilename(""); | ||||
dbputc('\n'); | dbputc('\n'); | ||||
/* get the file trailer offset */ | /* get the file trailer offset */ | ||||
traileroffset = dboffset; | traileroffset = dboffset; | ||||
/* output the source and include directory and file lists */ | /* output the source and include directory and file lists */ | ||||
putlist(srcdirs, nsrcdirs); | putlist(srcdirs, nsrcdirs); | ||||
putlist(incdirs, nincdirs); | putlist(incdirs, nincdirs); | ||||
@@ -474,7 +474,7 @@ cscope: converting to new symbol database file format\n"); | |||||
rewind(newrefs); | rewind(newrefs); | ||||
putheader(newdir); | putheader(newdir); | ||||
fclose(newrefs); | fclose(newrefs); | ||||
/* close the old database file */ | /* close the old database file */ | ||||
if (symrefs >= 0) { | if (symrefs >= 0) { | ||||
close(symrefs); | close(symrefs); | ||||
@@ -485,7 +485,7 @@ cscope: converting to new symbol database file format\n"); | |||||
/* replace it with the new database file */ | /* replace it with the new database file */ | ||||
movefile(newreffile, reffile); | movefile(newreffile, reffile); | ||||
} | } | ||||
/* string comparison function for qsort */ | /* string comparison function for qsort */ | ||||
static int | static int | ||||
@@ -493,14 +493,14 @@ compare(const void *arg_s1, const void *arg_s2) | |||||
{ | { | ||||
const char **s1 = (const char **) arg_s1; | const char **s1 = (const char **) arg_s1; | ||||
const char **s2 = (const char **) arg_s2; | const char **s2 = (const char **) arg_s2; | ||||
return(strcmp(*s1, *s2)); | return(strcmp(*s1, *s2)); | ||||
} | } | ||||
/* seek to the trailer, in a given file */ | /* seek to the trailer, in a given file */ | ||||
void | |||||
seek_to_trailer(FILE *f) | |||||
void | |||||
seek_to_trailer(FILE *f) | |||||
{ | { | ||||
if (fscanf(f, "%ld", &traileroffset) != 1) { | if (fscanf(f, "%ld", &traileroffset) != 1) { | ||||
postfatal("cscope: cannot read trailer offset from file %s\n", reffile); | postfatal("cscope: cannot read trailer offset from file %s\n", reffile); | ||||
@@ -541,7 +541,7 @@ void free_newbuildfiles(void) | |||||
free(newinvname); | free(newinvname); | ||||
free(newinvpost); | free(newinvpost); | ||||
free(newreffile); | free(newreffile); | ||||
} | |||||
} | |||||
/* output the cscope version, current directory, database format options, and | /* output the cscope version, current directory, database format options, and | ||||
@@ -555,7 +555,7 @@ putheader(char *dir) | |||||
} | } | ||||
if (invertedindex == YES) { | if (invertedindex == YES) { | ||||
dboffset += fprintf(newrefs, " -q %.10ld", totalterms); | dboffset += fprintf(newrefs, " -q %.10ld", totalterms); | ||||
} else { | |||||
} else { | |||||
/* leave space so if the header is overwritten without -q | /* leave space so if the header is overwritten without -q | ||||
* because writing the inverted index failed, the header | * because writing the inverted index failed, the header | ||||
* is the same length */ | * is the same length */ | ||||
@@ -567,7 +567,7 @@ putheader(char *dir) | |||||
dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); | dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); | ||||
#ifdef PRINTF_RETVAL_BROKEN | #ifdef PRINTF_RETVAL_BROKEN | ||||
dboffset = ftell(newrefs); | |||||
dboffset = ftell(newrefs); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -577,7 +577,7 @@ static void | |||||
putlist(char **names, int count) | putlist(char **names, int count) | ||||
{ | { | ||||
int i, size = 0; | int i, size = 0; | ||||
fprintf(newrefs, "%d\n", count); | fprintf(newrefs, "%d\n", count); | ||||
if (names == srcfiles) { | if (names == srcfiles) { | ||||
@@ -613,7 +613,7 @@ copydata(void) | |||||
} | } | ||||
} while (*++cp == '\0' && (cp = read_block()) != NULL); | } while (*++cp == '\0' && (cp = read_block()) != NULL); | ||||
dbputc('\t'); /* copy the tab */ | dbputc('\t'); /* copy the tab */ | ||||
/* get the next character */ | /* get the next character */ | ||||
/* HBB 2010-08-21: potential problem if above loop was left | /* HBB 2010-08-21: potential problem if above loop was left | ||||
* with cp==NULL */ | * with cp==NULL */ | ||||
@@ -659,7 +659,7 @@ copyinverted(void) | |||||
} | } | ||||
} while (*++cp == '\0' && (cp = read_block()) != NULL); | } while (*++cp == '\0' && (cp = read_block()) != NULL); | ||||
dbputc('\n'); /* copy the newline */ | dbputc('\n'); /* copy the newline */ | ||||
/* get the next character */ | /* get the next character */ | ||||
/* HBB 2010-08-21: potential problem if above loop was left | /* HBB 2010-08-21: potential problem if above loop was left | ||||
* with cp==NULL */ | * with cp==NULL */ | ||||
@@ -735,4 +735,3 @@ fetch_include_from_dbase(char *s, size_t length) | |||||
fetch_string_from_dbase(s, length); | fetch_string_from_dbase(s, length); | ||||
incfile(s + 1, s); | incfile(s + 1, s); | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,36 +27,36 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#ifndef CSCOPE_BUILD_H | #ifndef CSCOPE_BUILD_H | ||||
#define CSCOPE_BUILD_H | #define CSCOPE_BUILD_H | ||||
#include "global.h" /* FIXME: temp. only */ | |||||
#include "global.h" /* FIXME: temp. only */ | |||||
#include "invlib.h" | #include "invlib.h" | ||||
/* types and macros of build.c to be used by other modules */ | /* types and macros of build.c to be used by other modules */ | ||||
/* database output macros that update its offset */ | /* database output macros that update its offset */ | ||||
#define dbputc(c) (++dboffset, (void) putc(c, newrefs)) | |||||
#define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) | |||||
#define dbputc(c) (++dboffset, (void) putc(c, newrefs)) | |||||
#define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) | |||||
/* declarations for globals defined in build.c */ | /* declarations for globals defined in build.c */ | ||||
extern BOOL buildonly; /* only build the database */ | |||||
extern BOOL unconditional; /* unconditionally build database */ | |||||
extern BOOL fileschanged; /* assume some files changed */ | |||||
extern BOOL buildonly; /* only build the database */ | |||||
extern BOOL unconditional; /* unconditionally build database */ | |||||
extern BOOL fileschanged; /* assume some files changed */ | |||||
extern char *reffile; /* cross-reference file path name */ | |||||
extern char *invname; /* inverted index to the database */ | |||||
extern char *invpost; /* inverted index postings */ | |||||
extern char *newreffile; /* new cross-reference file name */ | |||||
extern FILE *newrefs; /* new cross-reference */ | |||||
extern FILE *postings; /* new inverted index postings */ | |||||
extern int symrefs; /* cross-reference file */ | |||||
extern char *reffile; /* cross-reference file path name */ | |||||
extern char *invname; /* inverted index to the database */ | |||||
extern char *invpost; /* inverted index postings */ | |||||
extern char *newreffile; /* new cross-reference file name */ | |||||
extern FILE *newrefs; /* new cross-reference */ | |||||
extern FILE *postings; /* new inverted index postings */ | |||||
extern int symrefs; /* cross-reference file */ | |||||
extern INVCONTROL invcontrol; /* inverted file control structure */ | |||||
extern INVCONTROL invcontrol; /* inverted file control structure */ | |||||
/* Prototypes of external functions defined by build.c */ | /* Prototypes of external functions defined by build.c */ | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol or text cross-reference | /* cscope - interactive C symbol or text cross-reference | ||||
@@ -119,7 +119,7 @@ static void | |||||
mark(unsigned int i) | mark(unsigned int i) | ||||
{ | { | ||||
unsigned int j; | unsigned int j; | ||||
j = i + topline - 1; | j = i + topline - 1; | ||||
if (j < totallines) { | if (j < totallines) { | ||||
move(displine[i], 1); | move(displine[i], 1); | ||||
@@ -144,13 +144,13 @@ scrollbar(MOUSE *p) | |||||
return; | return; | ||||
} | } | ||||
switch (p->percent) { | switch (p->percent) { | ||||
case 101: /* scroll down one page */ | case 101: /* scroll down one page */ | ||||
if (nextline + mdisprefs > totallines) { | if (nextline + mdisprefs > totallines) { | ||||
nextline = totallines - mdisprefs + 1; | nextline = totallines - mdisprefs + 1; | ||||
} | } | ||||
break; | break; | ||||
case 102: /* scroll up one page */ | case 102: /* scroll up one page */ | ||||
nextline = topline - mdisprefs; | nextline = topline - mdisprefs; | ||||
if (nextline < 1) { | if (nextline < 1) { | ||||
@@ -161,7 +161,7 @@ scrollbar(MOUSE *p) | |||||
case 103: /* scroll down one line */ | case 103: /* scroll down one line */ | ||||
nextline = topline + 1; | nextline = topline + 1; | ||||
break; | break; | ||||
case 104: /* scroll up one line */ | case 104: /* scroll up one line */ | ||||
if (topline > 1) { | if (topline > 1) { | ||||
nextline = topline - 1; | nextline = topline - 1; | ||||
@@ -191,7 +191,7 @@ countrefs(void) | |||||
/* HBB NOTE 2012-04-07: it may look like we shouldn't assing tempstring here, | /* HBB NOTE 2012-04-07: it may look like we shouldn't assing tempstring here, | ||||
* since it's not used. But it has to be assigned just so the return value | * since it's not used. But it has to be assigned just so the return value | ||||
* of fscanf will actually reach 4. */ | * of fscanf will actually reach 4. */ | ||||
while (EOF != (i = fscanf(refsfound, | |||||
while (EOF != (i = fscanf(refsfound, | |||||
"%" PATHLEN_STR "s%" PATLEN_STR "s%" NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]", | "%" PATHLEN_STR "s%" PATLEN_STR "s%" NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]", | ||||
file, function, linenum, tempstring | file, function, linenum, tempstring | ||||
) | ) | ||||
@@ -230,7 +230,7 @@ countrefs(void) | |||||
rewind(refsfound); | rewind(refsfound); | ||||
/* restrict the width of displayed columns */ | /* restrict the width of displayed columns */ | ||||
/* HBB FIXME 20060419: magic number alert! */ | |||||
/* HBB FIXME 20060419: magic number alert! */ | |||||
i = (COLS - 5) / 3; | i = (COLS - 5) / 3; | ||||
if (ogs == YES) { | if (ogs == YES) { | ||||
i = (COLS - 7) / 5; | i = (COLS - 7) / 5; | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* | /* | ||||
@@ -163,7 +163,7 @@ compath(char *pathname) /*FDEF*/ | |||||
sofar = nextchar - 1; | sofar = nextchar - 1; | ||||
while ((*nextchar++ = *lastchar++) != '\0'); | while ((*nextchar++ = *lastchar++) != '\0'); | ||||
lastchar = sofar; | lastchar = sofar; | ||||
/* | /* | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -38,43 +38,43 @@ | |||||
#ifndef CSCOPE_CONSTANTS_H | #ifndef CSCOPE_CONSTANTS_H | ||||
#define CSCOPE_CONSTANTS_H | #define CSCOPE_CONSTANTS_H | ||||
#define ctrl(x) (x & 037) /* control character macro */ | |||||
#define ctrl(x) (x & 037) /* control character macro */ | |||||
/* fast string equality tests (avoids most strcmp() calls) */ | /* fast string equality tests (avoids most strcmp() calls) */ | ||||
#define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0) | |||||
#define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0) | |||||
#define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0) | |||||
#define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0) | |||||
/* set the mark character for searching the cross-reference file */ | /* set the mark character for searching the cross-reference file */ | ||||
#define setmark(c) (blockmark = c, block[blocklen] = blockmark) | |||||
#define setmark(c) (blockmark = c, block[blocklen] = blockmark) | |||||
/* get the next character in the cross-reference */ | /* get the next character in the cross-reference */ | ||||
/* note that blockp is assumed not to be null */ | /* note that blockp is assumed not to be null */ | ||||
#define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \ | |||||
(read_block() != NULL ? *blockp : '\0')) | |||||
#define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \ | |||||
(read_block() != NULL ? *blockp : '\0')) | |||||
/* skip the next character in the cross-reference */ | /* skip the next character in the cross-reference */ | ||||
/* note that blockp is assumed not to be null and that | /* note that blockp is assumed not to be null and that | ||||
this macro will always be in a statement by itself */ | this macro will always be in a statement by itself */ | ||||
#define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block() | |||||
#define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block() | |||||
#ifndef ESC | #ifndef ESC | ||||
# define ESC '\033' /* escape character */ | |||||
# define ESC '\033' /* escape character */ | |||||
#endif | #endif | ||||
#define DEL '\177' /* delete character */ | |||||
#define DUMMYCHAR ' ' /* use space as a dummy character */ | |||||
#define MSGLEN ((PATLEN) + 80) /* displayed message length */ | |||||
#define NUMLEN 10 /* line number length */ | |||||
#define PATHLEN 250 /* file pathname length */ | |||||
#define PATLEN 250 /* symbol pattern length */ | |||||
#define DEL '\177' /* delete character */ | |||||
#define DUMMYCHAR ' ' /* use space as a dummy character */ | |||||
#define MSGLEN ((PATLEN) + 80) /* displayed message length */ | |||||
#define NUMLEN 10 /* line number length */ | |||||
#define PATHLEN 250 /* file pathname length */ | |||||
#define PATLEN 250 /* symbol pattern length */ | |||||
#define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */ | #define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */ | ||||
#define REFFILE "cscope.out" /* cross-reference output file */ | |||||
#define NAMEFILE "cscope.files" /* default list-of-files file */ | |||||
#define INVNAME "cscope.in.out" /* inverted index to the database */ | |||||
#define INVPOST "cscope.po.out" /* inverted index postings */ | |||||
#define REFFILE "cscope.out" /* cross-reference output file */ | |||||
#define NAMEFILE "cscope.files" /* default list-of-files file */ | |||||
#define INVNAME "cscope.in.out" /* inverted index to the database */ | |||||
#define INVPOST "cscope.po.out" /* inverted index postings */ | |||||
#define INVNAME2 "cscope.out.in"/* follows correct naming convention */ | #define INVNAME2 "cscope.out.in"/* follows correct naming convention */ | ||||
#define INVPOST2 "cscope.out.po"/* follows correct naming convention */ | #define INVPOST2 "cscope.out.po"/* follows correct naming convention */ | ||||
#define STMTMAX 10000 /* maximum source statement length */ | |||||
#define STMTMAX 10000 /* maximum source statement length */ | |||||
#define STR2(x) #x | #define STR2(x) #x | ||||
#define STRINGIZE(x) STR2(x) | #define STRINGIZE(x) STR2(x) | ||||
@@ -84,32 +84,32 @@ | |||||
#define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN) | #define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN) | ||||
/* screen lines */ | /* screen lines */ | ||||
#define FLDLINE (LINES - FIELDS - 1 - 1) /* first input field line */ | |||||
#define MSGLINE 0 /* message line */ | |||||
#define PRLINE (LINES - 1) /* input prompt line */ | |||||
#define FLDLINE (LINES - FIELDS - 1 - 1) /* first input field line */ | |||||
#define MSGLINE 0 /* message line */ | |||||
#define PRLINE (LINES - 1) /* input prompt line */ | |||||
/* input fields (value matches field order on screen) */ | /* input fields (value matches field order on screen) */ | ||||
#define SYMBOL 0 | |||||
#define SYMBOL 0 | |||||
#define DEFINITION 1 | #define DEFINITION 1 | ||||
#define CALLEDBY 2 | |||||
#define CALLING 3 | |||||
#define STRING 4 | |||||
#define CHANGE 5 | |||||
#define REGEXP 6 | |||||
#define CALLEDBY 2 | |||||
#define CALLING 3 | |||||
#define STRING 4 | |||||
#define CHANGE 5 | |||||
#define REGEXP 6 | |||||
#define FILENAME 7 | #define FILENAME 7 | ||||
#define INCLUDES 8 | #define INCLUDES 8 | ||||
#define FIELDS 10 | |||||
#define FIELDS 10 | |||||
/* file open modes */ | /* file open modes */ | ||||
#ifndef R_OK | #ifndef R_OK | ||||
# define READ R_OK | |||||
# define READ R_OK | |||||
#else | #else | ||||
# define READ 4 | |||||
# define READ 4 | |||||
#endif | #endif | ||||
#ifdef W_OK | #ifdef W_OK | ||||
# define WRITE W_OK | |||||
# define WRITE W_OK | |||||
#else | #else | ||||
# define WRITE 2 | |||||
# define WRITE 2 | |||||
#endif | #endif | ||||
#define O_TEXT 0x00 | #define O_TEXT 0x00 | ||||
@@ -159,7 +159,7 @@ | |||||
/**/ | /**/ | ||||
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__ | #if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__ | ||||
# define TERMINFO 0 /* no terminfo curses */ | |||||
# define TERMINFO 0 /* no terminfo curses */ | |||||
#else | #else | ||||
# define TERMINFO 1 | # define TERMINFO 1 | ||||
#endif | #endif | ||||
@@ -167,25 +167,25 @@ | |||||
#if !TERMINFO | #if !TERMINFO | ||||
# ifndef KEY_BREAK | # ifndef KEY_BREAK | ||||
# define KEY_BREAK 0400 /* easier to define than to add #if around the use */ | |||||
# define KEY_BREAK 0400 /* easier to define than to add #if around the use */ | |||||
# endif | # endif | ||||
# ifndef KEY_ENTER | # ifndef KEY_ENTER | ||||
# define KEY_ENTER 0401 | |||||
# define KEY_ENTER 0401 | |||||
# endif | # endif | ||||
# ifndef KEY_BACKSPACE | # ifndef KEY_BACKSPACE | ||||
# define KEY_BACKSPACE 0402 | |||||
# define KEY_BACKSPACE 0402 | |||||
# endif | # endif | ||||
# if !sun | # if !sun | ||||
# define cbreak() crmode() /* name change */ | |||||
# define cbreak() crmode() /* name change */ | |||||
# endif | # endif | ||||
# if UNIXPC | # if UNIXPC | ||||
# define erasechar() (_tty.c_cc[VERASE]) /* equivalent */ | |||||
# define killchar() (_tty.c_cc[VKILL]) /* equivalent */ | |||||
# define erasechar() (_tty.c_cc[VERASE]) /* equivalent */ | |||||
# define killchar() (_tty.c_cc[VKILL]) /* equivalent */ | |||||
# else | # else | ||||
# define erasechar() (_tty.sg_erase) /* equivalent */ | |||||
# define killchar() (_tty.sg_kill) /* equivalent */ | |||||
# define erasechar() (_tty.sg_erase) /* equivalent */ | |||||
# define killchar() (_tty.sg_kill) /* equivalent */ | |||||
# endif /* if UNIXPC */ | # endif /* if UNIXPC */ | ||||
#endif /* if !TERMINFO */ | #endif /* if !TERMINFO */ | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
@@ -103,7 +103,7 @@ crossref(char *srcfile) | |||||
errorsfound = YES; | errorsfound = YES; | ||||
return; | return; | ||||
} | } | ||||
entry_no = 0; | entry_no = 0; | ||||
/* open the source file */ | /* open the source file */ | ||||
if ((yyin = myfopen(srcfile, "r")) == NULL) { | if ((yyin = myfopen(srcfile, "r")) == NULL) { | ||||
@@ -124,7 +124,7 @@ crossref(char *srcfile) | |||||
symbol = malloc(msymbols * sizeof(*symbol)); | symbol = malloc(msymbols * sizeof(*symbol)); | ||||
} | } | ||||
for (;;) { | for (;;) { | ||||
/* get the next token */ | /* get the next token */ | ||||
switch (token = yylex()) { | switch (token = yylex()) { | ||||
default: | default: | ||||
@@ -149,7 +149,7 @@ crossref(char *srcfile) | |||||
if (length == symbol[i].length | if (length == symbol[i].length | ||||
&& strncmp(my_yytext + first, | && strncmp(my_yytext + first, | ||||
my_yytext + symbol[i].first, | my_yytext + symbol[i].first, | ||||
length) == 0 | |||||
length) == 0 | |||||
&& entry_no == symbol[i].fcn_level | && entry_no == symbol[i].fcn_level | ||||
&& token == symbol[i].type | && token == symbol[i].type | ||||
) { /* could be a::a() */ | ) { /* could be a::a() */ | ||||
@@ -175,10 +175,10 @@ crossref(char *srcfile) | |||||
my_yyleng = 0; | my_yyleng = 0; | ||||
#endif | #endif | ||||
break; | break; | ||||
case LEXERR: /* Lexer error, abort further parsing of this file */ | case LEXERR: /* Lexer error, abort further parsing of this file */ | ||||
case LEXEOF: /* end of file; last line may not have \n */ | case LEXEOF: /* end of file; last line may not have \n */ | ||||
/* if there were symbols, output them and the source line */ | /* if there were symbols, output them and the source line */ | ||||
if (symbols > 0) { | if (symbols > 0) { | ||||
putcrossref(); | putcrossref(); | ||||
@@ -253,7 +253,7 @@ putcrossref(void) | |||||
blank = NO; | blank = NO; | ||||
for (i = 0; i < my_yyleng; ++i) { | for (i = 0; i < my_yyleng; ++i) { | ||||
/* change a tab to a blank and compress blanks */ | /* change a tab to a blank and compress blanks */ | ||||
if ((c = my_yytext[i]) == ' ' || c == '\t') { | if ((c = my_yytext[i]) == ' ' || c == '\t') { | ||||
blank = YES; | blank = YES; | ||||
@@ -266,7 +266,7 @@ putcrossref(void) | |||||
dbputc(' '); | dbputc(' '); | ||||
} | } | ||||
dbputc('\n'); /* symbols start on a new line */ | dbputc('\n'); /* symbols start on a new line */ | ||||
/* output any symbol type */ | /* output any symbol type */ | ||||
if ((type = symbol[symput].type) != IDENT) { | if ((type = symbol[symput].type) != IDENT) { | ||||
dbputc('\t'); | dbputc('\t'); | ||||
@@ -287,7 +287,7 @@ putcrossref(void) | |||||
i = j - 1; | i = j - 1; | ||||
++symput; | ++symput; | ||||
} else { | } else { | ||||
/* HBB: try to save some time by early-out handling of | |||||
/* HBB: try to save some time by early-out handling of | |||||
* non-compressed mode */ | * non-compressed mode */ | ||||
if (compress == NO) { | if (compress == NO) { | ||||
if (blank == YES) { | if (blank == YES) { | ||||
@@ -323,11 +323,11 @@ putcrossref(void) | |||||
} | } | ||||
dbputc((int) c); | dbputc((int) c); | ||||
blank = NO; | blank = NO; | ||||
/* skip compressed characters */ | /* skip compressed characters */ | ||||
if (c < ' ') { | if (c < ' ') { | ||||
++i; | ++i; | ||||
/* skip blanks before a preprocesor keyword */ | /* skip blanks before a preprocesor keyword */ | ||||
/* note: don't use isspace() because \f and \v | /* note: don't use isspace() because \f and \v | ||||
are used for keywords */ | are used for keywords */ | ||||
@@ -436,10 +436,10 @@ putposting(char *term, int type) | |||||
do { | do { | ||||
(void) putc(*s, postings); | (void) putc(*s, postings); | ||||
} while (*++s != '\0'); | } while (*++s != '\0'); | ||||
/* postings are also sorted by type */ | /* postings are also sorted by type */ | ||||
(void) putc(type, postings); | (void) putc(type, postings); | ||||
/* function or macro name offset */ | /* function or macro name offset */ | ||||
if (offset > 0) { | if (offset > 0) { | ||||
(void) putc(' ', postings); | (void) putc(' ', postings); | ||||
@@ -462,12 +462,12 @@ writestring(char *s) | |||||
{ | { | ||||
unsigned char c; | unsigned char c; | ||||
int i; | int i; | ||||
if (compress == NO) { | if (compress == NO) { | ||||
/* Save some I/O overhead by using puts() instead of putc(): */ | /* Save some I/O overhead by using puts() instead of putc(): */ | ||||
dbfputs(s); | dbfputs(s); | ||||
return; | return; | ||||
} | |||||
} | |||||
/* compress digraphs */ | /* compress digraphs */ | ||||
for (i = 0; (c = s[i]) != '\0'; ++i) { | for (i = 0; (c = s[i]) != '\0'; ++i) { | ||||
if (/* dicode1[c] && dicode2[(unsigned char) s[i + 1]] */ | if (/* dicode1[c] && dicode2[(unsigned char) s[i + 1]] */ | ||||
@@ -476,7 +476,7 @@ writestring(char *s) | |||||
c = DICODE_COMPRESS(c, s[i + 1]); | c = DICODE_COMPRESS(c, s[i + 1]); | ||||
++i; | ++i; | ||||
} | } | ||||
dbputc(c); | |||||
dbputc(c); | |||||
} | } | ||||
} | } | ||||
@@ -485,8 +485,8 @@ writestring(char *s) | |||||
void | void | ||||
warning(char *text) | warning(char *text) | ||||
{ | { | ||||
(void) fprintf(stderr, "cscope: \"%s\", line %d: warning: %s\n", filename, | |||||
(void) fprintf(stderr, "cscope: \"%s\", line %d: warning: %s\n", filename, | |||||
myylineno, text); | myylineno, text); | ||||
errorsfound = YES; | errorsfound = YES; | ||||
} | } |
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
@@ -125,7 +125,7 @@ sourcedir(char *dirlist) | |||||
makevpsrcdirs(); /* make the view source directory list */ | makevpsrcdirs(); /* make the view source directory list */ | ||||
dirlist = strdup(dirlist); /* don't change environment variable text */ | dirlist = strdup(dirlist); /* don't change environment variable text */ | ||||
/* parse the directory list */ | /* parse the directory list */ | ||||
dir = strtok(dirlist, DIRSEPS); | dir = strtok(dirlist, DIRSEPS); | ||||
while (dir != NULL) { | while (dir != NULL) { | ||||
@@ -133,10 +133,10 @@ sourcedir(char *dirlist) | |||||
addsrcdir(dir); | addsrcdir(dir); | ||||
/* if it isn't a full path name and there is a | |||||
/* if it isn't a full path name and there is a | |||||
multi-directory view path */ | multi-directory view path */ | ||||
if (*dirlist != '/' && vpndirs > 1) { | if (*dirlist != '/' && vpndirs > 1) { | ||||
/* compute its path from higher view path source dirs */ | /* compute its path from higher view path source dirs */ | ||||
for (i = 1; i < nvpsrcdirs; ++i) { | for (i = 1; i < nvpsrcdirs; ++i) { | ||||
snprintf(path, sizeof(path), "%.*s/%s", | snprintf(path, sizeof(path), "%.*s/%s", | ||||
@@ -158,7 +158,7 @@ addsrcdir(char *dir) | |||||
struct stat statstruct; | struct stat statstruct; | ||||
/* make sure it is a directory */ | /* make sure it is a directory */ | ||||
if (lstat(compath(dir), &statstruct) == 0 && | |||||
if (lstat(compath(dir), &statstruct) == 0 && | |||||
S_ISDIR(statstruct.st_mode)) { | S_ISDIR(statstruct.st_mode)) { | ||||
/* note: there already is a source directory list */ | /* note: there already is a source directory list */ | ||||
@@ -193,7 +193,7 @@ includedir(char *dirlist) | |||||
makevpsrcdirs(); /* make the view source directory list */ | makevpsrcdirs(); /* make the view source directory list */ | ||||
dirlist = strdup(dirlist); /* don't change environment variable text */ | dirlist = strdup(dirlist); /* don't change environment variable text */ | ||||
/* parse the directory list */ | /* parse the directory list */ | ||||
dir = strtok(dirlist, DIRSEPS); | dir = strtok(dirlist, DIRSEPS); | ||||
while (dir != NULL) { | while (dir != NULL) { | ||||
@@ -201,13 +201,13 @@ includedir(char *dirlist) | |||||
addincdir(dir, dir); | addincdir(dir, dir); | ||||
/* if it isn't a full path name and there is a | |||||
/* if it isn't a full path name and there is a | |||||
multi-directory view path */ | multi-directory view path */ | ||||
if (*dirlist != '/' && vpndirs > 1) { | if (*dirlist != '/' && vpndirs > 1) { | ||||
/* compute its path from higher view path source dirs */ | /* compute its path from higher view path source dirs */ | ||||
for (i = 1; i < nvpsrcdirs; ++i) { | for (i = 1; i < nvpsrcdirs; ++i) { | ||||
snprintf(path, sizeof(path), "%.*s/%s", | |||||
snprintf(path, sizeof(path), "%.*s/%s", | |||||
(int)(PATHLEN - 2 - dir_len), | (int)(PATHLEN - 2 - dir_len), | ||||
srcdirs[i], dir); | srcdirs[i], dir); | ||||
addincdir(dir, path); | addincdir(dir, path); | ||||
@@ -226,7 +226,7 @@ addincdir(char *name, char *path) | |||||
struct stat statstruct; | struct stat statstruct; | ||||
/* make sure it is a directory */ | /* make sure it is a directory */ | ||||
if (lstat(compath(path), &statstruct) == 0 && | |||||
if (lstat(compath(path), &statstruct) == 0 && | |||||
S_ISDIR(statstruct.st_mode)) { | S_ISDIR(statstruct.st_mode)) { | ||||
if (incdirs == NULL) { | if (incdirs == NULL) { | ||||
incdirs = malloc(mincdirs * sizeof(*incdirs)); | incdirs = malloc(mincdirs * sizeof(*incdirs)); | ||||
@@ -247,7 +247,7 @@ addincdir(char *name, char *path) | |||||
void | void | ||||
freeinclist() | freeinclist() | ||||
{ | { | ||||
if (!incdirs) | |||||
if (!incdirs) | |||||
return; | return; | ||||
while(nincdirs>0) { | while(nincdirs>0) { | ||||
free(incdirs[--nincdirs]); | free(incdirs[--nincdirs]); | ||||
@@ -275,7 +275,7 @@ makefilelist(void) | |||||
/* if -i was NOT given and there are source file arguments */ | /* if -i was NOT given and there are source file arguments */ | ||||
if (namefile == NULL && fileargc > 0) { | if (namefile == NULL && fileargc > 0) { | ||||
/* put them in a list that can be expanded */ | /* put them in a list that can be expanded */ | ||||
for (i = 0; i < fileargc; ++i) { | for (i = 0; i < fileargc; ++i) { | ||||
file = fileargv[i]; | file = fileargv[i]; | ||||
@@ -325,24 +325,24 @@ makefilelist(void) | |||||
/* Kill away \n left at end of fgets()'d string: */ | /* Kill away \n left at end of fgets()'d string: */ | ||||
if (*point_in_line == '\n') | if (*point_in_line == '\n') | ||||
*point_in_line = '\0'; | *point_in_line = '\0'; | ||||
/* Parse whitespace-terminated strings in line: */ | /* Parse whitespace-terminated strings in line: */ | ||||
point_in_line = line; | point_in_line = line; | ||||
while (sscanf(point_in_line, "%" PATHLEN_STR "s", path) == 1) { | while (sscanf(point_in_line, "%" PATHLEN_STR "s", path) == 1) { | ||||
/* Have to store this length --- inviewpath() will | /* Have to store this length --- inviewpath() will | ||||
* modify path, later! */ | * modify path, later! */ | ||||
length_of_name = strlen(path); | length_of_name = strlen(path); | ||||
if (*path == '-') { /* if an option */ | if (*path == '-') { /* if an option */ | ||||
if (unfinished_option) { | if (unfinished_option) { | ||||
/* Can't have another option directly after an | /* Can't have another option directly after an | ||||
* -I or -p option with no name after it! */ | * -I or -p option with no name after it! */ | ||||
fprintf(stderr, "\ | fprintf(stderr, "\ | ||||
cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", | |||||
cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", | |||||
namefile); | namefile); | ||||
unfinished_option = 0; | unfinished_option = 0; | ||||
} | } | ||||
i = path[1]; | i = path[1]; | ||||
switch (i) { | switch (i) { | ||||
case 'c': /* ASCII characters only in crossref */ | case 'c': /* ASCII characters only in crossref */ | ||||
@@ -363,8 +363,8 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", | |||||
s = path + 2; /* for "-Ipath" */ | s = path + 2; /* for "-Ipath" */ | ||||
if (*s == '\0') { /* if "-I path" */ | if (*s == '\0') { /* if "-I path" */ | ||||
unfinished_option = i; | unfinished_option = i; | ||||
break; | |||||
} | |||||
break; | |||||
} | |||||
/* this code block used several times in here | /* this code block used several times in here | ||||
* --> make it a macro to avoid unnecessary | * --> make it a macro to avoid unnecessary | ||||
@@ -398,7 +398,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", | |||||
HANDLE_OPTION_ARGUMENT(i, s) | HANDLE_OPTION_ARGUMENT(i, s) | ||||
break; | break; | ||||
default: | default: | ||||
fprintf(stderr, "cscope: only -I, -c, -k, -p, and -T options can be in file %s\n", | |||||
fprintf(stderr, "cscope: only -I, -c, -k, -p, and -T options can be in file %s\n", | |||||
namefile); | namefile); | ||||
} /* switch(i) */ | } /* switch(i) */ | ||||
} /* if('-') */ | } /* if('-') */ | ||||
@@ -424,7 +424,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", | |||||
} else { | } else { | ||||
newpath[out++] = point_in_line[in++]; | newpath[out++] = point_in_line[in++]; | ||||
} | } | ||||
} /* while(in) */ | |||||
} /* while(in) */ | |||||
if (in >= PATHLEN) { /* safeguard against almost-overflow */ | if (in >= PATHLEN) { /* safeguard against almost-overflow */ | ||||
newpath[out]='\0'; | newpath[out]='\0'; | ||||
} | } | ||||
@@ -489,7 +489,7 @@ scan_dir(const char *adir, BOOL recurse_dir) | |||||
struct dirent *entry; | struct dirent *entry; | ||||
char path[PATHLEN + 1]; | char path[PATHLEN + 1]; | ||||
while ((entry = readdir(dirfile)) != NULL) { | |||||
while ((entry = readdir(dirfile)) != NULL) { | |||||
if ((strcmp(".",entry->d_name) != 0) | if ((strcmp(".",entry->d_name) != 0) | ||||
&& (strcmp("..",entry->d_name) != 0)) { | && (strcmp("..",entry->d_name) != 0)) { | ||||
struct stat buf; | struct stat buf; | ||||
@@ -499,7 +499,7 @@ scan_dir(const char *adir, BOOL recurse_dir) | |||||
entry->d_name); | entry->d_name); | ||||
if (lstat(path,&buf) == 0) { | if (lstat(path,&buf) == 0) { | ||||
if (recurse_dir | |||||
if (recurse_dir | |||||
&& S_ISDIR(buf.st_mode) ) { | && S_ISDIR(buf.st_mode) ) { | ||||
scan_dir(path, recurse_dir); | scan_dir(path, recurse_dir); | ||||
} else if (issrcfile(path) | } else if (issrcfile(path) | ||||
@@ -552,13 +552,13 @@ issrcfile(char *path) | |||||
} | } | ||||
} else if ((s[2] == '\0') /* 2 char suffix */ | } else if ((s[2] == '\0') /* 2 char suffix */ | ||||
&& ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */ | && ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */ | ||||
|| (s[0] == 'q' | |||||
|| (s[0] == 'q' | |||||
&& (s[1] == 'c' || s[1] == 'h')) /* Ingres */ | && (s[1] == 'c' || s[1] == 'h')) /* Ingres */ | ||||
|| (s[0] == 's' && s[1] == 'd') /* SDL */ | || (s[0] == 's' && s[1] == 'd') /* SDL */ | ||||
|| (s[0] == 'c' && s[1] == 'c') /* C++ source */ | || (s[0] == 'c' && s[1] == 'c') /* C++ source */ | ||||
|| (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */ | || (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */ | ||||
looks_like_source = YES; | looks_like_source = YES; | ||||
} else if((s[3] == '\0') /* 3 char suffix */ | } else if((s[3] == '\0') /* 3 char suffix */ | ||||
/* C++ template source */ | /* C++ template source */ | ||||
&& ((s[0] == 't' && s[1] == 'c' && s[2] == 'c' ) | && ((s[0] == 't' && s[1] == 'c' && s[2] == 'c' ) | ||||
@@ -573,9 +573,9 @@ issrcfile(char *path) | |||||
if (looks_like_source != YES) | if (looks_like_source != YES) | ||||
return NO; | return NO; | ||||
/* make sure it is a file */ | /* make sure it is a file */ | ||||
if (lstat(path, &statstruct) == 0 && | |||||
if (lstat(path, &statstruct) == 0 && | |||||
S_ISREG(statstruct.st_mode)) { | S_ISREG(statstruct.st_mode)) { | ||||
return(YES); | return(YES); | ||||
} | } | ||||
@@ -695,7 +695,7 @@ addsrcfile(char *path) | |||||
{ | { | ||||
struct listitem *p; | struct listitem *p; | ||||
int i; | int i; | ||||
/* make sure there is room for the file */ | /* make sure there is room for the file */ | ||||
if (nsrcfiles == msrcfiles) { | if (nsrcfiles == msrcfiles) { | ||||
msrcfiles += SRCINC; | msrcfiles += SRCINC; | ||||
@@ -718,7 +718,7 @@ freefilelist(void) | |||||
struct listitem *p, *nextp; | struct listitem *p, *nextp; | ||||
int i; | int i; | ||||
/* if '-d' option is used a string space block is allocated */ | |||||
/* if '-d' option is used a string space block is allocated */ | |||||
if (isuptodate == NO) { | if (isuptodate == NO) { | ||||
while (nsrcfiles > 0) { | while (nsrcfiles > 0) { | ||||
free (srcfiles[--nsrcfiles]); | free (srcfiles[--nsrcfiles]); | ||||
@@ -734,7 +734,7 @@ freefilelist(void) | |||||
free (srcfiles); /* HBB 20000421: avoid leak */ | free (srcfiles); /* HBB 20000421: avoid leak */ | ||||
msrcfiles = 0; | msrcfiles = 0; | ||||
srcfiles=0; | srcfiles=0; | ||||
for (i = 0; i < HASHMOD; ++i) { | for (i = 0; i < HASHMOD; ++i) { | ||||
for (p = srcnames[i]; p != NULL; p = nextp) { | for (p = srcnames[i]; p != NULL; p = nextp) { | ||||
/* HBB 20000421: avoid memory leak */ | /* HBB 20000421: avoid memory leak */ | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -56,7 +56,7 @@ editref(int i) | |||||
} | } | ||||
/* get the selected line */ | /* get the selected line */ | ||||
seekline(i + topline); | seekline(i + topline); | ||||
/* get the file name and line number */ | /* get the file name and line number */ | ||||
if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file, linenum) == 2) { | if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file, linenum) == 2) { | ||||
edit(file, linenum); /* edit it */ | edit(file, linenum); /* edit it */ | ||||
@@ -79,7 +79,7 @@ editall(void) | |||||
} | } | ||||
/* get the first line */ | /* get the first line */ | ||||
seekline(1); | seekline(1); | ||||
/* get each file name and line number */ | /* get each file name and line number */ | ||||
while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) { | while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) { | ||||
edit(file, linenum); /* edit it */ | edit(file, linenum); /* edit it */ | ||||
@@ -92,7 +92,7 @@ editall(void) | |||||
} | } | ||||
seekline(topline); | seekline(topline); | ||||
} | } | ||||
/* call the editor */ | /* call the editor */ | ||||
void | void | ||||
@@ -108,7 +108,7 @@ edit(char *file, char *linenum) | |||||
(void) snprintf(plusnum, sizeof(plusnum), lineflag, linenum); | (void) snprintf(plusnum, sizeof(plusnum), lineflag, linenum); | ||||
/* if this is the more or page commands */ | /* if this is the more or page commands */ | ||||
if (strcmp(s = basename(editor), "more") == 0 || strcmp(s, "page") == 0) { | if (strcmp(s = basename(editor), "more") == 0 || strcmp(s, "page") == 0) { | ||||
/* get it to pause after displaying a file smaller than the screen | /* get it to pause after displaying a file smaller than the screen | ||||
length */ | length */ | ||||
(void) execute(editor, editor, plusnum, file, "/dev/null", NULL); | (void) execute(editor, editor, plusnum, file, "/dev/null", NULL); | ||||
@@ -128,7 +128,7 @@ char * | |||||
filepath(char *file) | filepath(char *file) | ||||
{ | { | ||||
static char path[PATHLEN + 1]; | static char path[PATHLEN + 1]; | ||||
if (prependpath != NULL && *file != '/') { | if (prependpath != NULL && *file != '/') { | ||||
(void) snprintf(path, sizeof(path), "%s/%s", prependpath, file); | (void) snprintf(path, sizeof(path), "%s/%s", prependpath, file); | ||||
file = path; | file = path; | ||||
@@ -70,9 +70,9 @@ | |||||
#line 1 "src/egrep.y" | #line 1 "src/egrep.y" | ||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -85,7 +85,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -98,7 +98,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* | /* | ||||
@@ -1565,7 +1565,7 @@ yylex(void) | |||||
return (DOT); | return (DOT); | ||||
case '\0': | case '\0': | ||||
return (0); | return (0); | ||||
case '[': | |||||
case '[': | |||||
x = CCL; | x = CCL; | ||||
cclcnt = 0; | cclcnt = 0; | ||||
count = nxtchar++; | count = nxtchar++; | ||||
@@ -1679,12 +1679,12 @@ cfoll(int v) | |||||
if (left[v] == 0) { | if (left[v] == 0) { | ||||
count = 0; | count = 0; | ||||
for (i = 1; i <= line; i++) | |||||
for (i = 1; i <= line; i++) | |||||
tmpstat[i] = 0; | tmpstat[i] = 0; | ||||
follow(v); | follow(v); | ||||
add(foll, v); | add(foll, v); | ||||
} else if (right[v] == 0) | } else if (right[v] == 0) | ||||
cfoll(left[v]); | |||||
cfoll(left[v]); | |||||
else { | else { | ||||
cfoll(left[v]); | cfoll(left[v]); | ||||
cfoll(right[v]); | cfoll(right[v]); | ||||
@@ -1877,7 +1877,7 @@ follow(unsigned int v) | |||||
{ | { | ||||
unsigned int p; | unsigned int p; | ||||
if (v == line) | |||||
if (v == line) | |||||
return; | return; | ||||
p = parent[v]; | p = parent[v]; | ||||
switch(name[p]) { | switch(name[p]) { | ||||
@@ -1896,7 +1896,7 @@ follow(unsigned int v) | |||||
follow(p); | follow(p); | ||||
return; | return; | ||||
} | } | ||||
} else | |||||
} else | |||||
follow(p); | follow(p); | ||||
return; | return; | ||||
case FINAL: | case FINAL: | ||||
@@ -1968,7 +1968,7 @@ egrep(char *file, FILE *output, char *format) | |||||
int in_line; | int in_line; | ||||
FILE *fptr; | FILE *fptr; | ||||
if ((fptr = myfopen(file, "r")) == NULL) | |||||
if ((fptr = myfopen(file, "r")) == NULL) | |||||
return(-1); | return(-1); | ||||
lnum = 1; | lnum = 1; | ||||
@@ -2037,7 +2037,7 @@ egrep(char *file, FILE *output, char *format) | |||||
brk2: | brk2: | ||||
if (--ccount <= 0) { | if (--ccount <= 0) { | ||||
ccount = read_next_chunk(&p, fptr); | ccount = read_next_chunk(&p, fptr); | ||||
if (ccount <= 0) | |||||
if (ccount <= 0) | |||||
break; | break; | ||||
} | } | ||||
in_line = 1; | in_line = 1; | ||||
@@ -1,8 +1,8 @@ | |||||
%{ | %{ | ||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -15,7 +15,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -28,7 +28,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* | /* | ||||
@@ -140,7 +140,7 @@ r: r OR r | |||||
{ $$ = unary(QUEST, $1); } | { $$ = unary(QUEST, $1); } | ||||
| '(' r ')' | | '(' r ')' | ||||
{ $$ = $2; } | { $$ = $2; } | ||||
| error | |||||
| error | |||||
; | ; | ||||
%% | %% | ||||
@@ -175,7 +175,7 @@ yylex(void) | |||||
return (DOT); | return (DOT); | ||||
case '\0': | case '\0': | ||||
return (0); | return (0); | ||||
case '[': | |||||
case '[': | |||||
x = CCL; | x = CCL; | ||||
cclcnt = 0; | cclcnt = 0; | ||||
count = nxtchar++; | count = nxtchar++; | ||||
@@ -289,12 +289,12 @@ cfoll(int v) | |||||
if (left[v] == 0) { | if (left[v] == 0) { | ||||
count = 0; | count = 0; | ||||
for (i = 1; i <= line; i++) | |||||
for (i = 1; i <= line; i++) | |||||
tmpstat[i] = 0; | tmpstat[i] = 0; | ||||
follow(v); | follow(v); | ||||
add(foll, v); | add(foll, v); | ||||
} else if (right[v] == 0) | } else if (right[v] == 0) | ||||
cfoll(left[v]); | |||||
cfoll(left[v]); | |||||
else { | else { | ||||
cfoll(left[v]); | cfoll(left[v]); | ||||
cfoll(right[v]); | cfoll(right[v]); | ||||
@@ -487,7 +487,7 @@ follow(unsigned int v) | |||||
{ | { | ||||
unsigned int p; | unsigned int p; | ||||
if (v == line) | |||||
if (v == line) | |||||
return; | return; | ||||
p = parent[v]; | p = parent[v]; | ||||
switch(name[p]) { | switch(name[p]) { | ||||
@@ -506,7 +506,7 @@ follow(unsigned int v) | |||||
follow(p); | follow(p); | ||||
return; | return; | ||||
} | } | ||||
} else | |||||
} else | |||||
follow(p); | follow(p); | ||||
return; | return; | ||||
case FINAL: | case FINAL: | ||||
@@ -578,7 +578,7 @@ egrep(char *file, FILE *output, char *format) | |||||
int in_line; | int in_line; | ||||
FILE *fptr; | FILE *fptr; | ||||
if ((fptr = myfopen(file, "r")) == NULL) | |||||
if ((fptr = myfopen(file, "r")) == NULL) | |||||
return(-1); | return(-1); | ||||
lnum = 1; | lnum = 1; | ||||
@@ -647,7 +647,7 @@ egrep(char *file, FILE *output, char *format) | |||||
brk2: | brk2: | ||||
if (--ccount <= 0) { | if (--ccount <= 0) { | ||||
ccount = read_next_chunk(&p, fptr); | ccount = read_next_chunk(&p, fptr); | ||||
if (ccount <= 0) | |||||
if (ccount <= 0) | |||||
break; | break; | ||||
} | } | ||||
in_line = 1; | in_line = 1; | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -91,10 +91,10 @@ execute(char *a, ...) /* note: "exec" is already defined on u370 */ | |||||
exitcode = join(p); /* parent */ | exitcode = join(p); /* parent */ | ||||
} | } | ||||
#endif /* MSDOS */ | #endif /* MSDOS */ | ||||
/* the menu and scrollbar may be changed by the command executed */ | /* the menu and scrollbar may be changed by the command executed */ | ||||
#if UNIXPC || !TERMINFO | #if UNIXPC || !TERMINFO | ||||
# ifndef __DJGPP__ /* leave CRLF handling as is */ | |||||
# ifndef __DJGPP__ /* leave CRLF handling as is */ | |||||
nonl(); | nonl(); | ||||
# endif | # endif | ||||
raw(); /* endwin() turns off cbreak mode so restore it */ | raw(); /* endwin() turns off cbreak mode so restore it */ | ||||
@@ -115,7 +115,7 @@ static int | |||||
myexecvp(char *a, char **args) | myexecvp(char *a, char **args) | ||||
{ | { | ||||
char msg[MSGLEN + 1]; | char msg[MSGLEN + 1]; | ||||
/* modify argv[0] to reference the last component of its path name */ | /* modify argv[0] to reference the last component of its path name */ | ||||
args[0] = basename(args[0]); | args[0] = basename(args[0]); | ||||
@@ -137,14 +137,14 @@ myfork(void) | |||||
pid_t p; /* process number */ | pid_t p; /* process number */ | ||||
p = fork(); | p = fork(); | ||||
/* the parent ignores the interrupt, quit, and hangup signals */ | /* the parent ignores the interrupt, quit, and hangup signals */ | ||||
if (p > 0) { | if (p > 0) { | ||||
oldsigquit = signal(SIGQUIT, SIG_IGN); | oldsigquit = signal(SIGQUIT, SIG_IGN); | ||||
oldsighup = signal(SIGHUP, SIG_IGN); | oldsighup = signal(SIGHUP, SIG_IGN); | ||||
#ifdef SIGTSTP | |||||
#ifdef SIGTSTP | |||||
oldsigtstp = signal(SIGTSTP, SIG_DFL); | oldsigtstp = signal(SIGTSTP, SIG_DFL); | ||||
#endif | |||||
#endif | |||||
} | } | ||||
/* so they can be used to stop the child */ | /* so they can be used to stop the child */ | ||||
else if (p == 0) { | else if (p == 0) { | ||||
@@ -153,7 +153,7 @@ myfork(void) | |||||
signal(SIGHUP, SIG_DFL); | signal(SIGHUP, SIG_DFL); | ||||
#ifdef SIGTSTP | #ifdef SIGTSTP | ||||
signal(SIGTSTP, SIG_DFL); | signal(SIGTSTP, SIG_DFL); | ||||
#endif | |||||
#endif | |||||
} | } | ||||
/* check for fork failure */ | /* check for fork failure */ | ||||
if (p == -1) { | if (p == -1) { | ||||
@@ -165,9 +165,9 @@ myfork(void) | |||||
/* join is the compliment of fork */ | /* join is the compliment of fork */ | ||||
static int | static int | ||||
join(pid_t p) | |||||
join(pid_t p) | |||||
{ | { | ||||
int status = -1; | |||||
int status = -1; | |||||
pid_t w; | pid_t w; | ||||
/* wait for the correct child to exit */ | /* wait for the correct child to exit */ | ||||
@@ -180,7 +180,7 @@ join(pid_t p) | |||||
signal(SIGHUP, oldsighup); | signal(SIGHUP, oldsighup); | ||||
#ifdef SIGTSTP | #ifdef SIGTSTP | ||||
signal(SIGTSTP, oldsigtstp); | signal(SIGTSTP, oldsigtstp); | ||||
#endif | |||||
#endif | |||||
/* return the child's exit code */ | /* return the child's exit code */ | ||||
return(status >> 8); | return(status >> 8); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol or text cross-reference | /* cscope - interactive C symbol or text cross-reference | ||||
@@ -49,7 +49,7 @@ | |||||
#include <regex.h> | #include <regex.h> | ||||
/* most of these functions have been optimized so their innermost loops have | /* most of these functions have been optimized so their innermost loops have | ||||
* only one test for the desired character by putting the char and | |||||
* only one test for the desired character by putting the char and | |||||
* an end-of-block marker (\0) at the end of the disk block buffer. | * an end-of-block marker (\0) at the end of the disk block buffer. | ||||
* When the inner loop exits on the char, an outer loop will see if | * When the inner loop exits on the char, an outer loop will see if | ||||
* the char is followed by a \0. If so, it will read the next block | * the char is followed by a \0. If so, it will read the next block | ||||
@@ -101,7 +101,7 @@ findassign(char *pattern) | |||||
/* Test reference whether it's an assignment to the symbol found at | /* Test reference whether it's an assignment to the symbol found at | ||||
* (global variable) 'blockp' */ | * (global variable) 'blockp' */ | ||||
static BOOL | static BOOL | ||||
check_for_assignment(void) | |||||
check_for_assignment(void) | |||||
{ | { | ||||
/* Do the extra work here to determine if this is an | /* Do the extra work here to determine if this is an | ||||
* assignment or not. Do this by examining the next character | * assignment or not. Do this by examining the next character | ||||
@@ -123,21 +123,21 @@ check_for_assignment(void) | |||||
return YES; | return YES; | ||||
} | } | ||||
/* check for plain '=', not '==' */ | /* check for plain '=', not '==' */ | ||||
if ((asgn_char[0] == '=') && | |||||
(((asgn_char[1] != '=') && !(asgn_char[1] & 0x80)) || | |||||
if ((asgn_char[0] == '=') && | |||||
(((asgn_char[1] != '=') && !(asgn_char[1] & 0x80)) || | |||||
((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1]& 0177)/8] != '=')))) { | ((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1]& 0177)/8] != '=')))) { | ||||
return YES; | return YES; | ||||
} | } | ||||
/* check for operator assignments: +=, ... ^= ? */ | /* check for operator assignments: +=, ... ^= ? */ | ||||
if ( ( (asgn_char[0] == '+') | |||||
if ( ( (asgn_char[0] == '+') | |||||
|| (asgn_char[0] == '-') | || (asgn_char[0] == '-') | ||||
|| (asgn_char[0] == '*') | |||||
|| (asgn_char[0] == '/') | |||||
|| (asgn_char[0] == '%') | |||||
|| (asgn_char[0] == '&') | |||||
|| (asgn_char[0] == '|') | |||||
|| (asgn_char[0] == '^') | |||||
|| (asgn_char[0] == '*') | |||||
|| (asgn_char[0] == '/') | |||||
|| (asgn_char[0] == '%') | |||||
|| (asgn_char[0] == '&') | |||||
|| (asgn_char[0] == '|') | |||||
|| (asgn_char[0] == '^') | |||||
) | ) | ||||
&& ((asgn_char[1] == '=') || ((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1] &0177)/8] == '='))) | && ((asgn_char[1] == '=') || ((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1] &0177)/8] == '='))) | ||||
@@ -146,7 +146,7 @@ check_for_assignment(void) | |||||
} | } | ||||
/* check for two-letter operator assignments: <<= or >>= ? */ | /* check for two-letter operator assignments: <<= or >>= ? */ | ||||
if ( ( (asgn_char[0] == '<') | |||||
if ( ( (asgn_char[0] == '<') | |||||
|| (asgn_char[0] == '>') | || (asgn_char[0] == '>') | ||||
) | ) | ||||
&& (asgn_char[1] == asgn_char[0]) | && (asgn_char[1] == asgn_char[0]) | ||||
@@ -190,7 +190,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
strcpy(function, global); /* set the dummy global function name */ | strcpy(function, global); /* set the dummy global function name */ | ||||
strcpy(macro, global); /* set the dummy global macro name */ | strcpy(macro, global); /* set the dummy global macro name */ | ||||
/* find the next symbol */ | /* find the next symbol */ | ||||
/* note: this code was expanded in-line for speed */ | /* note: this code was expanded in-line for speed */ | ||||
/* other macros were replaced by code using cp instead of blockp */ | /* other macros were replaced by code using cp instead of blockp */ | ||||
@@ -220,21 +220,21 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
/* save the name */ | /* save the name */ | ||||
skiprefchar(); | skiprefchar(); | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
/* check for the end of the symbols */ | /* check for the end of the symbols */ | ||||
if (*file == '\0') { | if (*file == '\0') { | ||||
return NULL; | return NULL; | ||||
} | } | ||||
progress("Search", searchcount, nsrcfiles); | progress("Search", searchcount, nsrcfiles); | ||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case FCNEND: /* function end */ | case FCNEND: /* function end */ | ||||
(void) strcpy(function, global); | (void) strcpy(function, global); | ||||
goto notmatched; /* don't match name */ | goto notmatched; /* don't match name */ | ||||
case FCNDEF: /* function name */ | case FCNDEF: /* function name */ | ||||
fcndef = YES; | fcndef = YES; | ||||
s = function; | |||||
s = function; | |||||
s_len = sizeof(function); | s_len = sizeof(function); | ||||
break; | break; | ||||
@@ -242,7 +242,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
if (fileversion >= 10) { | if (fileversion >= 10) { | ||||
s = macro; | s = macro; | ||||
s_len = sizeof(macro); | s_len = sizeof(macro); | ||||
} else { | |||||
} else { | |||||
s = symbol; | s = symbol; | ||||
s_len = sizeof(symbol); | s_len = sizeof(symbol); | ||||
} | } | ||||
@@ -254,7 +254,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
case INCLUDE: /* #include file */ | case INCLUDE: /* #include file */ | ||||
goto notmatched; /* don't match name */ | goto notmatched; /* don't match name */ | ||||
default: /* other symbol */ | default: /* other symbol */ | ||||
s = symbol; | s = symbol; | ||||
s_len = sizeof(symbol); | s_len = sizeof(symbol); | ||||
@@ -264,11 +264,11 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
fetch_string_from_dbase(s, s_len); | fetch_string_from_dbase(s, s_len); | ||||
/* see if this is a regular expression pattern */ | /* see if this is a regular expression pattern */ | ||||
if (isregexp_valid == YES) { | |||||
if (isregexp_valid == YES) { | |||||
if (caseless == YES) { | if (caseless == YES) { | ||||
s = lcasify(s); | s = lcasify(s); | ||||
} | } | ||||
if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | |||||
if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | |||||
goto matched; | goto matched; | ||||
} | } | ||||
} | } | ||||
@@ -280,9 +280,9 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
} | } | ||||
/* if this is a regular expression pattern */ | /* if this is a regular expression pattern */ | ||||
if (isregexp_valid == YES) { | if (isregexp_valid == YES) { | ||||
/* if this is a symbol */ | /* if this is a symbol */ | ||||
/************************************************** | /************************************************** | ||||
* The first character may be a digraph'ed char, so | * The first character may be a digraph'ed char, so | ||||
* unpack it into firstchar, and then test that. | * unpack it into firstchar, and then test that. | ||||
@@ -296,7 +296,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
else { | else { | ||||
firstchar = *cp; | firstchar = *cp; | ||||
} | } | ||||
if (isalpha((unsigned char)firstchar) || firstchar == '_') { | if (isalpha((unsigned char)firstchar) || firstchar == '_') { | ||||
blockp = cp; | blockp = cp; | ||||
fetch_string_from_dbase(symbol, sizeof(symbol)); | fetch_string_from_dbase(symbol, sizeof(symbol)); | ||||
@@ -306,7 +306,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag) | |||||
else { | else { | ||||
s = symbol; | s = symbol; | ||||
} | } | ||||
/* match the symbol to the regular expression */ | /* match the symbol to the regular expression */ | ||||
if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | ||||
goto matched; | goto matched; | ||||
@@ -386,7 +386,7 @@ finddef(char *pattern) | |||||
/* find the next file name or definition */ | /* find the next file name or definition */ | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case NEWFILE: | case NEWFILE: | ||||
skiprefchar(); /* save file name */ | skiprefchar(); /* save file name */ | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
@@ -407,14 +407,14 @@ finddef(char *pattern) | |||||
case GLOBALDEF: /* other global definition */ | case GLOBALDEF: /* other global definition */ | ||||
skiprefchar(); /* match name to pattern */ | skiprefchar(); /* match name to pattern */ | ||||
if (match()) { | if (match()) { | ||||
/* output the file, function and source line */ | /* output the file, function and source line */ | ||||
putref(0, file, pattern); | putref(0, file, pattern); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
return NULL; | return NULL; | ||||
} | } | ||||
/* find all function definitions (used by samuel only) */ | /* find all function definitions (used by samuel only) */ | ||||
@@ -430,7 +430,7 @@ findallfcns(char *dummy) | |||||
/* find the next file name or definition */ | /* find the next file name or definition */ | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case NEWFILE: | case NEWFILE: | ||||
skiprefchar(); /* save file name */ | skiprefchar(); /* save file name */ | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
@@ -439,7 +439,7 @@ findallfcns(char *dummy) | |||||
} | } | ||||
progress("Search", searchcount, nsrcfiles); | progress("Search", searchcount, nsrcfiles); | ||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case FCNEND: /* function end */ | case FCNEND: /* function end */ | ||||
(void) strcpy(function, global); | (void) strcpy(function, global); | ||||
break; | break; | ||||
@@ -471,7 +471,7 @@ findcalling(char *pattern) | |||||
if (invertedindex == YES) { | if (invertedindex == YES) { | ||||
POSTING *p; | POSTING *p; | ||||
findterm(pattern); | findterm(pattern); | ||||
while ((p = getposting()) != NULL) { | while ((p = getposting()) != NULL) { | ||||
if (p->type == FCNCALL) { | if (p->type == FCNCALL) { | ||||
@@ -487,7 +487,7 @@ findcalling(char *pattern) | |||||
for (i = 0; i < 10; i++) *(tmpfunc[i]) = '\0'; | for (i = 0; i < 10; i++) *(tmpfunc[i]) = '\0'; | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case NEWFILE: /* save file name */ | case NEWFILE: /* save file name */ | ||||
skiprefchar(); | skiprefchar(); | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
@@ -497,7 +497,7 @@ findcalling(char *pattern) | |||||
progress("Search", searchcount, nsrcfiles); | progress("Search", searchcount, nsrcfiles); | ||||
(void) strcpy(function, global); | (void) strcpy(function, global); | ||||
break; | break; | ||||
case DEFINE: /* could be a macro */ | case DEFINE: /* could be a macro */ | ||||
if (fileversion >= 10) { | if (fileversion >= 10) { | ||||
skiprefchar(); | skiprefchar(); | ||||
@@ -520,7 +520,7 @@ findcalling(char *pattern) | |||||
if (++morefuns >= 10) morefuns = 9; | if (++morefuns >= 10) morefuns = 9; | ||||
} | } | ||||
break; | break; | ||||
case FCNEND: | case FCNEND: | ||||
for (i = 0; i < morefuns; i++) | for (i = 0; i < morefuns; i++) | ||||
*(tmpfunc[i]) = '\0'; | *(tmpfunc[i]) = '\0'; | ||||
@@ -530,7 +530,7 @@ findcalling(char *pattern) | |||||
case FCNCALL: /* match function called to pattern */ | case FCNCALL: /* match function called to pattern */ | ||||
skiprefchar(); | skiprefchar(); | ||||
if (match()) { | if (match()) { | ||||
/* output the file, calling function or macro, and source */ | /* output the file, calling function or macro, and source */ | ||||
if (*macro != '\0') { | if (*macro != '\0') { | ||||
putref(1, file, macro); | putref(1, file, macro); | ||||
@@ -545,7 +545,7 @@ findcalling(char *pattern) | |||||
} | } | ||||
} | } | ||||
} | } | ||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -566,7 +566,7 @@ findstring(char *pattern) | |||||
*cp++ = *pp; | *cp++ = *pp; | ||||
} | } | ||||
*cp = '\0'; | *cp = '\0'; | ||||
/* search the source files */ | /* search the source files */ | ||||
return(findregexp(egreppat)); | return(findregexp(egreppat)); | ||||
} | } | ||||
@@ -601,7 +601,7 @@ char * | |||||
findfile(char *dummy) | findfile(char *dummy) | ||||
{ | { | ||||
unsigned int i; | unsigned int i; | ||||
(void) dummy; /* unused argument */ | (void) dummy; /* unused argument */ | ||||
for (i = 0; i < nsrcfiles; ++i) { | for (i = 0; i < nsrcfiles; ++i) { | ||||
@@ -613,7 +613,7 @@ findfile(char *dummy) | |||||
s = srcfiles[i]; | s = srcfiles[i]; | ||||
} | } | ||||
if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | ||||
(void) fprintf(refsfound, "%s <unknown> 1 <unknown>\n", | |||||
(void) fprintf(refsfound, "%s <unknown> 1 <unknown>\n", | |||||
srcfiles[i]); | srcfiles[i]); | ||||
} | } | ||||
} | } | ||||
@@ -643,7 +643,7 @@ findinclude(char *pattern) | |||||
/* find the next file name or function definition */ | /* find the next file name or function definition */ | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case NEWFILE: /* save file name */ | case NEWFILE: /* save file name */ | ||||
skiprefchar(); | skiprefchar(); | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
@@ -652,18 +652,18 @@ findinclude(char *pattern) | |||||
} | } | ||||
progress("Search", searchcount, nsrcfiles); | progress("Search", searchcount, nsrcfiles); | ||||
break; | break; | ||||
case INCLUDE: /* match function called to pattern */ | case INCLUDE: /* match function called to pattern */ | ||||
skiprefchar(); | skiprefchar(); | ||||
skiprefchar(); /* skip global or local #include marker */ | skiprefchar(); /* skip global or local #include marker */ | ||||
if (match()) { | if (match()) { | ||||
/* output the file and source line */ | /* output the file and source line */ | ||||
putref(0, file, global); | putref(0, file, global); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -685,7 +685,7 @@ findinit(char *pattern) | |||||
isregexp_valid = NO; | isregexp_valid = NO; | ||||
/* remove trailing white space */ | /* remove trailing white space */ | ||||
for (s = pattern + strlen(pattern) - 1; | |||||
for (s = pattern + strlen(pattern) - 1; | |||||
isspace((unsigned char)*s); | isspace((unsigned char)*s); | ||||
--s) { | --s) { | ||||
*s = '\0'; | *s = '\0'; | ||||
@@ -700,7 +700,7 @@ findinit(char *pattern) | |||||
/* allow a partial match for a file name */ | /* allow a partial match for a file name */ | ||||
if (field == FILENAME || field == INCLUDES) { | if (field == FILENAME || field == INCLUDES) { | ||||
if (regcomp (®exp, pattern, REG_EXTENDED | REG_NOSUB) != 0) { | |||||
if (regcomp (®exp, pattern, REG_EXTENDED | REG_NOSUB) != 0) { | |||||
return(REGCMPERROR); | return(REGCMPERROR); | ||||
} else { | } else { | ||||
isregexp_valid = YES; | isregexp_valid = YES; | ||||
@@ -818,7 +818,7 @@ static BOOL | |||||
matchrest(void) | matchrest(void) | ||||
{ | { | ||||
int i = 1; | int i = 1; | ||||
skiprefchar(); | skiprefchar(); | ||||
do { | do { | ||||
while (*blockp == cpattern[i]) { | while (*blockp == cpattern[i]) { | ||||
@@ -826,7 +826,7 @@ matchrest(void) | |||||
++i; | ++i; | ||||
} | } | ||||
} while (*(blockp + 1) == '\0' && read_block() != NULL); | } while (*(blockp + 1) == '\0' && read_block() != NULL); | ||||
if (*blockp == '\n' && cpattern[i] == '\0') { | if (*blockp == '\n' && cpattern[i] == '\0') { | ||||
return(YES); | return(YES); | ||||
} | } | ||||
@@ -858,7 +858,7 @@ putsource(int seemore, FILE *output) | |||||
char *tmpblockp; | char *tmpblockp; | ||||
char *cp, nextc = '\0'; | char *cp, nextc = '\0'; | ||||
BOOL Change = NO, retreat = NO; | BOOL Change = NO, retreat = NO; | ||||
if (fileversion <= 5) { | if (fileversion <= 5) { | ||||
(void) scanpast(' '); | (void) scanpast(' '); | ||||
putline(output); | putline(output); | ||||
@@ -877,7 +877,7 @@ putsource(int seemore, FILE *output) | |||||
} | } | ||||
} | } | ||||
blockp = cp; | blockp = cp; | ||||
if (*blockp != '\n' || getrefchar() != '\n' || | |||||
if (*blockp != '\n' || getrefchar() != '\n' || | |||||
(!isdigit(getrefchar()) && fileversion >= 12)) { | (!isdigit(getrefchar()) && fileversion >= 12)) { | ||||
postfatal("Internal error: cannot get source line from database"); | postfatal("Internal error: cannot get source line from database"); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
@@ -913,12 +913,12 @@ putline(FILE *output) | |||||
{ | { | ||||
char *cp; | char *cp; | ||||
unsigned c; | unsigned c; | ||||
setmark('\n'); | setmark('\n'); | ||||
cp = blockp; | cp = blockp; | ||||
do { | do { | ||||
while ((c = (unsigned)(*cp)) != '\n') { | while ((c = (unsigned)(*cp)) != '\n') { | ||||
/* check for a compressed digraph */ | /* check for a compressed digraph */ | ||||
if (c > '\177') { | if (c > '\177') { | ||||
c &= 0177; | c &= 0177; | ||||
@@ -980,7 +980,7 @@ char * | |||||
scanpast(char c) | scanpast(char c) | ||||
{ | { | ||||
char *cp; | char *cp; | ||||
setmark(c); | setmark(c); | ||||
cp = blockp; | cp = blockp; | ||||
do { /* innermost loop optimized to only one test */ | do { /* innermost loop optimized to only one test */ | ||||
@@ -1003,11 +1003,11 @@ read_block(void) | |||||
/* read the next block */ | /* read the next block */ | ||||
blocklen = read(symrefs, block, BUFSIZ); | blocklen = read(symrefs, block, BUFSIZ); | ||||
blockp = block; | blockp = block; | ||||
/* add the search character and end-of-block mark */ | /* add the search character and end-of-block mark */ | ||||
block[blocklen] = blockmark; | block[blocklen] = blockmark; | ||||
block[blocklen + 1] = '\0'; | block[blocklen + 1] = '\0'; | ||||
/* return NULL on end-of-file */ | /* return NULL on end-of-file */ | ||||
if (blocklen == 0) { | if (blocklen == 0) { | ||||
blockp = NULL; | blockp = NULL; | ||||
@@ -1023,7 +1023,7 @@ lcasify(char *s) | |||||
{ | { | ||||
static char ls[PATLEN+1]; /* largest possible match string */ | static char ls[PATLEN+1]; /* largest possible match string */ | ||||
char *lptr = ls; | char *lptr = ls; | ||||
while(*s) { | while(*s) { | ||||
*lptr = tolower((unsigned char)*s); | *lptr = tolower((unsigned char)*s); | ||||
lptr++; | lptr++; | ||||
@@ -1049,7 +1049,7 @@ findcalledby(char *pattern) | |||||
if (invertedindex == YES) { | if (invertedindex == YES) { | ||||
POSTING *p; | POSTING *p; | ||||
findterm(pattern); | findterm(pattern); | ||||
while ((p = getposting()) != NULL) { | while ((p = getposting()) != NULL) { | ||||
switch (p->type) { | switch (p->type) { | ||||
@@ -1067,7 +1067,7 @@ findcalledby(char *pattern) | |||||
/* find the function definition(s) */ | /* find the function definition(s) */ | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case NEWFILE: | case NEWFILE: | ||||
skiprefchar(); /* save file name */ | skiprefchar(); /* save file name */ | ||||
fetch_string_from_dbase(file, sizeof(file)); | fetch_string_from_dbase(file, sizeof(file)); | ||||
@@ -1118,7 +1118,7 @@ findterm(char *pattern) | |||||
} | } | ||||
/* if letter case is to be ignored */ | /* if letter case is to be ignored */ | ||||
if (caseless == YES) { | if (caseless == YES) { | ||||
/* convert the prefix to upper case because it is lexically | /* convert the prefix to upper case because it is lexically | ||||
less than lower case */ | less than lower case */ | ||||
s = prefix; | s = prefix; | ||||
@@ -1146,7 +1146,7 @@ findterm(char *pattern) | |||||
} | } | ||||
/* if it matches */ | /* if it matches */ | ||||
if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { | ||||
/* add its postings to the set */ | /* add its postings to the set */ | ||||
if ((postingp = boolfile(&invcontrol, &npostings, BOOL_OR)) == NULL) { | if ((postingp = boolfile(&invcontrol, &npostings, BOOL_OR)) == NULL) { | ||||
break; | break; | ||||
@@ -1154,7 +1154,7 @@ findterm(char *pattern) | |||||
} | } | ||||
/* if there is a prefix */ | /* if there is a prefix */ | ||||
else if (len > 0) { | else if (len > 0) { | ||||
/* if ignoring letter case and the term is out of the | /* if ignoring letter case and the term is out of the | ||||
range of possible matches */ | range of possible matches */ | ||||
if (caseless == YES) { | if (caseless == YES) { | ||||
@@ -1172,7 +1172,7 @@ findterm(char *pattern) | |||||
progress("Symbols matched", searchcount, totalterms); | progress("Symbols matched", searchcount, totalterms); | ||||
} | } | ||||
} while (invforward(&invcontrol)); /* while didn't wrap around */ | } while (invforward(&invcontrol)); /* while didn't wrap around */ | ||||
/* initialize the progress message for retrieving the references */ | /* initialize the progress message for retrieving the references */ | ||||
searchcount = 0; | searchcount = 0; | ||||
postingsfound = npostings; | postingsfound = npostings; | ||||
@@ -1235,7 +1235,7 @@ dbseek(long offset) | |||||
{ | { | ||||
long n; | long n; | ||||
int rc = 0; | int rc = 0; | ||||
if ((n = offset / BUFSIZ) != blocknumber) { | if ((n = offset / BUFSIZ) != blocknumber) { | ||||
if ((rc = lseek(symrefs, n * BUFSIZ, 0)) == -1) { | if ((rc = lseek(symrefs, n * BUFSIZ, 0)) == -1) { | ||||
myperror("Lseek failed"); | myperror("Lseek failed"); | ||||
@@ -1255,15 +1255,15 @@ findcalledbysub(char *file, BOOL macro) | |||||
/* find the next function call or the end of this function */ | /* find the next function call or the end of this function */ | ||||
while (scanpast('\t') != NULL) { | while (scanpast('\t') != NULL) { | ||||
switch (*blockp) { | switch (*blockp) { | ||||
case DEFINE: /* #define inside a function */ | case DEFINE: /* #define inside a function */ | ||||
if (fileversion >= 10) { /* skip it */ | if (fileversion >= 10) { /* skip it */ | ||||
while (scanpast('\t') != NULL && | while (scanpast('\t') != NULL && | ||||
*blockp != DEFINEEND) | |||||
*blockp != DEFINEEND) | |||||
; | ; | ||||
} | } | ||||
break; | break; | ||||
case FCNCALL: /* function call */ | case FCNCALL: /* function call */ | ||||
/* output the file name */ | /* output the file name */ | ||||
@@ -1279,7 +1279,7 @@ findcalledbysub(char *file, BOOL macro) | |||||
break; | break; | ||||
case DEFINEEND: /* #define end */ | case DEFINEEND: /* #define end */ | ||||
if (invertedindex == NO) { | if (invertedindex == NO) { | ||||
if (macro == YES) { | if (macro == YES) { | ||||
return; | return; | ||||
@@ -1,8 +1,8 @@ | |||||
%{ | %{ | ||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -15,7 +15,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -28,7 +28,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -57,8 +57,8 @@ int last; /* buffer index for last char of symbol */ | |||||
int lineno; /* symbol line number */ | int lineno; /* symbol line number */ | ||||
int myylineno = 1; | int myylineno = 1; | ||||
/* HBB 20001007: new variables, emulating yytext in a way that allows | |||||
* the yymore() simulation, my_yymore(), to be used even in the presence of | |||||
/* HBB 20001007: new variables, emulating yytext in a way that allows | |||||
* the yymore() simulation, my_yymore(), to be used even in the presence of | |||||
* yyless(). */ | * yyless(). */ | ||||
size_t my_yyleng = 0; | size_t my_yyleng = 0; | ||||
char *my_yytext = NULL; | char *my_yytext = NULL; | ||||
@@ -141,7 +141,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
first = strlen(my_yytext); | first = strlen(my_yytext); | ||||
if (lex == YES) { | if (lex == YES) { | ||||
(void) strcat(my_yytext, "yylex"); | (void) strcat(my_yytext, "yylex"); | ||||
} else { | |||||
} else { | |||||
/* yacc: yyparse implicitly calls yylex */ | /* yacc: yyparse implicitly calls yylex */ | ||||
char *s = " yylex()"; | char *s = " yylex()"; | ||||
char *cp = s + strlen(s); | char *cp = s + strlen(s); | ||||
@@ -179,7 +179,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
\{ { /* count unmatched left braces for fcn def detection */ | \{ { /* count unmatched left braces for fcn def detection */ | ||||
++braces; | ++braces; | ||||
/* mark an untagged enum/struct/union so its beginning | /* mark an untagged enum/struct/union so its beginning | ||||
can be found */ | can be found */ | ||||
if (tagdef) { | if (tagdef) { | ||||
@@ -214,7 +214,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
} | } | ||||
<WAS_ENDIF>\n{wsnl}*#{ws}*if(ndef|def)?{ws}+ { | <WAS_ENDIF>\n{wsnl}*#{ws}*if(ndef|def)?{ws}+ { | ||||
/* attempt to correct erroneous brace count caused by: | /* attempt to correct erroneous brace count caused by: | ||||
* | |||||
* | |||||
* #if ... | * #if ... | ||||
* ... { | * ... { | ||||
* #endif | * #endif | ||||
@@ -274,7 +274,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
<IN_PREPROC>else({ws}.*)? { /* #else --- eat up whole line */ | <IN_PREPROC>else({ws}.*)? { /* #else --- eat up whole line */ | ||||
elseelif = YES; | elseelif = YES; | ||||
if (iflevel > 0) { | if (iflevel > 0) { | ||||
/* save the maximum brace count for this #if */ | /* save the maximum brace count for this #if */ | ||||
if (braces > maxifbraces[iflevel - 1]) { | if (braces > maxifbraces[iflevel - 1]) { | ||||
maxifbraces[iflevel - 1] = braces; | maxifbraces[iflevel - 1] = braces; | ||||
@@ -290,7 +290,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
/* elseelif = YES; --- HBB I doubt this is correct */ | /* elseelif = YES; --- HBB I doubt this is correct */ | ||||
elif: | elif: | ||||
if (iflevel > 0) { | if (iflevel > 0) { | ||||
/* save the maximum brace count for this #if */ | /* save the maximum brace count for this #if */ | ||||
if (braces > maxifbraces[iflevel - 1]) { | if (braces > maxifbraces[iflevel - 1]) { | ||||
maxifbraces[iflevel - 1] = braces; | maxifbraces[iflevel - 1] = braces; | ||||
@@ -307,7 +307,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
<IN_PREPROC>include{ws}*<[^>\n]+> { /* #include file */ | <IN_PREPROC>include{ws}*<[^>\n]+> { /* #include file */ | ||||
char *s; | char *s; | ||||
char remember = yytext[yyleng-1]; | char remember = yytext[yyleng-1]; | ||||
my_yymore(); | my_yymore(); | ||||
s = strpbrk(my_yytext, "\"<"); | s = strpbrk(my_yytext, "\"<"); | ||||
if (!s) | if (!s) | ||||
@@ -418,7 +418,7 @@ wsnl [ \t\r\v\f\n]|{comment} | |||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
<IN_PREPROC>define{ws}+{identifier} { | <IN_PREPROC>define{ws}+{identifier} { | ||||
/* preprocessor macro or constant definition */ | /* preprocessor macro or constant definition */ | ||||
ppdefine = YES; | ppdefine = YES; | ||||
token = DEFINE; | token = DEFINE; | ||||
@@ -484,7 +484,7 @@ class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ { /* class definition */ | |||||
tagdef = '\0'; | tagdef = '\0'; | ||||
goto more; | goto more; | ||||
} | } | ||||
({wsnl}+{identifier})?{wsnl}* | | |||||
({wsnl}+{identifier})?{wsnl}* | | |||||
.|\n { /* e/s/u usage */ | .|\n { /* e/s/u usage */ | ||||
BEGIN(WAS_IDENTIFIER); | BEGIN(WAS_IDENTIFIER); | ||||
goto ident; | goto ident; | ||||
@@ -495,7 +495,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
yyless(2); | yyless(2); | ||||
yy_set_bol(0); | yy_set_bol(0); | ||||
goto more; | goto more; | ||||
} | |||||
} | |||||
{identifier} { /* identifier found: do nothing, yet. (!) */ | {identifier} { /* identifier found: do nothing, yet. (!) */ | ||||
BEGIN(WAS_IDENTIFIER); | BEGIN(WAS_IDENTIFIER); | ||||
@@ -504,14 +504,14 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
<WAS_IDENTIFIER>{ | |||||
<WAS_IDENTIFIER>{ | |||||
{ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.:])*\)([()]|{wsnl})*[:a-zA-Z_#{] { | {ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.:])*\)([()]|{wsnl})*[:a-zA-Z_#{] { | ||||
/* a function definition */ | /* a function definition */ | ||||
/* note: "#define a (b) {" and "#if defined(a)\n#" | |||||
/* note: "#define a (b) {" and "#if defined(a)\n#" | |||||
* are not fcn definitions! */ | * are not fcn definitions! */ | ||||
/* warning: "if (...)" must not overflow yytext, | |||||
* so the content of function argument definitions | |||||
* is restricted, in particular parentheses are | |||||
/* warning: "if (...)" must not overflow yytext, | |||||
* so the content of function argument definitions | |||||
* is restricted, in particular parentheses are | |||||
* not allowed */ | * not allowed */ | ||||
/* FIXME HBB 20001003: the above 'not allowed' may well be the | /* FIXME HBB 20001003: the above 'not allowed' may well be the | ||||
* reason for the parsing bug concerning function pointer usage, | * reason for the parsing bug concerning function pointer usage, | ||||
@@ -548,10 +548,10 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
char *s; | char *s; | ||||
if (global == YES && ppdefine == NO && my_yytext[0] != '#' && | if (global == YES && ppdefine == NO && my_yytext[0] != '#' && | ||||
external == NO && initializer == NO && | |||||
external == NO && initializer == NO && | |||||
arraydimension == NO && structfield == NO && | arraydimension == NO && structfield == NO && | ||||
template == NO && fcndef == NO) { | template == NO && fcndef == NO) { | ||||
if (esudef == YES) { | |||||
if (esudef == YES) { | |||||
/* if enum/struct/union */ | /* if enum/struct/union */ | ||||
token = MEMBERDEF; | token = MEMBERDEF; | ||||
} else { | } else { | ||||
@@ -564,7 +564,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
fcn: | fcn: | ||||
if (YYSTATE == WAS_IDENTIFIER) { | if (YYSTATE == WAS_IDENTIFIER) { | ||||
/* Position back to the actual identifier: */ | /* Position back to the actual identifier: */ | ||||
last = first; | |||||
last = first; | |||||
first = ident_start; | first = ident_start; | ||||
yyless(0); | yyless(0); | ||||
/* HBB 20001008: if the anti-backup-pattern above matched, | /* HBB 20001008: if the anti-backup-pattern above matched, | ||||
@@ -583,10 +583,10 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
/* if a long line */ | /* if a long line */ | ||||
if (yyleng > STMTMAX) { | if (yyleng > STMTMAX) { | ||||
int c; | int c; | ||||
/* skip to the end of the line */ | /* skip to the end of the line */ | ||||
warning("line too long"); | warning("line too long"); | ||||
while ((c = input()) > LEXEOF) { | |||||
while ((c = input()) > LEXEOF) { | |||||
if (c == '\n') { | if (c == '\n') { | ||||
unput(c); | unput(c); | ||||
break; | break; | ||||
@@ -603,7 +603,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
/* if found word was a keyword: */ | /* if found word was a keyword: */ | ||||
if ((s = lookup(my_yytext + first)) != NULL) { | if ((s = lookup(my_yytext + first)) != NULL) { | ||||
first = my_yyleng; | first = my_yyleng; | ||||
/* if the start of a typedef */ | /* if the start of a typedef */ | ||||
if (s == typedeftext) { | if (s == typedeftext) { | ||||
typedefbraces = braces; | typedefbraces = braces; | ||||
@@ -619,19 +619,19 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
externalbraces = braces; | externalbraces = braces; | ||||
external = YES; | external = YES; | ||||
} else if (templateparens == parens && template == YES) { | } else if (templateparens == parens && template == YES) { | ||||
/* keyword doesn't start a function | |||||
/* keyword doesn't start a function | |||||
* template */ | * template */ | ||||
templateparens = -1; | templateparens = -1; | ||||
template = NO; | template = NO; | ||||
} else { | |||||
/* identifier after typedef was a | |||||
} else { | |||||
/* identifier after typedef was a | |||||
* keyword */ | * keyword */ | ||||
oldtype = NO; | oldtype = NO; | ||||
} | } | ||||
} else { | |||||
} else { | |||||
/* not a keyword --> found an identifier */ | /* not a keyword --> found an identifier */ | ||||
/* last = yyleng; */ | /* last = yyleng; */ | ||||
/* if a class/enum/struct/union tag definition */ | /* if a class/enum/struct/union tag definition */ | ||||
/* FIXME HBB 20001001: why reject "class"? */ | /* FIXME HBB 20001001: why reject "class"? */ | ||||
if (tagdef && strnotequal(my_yytext + first, "class")) { | if (tagdef && strnotequal(my_yytext + first, "class")) { | ||||
@@ -722,12 +722,12 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
} | } | ||||
\' { /* character constant */ | \' { /* character constant */ | ||||
if (sdl == NO) | |||||
if (sdl == NO) | |||||
BEGIN(IN_SQUOTE); | BEGIN(IN_SQUOTE); | ||||
goto more; | goto more; | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
<IN_SQUOTE>\' { | |||||
<IN_SQUOTE>\' { | |||||
BEGIN(INITIAL); | BEGIN(INITIAL); | ||||
goto more; | goto more; | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
@@ -737,7 +737,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
goto more; | goto more; | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
<IN_DQUOTE>\" { | |||||
<IN_DQUOTE>\" { | |||||
BEGIN(INITIAL); | BEGIN(INITIAL); | ||||
goto more; | goto more; | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
@@ -759,10 +759,10 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
} | } | ||||
^{ws}+ { /* don't save leading white space */ | ^{ws}+ { /* don't save leading white space */ | ||||
} | } | ||||
{ws}+\n { /* eat whitespace at end of line */ | {ws}+\n { /* eat whitespace at end of line */ | ||||
unput('\n'); | unput('\n'); | ||||
} | } | ||||
@@ -794,7 +794,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
unput(' '); | unput(' '); | ||||
yy_pop_state(); | yy_pop_state(); | ||||
} | } | ||||
} | |||||
} | |||||
"//".*\n? { | "//".*\n? { | ||||
/* C++-style one-line comment */ | /* C++-style one-line comment */ | ||||
@@ -805,7 +805,7 @@ if{wsnl}*\( { /* ignore 'if' */ | |||||
{number} | /* number */ | {number} | /* number */ | ||||
<SDL>STATE[ \t]+ | /* ... and other syntax error catchers... */ | <SDL>STATE[ \t]+ | /* ... and other syntax error catchers... */ | ||||
. { /* punctuation and operators */ | . { /* punctuation and operators */ | ||||
more: | |||||
more: | |||||
my_yymore(); | my_yymore(); | ||||
first = my_yyleng; | first = my_yyleng; | ||||
} | } | ||||
@@ -816,7 +816,7 @@ void | |||||
initscanner(char *srcfile) | initscanner(char *srcfile) | ||||
{ | { | ||||
char *s; | char *s; | ||||
if (maxifbraces == NULL) { | if (maxifbraces == NULL) { | ||||
maxifbraces = malloc(miflevel * sizeof(*maxifbraces)); | maxifbraces = malloc(miflevel * sizeof(*maxifbraces)); | ||||
preifbraces = malloc(miflevel * sizeof(*preifbraces)); | preifbraces = malloc(miflevel * sizeof(*preifbraces)); | ||||
@@ -855,7 +855,7 @@ initscanner(char *srcfile) | |||||
if (my_yytext) | if (my_yytext) | ||||
*my_yytext = '\0'; | *my_yytext = '\0'; | ||||
my_yyleng = 0; | my_yyleng = 0; | ||||
BEGIN(INITIAL); | BEGIN(INITIAL); | ||||
/* if this is not a C file */ | /* if this is not a C file */ | ||||
@@ -892,13 +892,13 @@ static void | |||||
my_yymore(void) | my_yymore(void) | ||||
{ | { | ||||
static size_t yytext_size = 0; | static size_t yytext_size = 0; | ||||
/* my_yytext is an ever-growing buffer. It will not ever | /* my_yytext is an ever-growing buffer. It will not ever | ||||
* shrink, nor will it be freed at end of program, for now */ | * shrink, nor will it be freed at end of program, for now */ | ||||
while (my_yyleng + yyleng + 1 >= yytext_size) { | while (my_yyleng + yyleng + 1 >= yytext_size) { | ||||
my_yytext = realloc(my_yytext, yytext_size += MY_YY_ALLOCSTEP); | my_yytext = realloc(my_yytext, yytext_size += MY_YY_ALLOCSTEP); | ||||
} | } | ||||
strncpy (my_yytext + my_yyleng, yytext, yyleng+1); | strncpy (my_yytext + my_yyleng, yytext, yyleng+1); | ||||
my_yyleng += yyleng; | my_yyleng += yyleng; | ||||
} | } |
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -58,30 +58,30 @@ typedef void (*sighandler_t)(int); | |||||
#include <fcntl.h> | #include <fcntl.h> | ||||
typedef enum { /* boolean data type */ | |||||
typedef enum { /* boolean data type */ | |||||
NO, | NO, | ||||
YES | YES | ||||
} BOOL; | } BOOL; | ||||
typedef enum { /* findinit return code */ | |||||
typedef enum { /* findinit return code */ | |||||
NOERROR, | NOERROR, | ||||
NOTSYMBOL, | NOTSYMBOL, | ||||
REGCMPERROR | REGCMPERROR | ||||
} FINDINIT; | } FINDINIT; | ||||
typedef struct { /* mouse action */ | |||||
int button; | |||||
int percent; | |||||
int x1; | |||||
int y1; | |||||
int x2; | |||||
int y2; | |||||
typedef struct { /* mouse action */ | |||||
int button; | |||||
int percent; | |||||
int x1; | |||||
int y1; | |||||
int x2; | |||||
int y2; | |||||
} MOUSE; | } MOUSE; | ||||
struct cmd { /* command history struct */ | |||||
struct cmd *prev, *next; /* list ptrs */ | |||||
int field; /* input field number */ | |||||
char *text; /* input field text */ | |||||
struct cmd { /* command history struct */ | |||||
struct cmd *prev, *next; /* list ptrs */ | |||||
int field; /* input field number */ | |||||
char *text; /* input field text */ | |||||
}; | }; | ||||
enum { | enum { | ||||
@@ -100,113 +100,113 @@ enum { | |||||
/* digraph data for text compression */ | /* digraph data for text compression */ | ||||
extern char dichar1[]; /* 16 most frequent first chars */ | |||||
extern char dichar2[]; /* 8 most frequent second chars | |||||
using the above as first chars */ | |||||
extern char dicode1[]; /* digraph first character code */ | |||||
extern char dicode2[]; /* digraph second character code */ | |||||
extern char dichar1[]; /* 16 most frequent first chars */ | |||||
extern char dichar2[]; /* 8 most frequent second chars | |||||
using the above as first chars */ | |||||
extern char dicode1[]; /* digraph first character code */ | |||||
extern char dicode2[]; /* digraph second character code */ | |||||
/* and some macros to help using dicodes: */ | /* and some macros to help using dicodes: */ | ||||
/* Check if a given pair of chars is compressable as a dicode: */ | /* Check if a given pair of chars is compressable as a dicode: */ | ||||
#define IS_A_DICODE(inchar1, inchar2) \ | |||||
#define IS_A_DICODE(inchar1, inchar2) \ | |||||
(dicode1[(unsigned char)(inchar1)] && dicode2[(unsigned char)(inchar2)]) | (dicode1[(unsigned char)(inchar1)] && dicode2[(unsigned char)(inchar2)]) | ||||
/* Combine the pair into a dicode */ | /* Combine the pair into a dicode */ | ||||
#define DICODE_COMPRESS(inchar1, inchar2) \ | |||||
#define DICODE_COMPRESS(inchar1, inchar2) \ | |||||
((0200 - 2) + dicode1[(unsigned char)(inchar1)] \ | ((0200 - 2) + dicode1[(unsigned char)(inchar1)] \ | ||||
+ dicode2[(unsigned char)(inchar2)]) | + dicode2[(unsigned char)(inchar2)]) | ||||
/* main.c global data */ | /* main.c global data */ | ||||
extern char *editor, *home, *shell, *lineflag; /* environment variables */ | |||||
extern char *home; /* Home directory */ | |||||
extern BOOL lineflagafterfile; | |||||
extern char *argv0; /* command name */ | |||||
extern BOOL compress; /* compress the characters in the crossref */ | |||||
extern BOOL dbtruncated; /* database symbols truncated to 8 chars */ | |||||
extern int dispcomponents; /* file path components to display */ | |||||
extern char *editor, *home, *shell, *lineflag; /* environment variables */ | |||||
extern char *home; /* Home directory */ | |||||
extern BOOL lineflagafterfile; | |||||
extern char *argv0; /* command name */ | |||||
extern BOOL compress; /* compress the characters in the crossref */ | |||||
extern BOOL dbtruncated; /* database symbols truncated to 8 chars */ | |||||
extern int dispcomponents; /* file path components to display */ | |||||
#if CCS | #if CCS | ||||
extern BOOL displayversion; /* display the C Compilation System version */ | |||||
extern BOOL displayversion; /* display the C Compilation System version */ | |||||
#endif | #endif | ||||
extern BOOL editallprompt; /* prompt between editing files */ | |||||
extern unsigned int fileargc; /* file argument count */ | |||||
extern char **fileargv; /* file argument values */ | |||||
extern int fileversion; /* cross-reference file version */ | |||||
extern BOOL incurses; /* in curses */ | |||||
extern BOOL invertedindex; /* the database has an inverted index */ | |||||
extern BOOL isuptodate; /* consider the crossref up-to-date */ | |||||
extern BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */ | |||||
extern BOOL linemode; /* use line oriented user interface */ | |||||
extern BOOL verbosemode; /* print extra information on line mode */ | |||||
extern BOOL recurse_dir; /* recurse dirs when searching for src files */ | |||||
extern char *namefile; /* file of file names */ | |||||
extern BOOL ogs; /* display OGS book and subsystem names */ | |||||
extern char *prependpath; /* prepend path to file names */ | |||||
extern FILE *refsfound; /* references found file */ | |||||
extern char temp1[]; /* temporary file name */ | |||||
extern char temp2[]; /* temporary file name */ | |||||
extern long totalterms; /* total inverted index terms */ | |||||
extern BOOL trun_syms; /* truncate symbols to 8 characters */ | |||||
extern char tempstring[TEMPSTRING_LEN + 1]; /* global dummy string buffer */ | |||||
extern char *tmpdir; /* temporary directory */ | |||||
extern BOOL editallprompt; /* prompt between editing files */ | |||||
extern unsigned int fileargc; /* file argument count */ | |||||
extern char **fileargv; /* file argument values */ | |||||
extern int fileversion; /* cross-reference file version */ | |||||
extern BOOL incurses; /* in curses */ | |||||
extern BOOL invertedindex; /* the database has an inverted index */ | |||||
extern BOOL isuptodate; /* consider the crossref up-to-date */ | |||||
extern BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */ | |||||
extern BOOL linemode; /* use line oriented user interface */ | |||||
extern BOOL verbosemode; /* print extra information on line mode */ | |||||
extern BOOL recurse_dir; /* recurse dirs when searching for src files */ | |||||
extern char *namefile; /* file of file names */ | |||||
extern BOOL ogs; /* display OGS book and subsystem names */ | |||||
extern char *prependpath; /* prepend path to file names */ | |||||
extern FILE *refsfound; /* references found file */ | |||||
extern char temp1[]; /* temporary file name */ | |||||
extern char temp2[]; /* temporary file name */ | |||||
extern long totalterms; /* total inverted index terms */ | |||||
extern BOOL trun_syms; /* truncate symbols to 8 characters */ | |||||
extern char tempstring[TEMPSTRING_LEN + 1]; /* global dummy string buffer */ | |||||
extern char *tmpdir; /* temporary directory */ | |||||
/* command.c global data */ | /* command.c global data */ | ||||
extern BOOL caseless; /* ignore letter case when searching */ | |||||
extern BOOL *change; /* change this line */ | |||||
extern BOOL changing; /* changing text */ | |||||
extern BOOL caseless; /* ignore letter case when searching */ | |||||
extern BOOL *change; /* change this line */ | |||||
extern BOOL changing; /* changing text */ | |||||
extern unsigned int curdispline; | extern unsigned int curdispline; | ||||
extern char newpat[]; /* new pattern */ | |||||
extern char newpat[]; /* new pattern */ | |||||
/* crossref.c global data */ | /* crossref.c global data */ | ||||
extern long dboffset; /* new database offset */ | |||||
extern BOOL errorsfound; /* prompt before clearing error messages */ | |||||
extern long lineoffset; /* source line database offset */ | |||||
extern long npostings; /* number of postings */ | |||||
extern unsigned long symbols; /* number of symbols */ | |||||
extern long dboffset; /* new database offset */ | |||||
extern BOOL errorsfound; /* prompt before clearing error messages */ | |||||
extern long lineoffset; /* source line database offset */ | |||||
extern long npostings; /* number of postings */ | |||||
extern unsigned long symbols; /* number of symbols */ | |||||
/* dir.c global data */ | /* dir.c global data */ | ||||
extern char currentdir[]; /* current directory */ | |||||
extern char **incdirs; /* #include directories */ | |||||
extern char **srcdirs; /* source directories */ | |||||
extern char **srcfiles; /* source files */ | |||||
extern unsigned long nincdirs; /* number of #include directories */ | |||||
extern unsigned long nsrcdirs; /* number of source directories */ | |||||
extern char currentdir[]; /* current directory */ | |||||
extern char **incdirs; /* #include directories */ | |||||
extern char **srcdirs; /* source directories */ | |||||
extern char **srcfiles; /* source files */ | |||||
extern unsigned long nincdirs; /* number of #include directories */ | |||||
extern unsigned long nsrcdirs; /* number of source directories */ | |||||
extern unsigned long nsrcfiles; /* number of source files */ | extern unsigned long nsrcfiles; /* number of source files */ | ||||
extern unsigned long msrcfiles; /* maximum number of source files */ | extern unsigned long msrcfiles; /* maximum number of source files */ | ||||
/* display.c global data */ | /* display.c global data */ | ||||
extern int subsystemlen; /* OGS subsystem name display field length */ | |||||
extern int booklen; /* OGS book name display field length */ | |||||
extern int filelen; /* file name display field length */ | |||||
extern int fcnlen; /* function name display field length */ | |||||
extern int numlen; /* line number display field length */ | |||||
extern int *displine; /* screen line of displayed reference */ | |||||
extern unsigned int disprefs; /* displayed references */ | |||||
extern int field; /* input field */ | |||||
extern unsigned fldcolumn; /* input field column */ | |||||
extern unsigned int mdisprefs; /* maximum displayed references */ | |||||
extern unsigned int nextline; /* next line to be shown */ | |||||
extern FILE *nonglobalrefs; /* non-global references file */ | |||||
extern unsigned int topline; /* top line of page */ | |||||
extern long searchcount; /* count of files searched */ | |||||
extern unsigned int totallines; /* total reference lines */ | |||||
extern const char dispchars[]; /* display chars for jumping to lines */ | |||||
extern int subsystemlen; /* OGS subsystem name display field length */ | |||||
extern int booklen; /* OGS book name display field length */ | |||||
extern int filelen; /* file name display field length */ | |||||
extern int fcnlen; /* function name display field length */ | |||||
extern int numlen; /* line number display field length */ | |||||
extern int *displine; /* screen line of displayed reference */ | |||||
extern unsigned int disprefs; /* displayed references */ | |||||
extern int field; /* input field */ | |||||
extern unsigned fldcolumn; /* input field column */ | |||||
extern unsigned int mdisprefs; /* maximum displayed references */ | |||||
extern unsigned int nextline; /* next line to be shown */ | |||||
extern FILE *nonglobalrefs; /* non-global references file */ | |||||
extern unsigned int topline; /* top line of page */ | |||||
extern long searchcount; /* count of files searched */ | |||||
extern unsigned int totallines; /* total reference lines */ | |||||
extern const char dispchars[]; /* display chars for jumping to lines */ | |||||
extern int window_change; | extern int window_change; | ||||
/* find.c global data */ | /* find.c global data */ | ||||
extern char block[]; /* cross-reference file block */ | |||||
extern char blockmark; /* mark character to be searched for */ | |||||
extern long blocknumber; /* block number */ | |||||
extern char *blockp; /* pointer to current character in block */ | |||||
extern int blocklen; /* length of disk block read */ | |||||
extern char block[]; /* cross-reference file block */ | |||||
extern char blockmark; /* mark character to be searched for */ | |||||
extern long blocknumber; /* block number */ | |||||
extern char *blockp; /* pointer to current character in block */ | |||||
extern int blocklen; /* length of disk block read */ | |||||
/* lookup.c global data */ | /* lookup.c global data */ | ||||
extern struct keystruct { | |||||
char *text; | |||||
char delim; | |||||
struct keystruct *next; | |||||
extern struct keystruct { | |||||
char *text; | |||||
char delim; | |||||
struct keystruct *next; | |||||
} keyword[]; | } keyword[]; | ||||
/* mouse.c global data */ | /* mouse.c global data */ | ||||
extern BOOL mouse; /* mouse interface */ | |||||
extern BOOL mouse; /* mouse interface */ | |||||
/* readline.c global data */ | /* readline.c global data */ | ||||
extern char* rl_line_buffer; | extern char* rl_line_buffer; | ||||
@@ -214,10 +214,10 @@ extern char input_line[PATLEN + 1]; | |||||
extern int rl_point; | extern int rl_point; | ||||
#if UNIXPC | #if UNIXPC | ||||
extern BOOL unixpcmouse; /* UNIX PC mouse interface */ | |||||
extern BOOL unixpcmouse; /* UNIX PC mouse interface */ | |||||
#endif | #endif | ||||
/* cscope functions called from more than one function or between files */ | |||||
/* cscope functions called from more than one function or between files */ | |||||
char *filepath(char *file); | char *filepath(char *file); | ||||
char *findcalledby(char *pattern); | char *findcalledby(char *pattern); | ||||
@@ -241,8 +241,8 @@ void error_usage(void); | |||||
void longusage(void); | void longusage(void); | ||||
void usage(void); | void usage(void); | ||||
extern BOOL remove_symfile_onexit; | extern BOOL remove_symfile_onexit; | ||||
extern BOOL onesearch; /* one search only in line mode */ | |||||
extern char *reflines; /* symbol reference lines file */ | |||||
extern BOOL onesearch; /* one search only in line mode */ | |||||
extern char *reflines; /* symbol reference lines file */ | |||||
void verswp_field(void); | void verswp_field(void); | ||||
void horswp_field(void); | void horswp_field(void); | ||||
BOOL interpret(int c); // XXX: probably rename | BOOL interpret(int c); // XXX: probably rename | ||||
@@ -1 +1 @@ | |||||
/* Placeholder file --- replace by real gscope.c if you have it */ | |||||
/* Placeholder file --- replace by real gscope.c if you have it */ |
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -51,7 +51,7 @@ | |||||
void | void | ||||
help(void) | help(void) | ||||
{ | { | ||||
char **ep, *s, **tp, *text[MAXHELP]; | |||||
char **ep, *s, **tp, *text[MAXHELP]; | |||||
int ln; | int ln; | ||||
tp = text; | tp = text; | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol or text cross-reference | /* cscope - interactive C symbol or text cross-reference | ||||
@@ -73,7 +73,7 @@ prevcmd(void) | |||||
return current; | return current; | ||||
} else if( tail) | } else if( tail) | ||||
return current = tail; | return current = tail; | ||||
else | |||||
else | |||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -86,7 +86,7 @@ nextcmd(void) | |||||
return current = current->next; | return current = current->next; | ||||
else | else | ||||
return current; | return current; | ||||
} else | |||||
} else | |||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -259,7 +259,7 @@ askforreturn(void) | |||||
/* expand the ~ and $ shell meta characters in a path */ | /* expand the ~ and $ shell meta characters in a path */ | ||||
void | void | ||||
shellpath(char *out, int limit, char *in) | |||||
shellpath(char *out, int limit, char *in) | |||||
{ | { | ||||
char *lastchar; | char *lastchar; | ||||
char *s, *v; | char *s, *v; | ||||
@@ -311,7 +311,7 @@ shellpath(char *out, int limit, char *in) | |||||
*s++ = *in++; | *s++ = *in++; | ||||
} | } | ||||
*s = '\0'; | *s = '\0'; | ||||
/* get its value, but only it isn't too big */ | /* get its value, but only it isn't too big */ | ||||
if ((v = getenv(out)) != NULL && strlen(v) < (lastchar - out)) { | if ((v = getenv(out)) != NULL && strlen(v) < (lastchar - out)) { | ||||
strcpy(out - 1, v); | strcpy(out - 1, v); | ||||
@@ -403,7 +403,7 @@ global_input(const int c){ | |||||
case KEY_NPAGE: | case KEY_NPAGE: | ||||
if (totallines == 0) { return(NO); } /* don't redisplay if there are no lines */ | if (totallines == 0) { return(NO); } /* don't redisplay if there are no lines */ | ||||
/* XXX: figure out whether this comment is useful or not */ | /* XXX: figure out whether this comment is useful or not */ | ||||
/* NOTE: seekline() is not used to move to the next | |||||
/* NOTE: seekline() is not used to move to the next | |||||
* page because display() leaves the file pointer at | * page because display() leaves the file pointer at | ||||
* the next page to optimize paging forward | * the next page to optimize paging forward | ||||
*/ | */ | ||||
@@ -435,7 +435,7 @@ global_input(const int c){ | |||||
break; | break; | ||||
case '>': /* write or append the lines to a file */ | case '>': /* write or append the lines to a file */ | ||||
break; // XXX | break; // XXX | ||||
//char filename[PATHLEN + 1]; | |||||
//char filename[PATHLEN + 1]; | |||||
//char* s; | //char* s; | ||||
//char ch; | //char ch; | ||||
//FILE* file; | //FILE* file; | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
@@ -279,8 +279,8 @@ invmake(char *invname, char *invpost, FILE *infile) | |||||
} | } | ||||
/* save the size for reference later */ | /* save the size for reference later */ | ||||
nextsupfing = sizeof(long) + sizeof(long) * numlogblk + (supfing - SUPFING); | nextsupfing = sizeof(long) + sizeof(long) * numlogblk + (supfing - SUPFING); | ||||
/* make sure the file ends at a logical block boundary. This is | |||||
necessary for invinsert to correctly create extended blocks | |||||
/* make sure the file ends at a logical block boundary. This is | |||||
necessary for invinsert to correctly create extended blocks | |||||
*/ | */ | ||||
i = nextsupfing % sizeof(t_logicalblk); | i = nextsupfing % sizeof(t_logicalblk); | ||||
/* write out junk to fill log blk */ | /* write out junk to fill log blk */ | ||||
@@ -329,7 +329,7 @@ invmake(char *invname, char *invpost, FILE *infile) | |||||
if (showzipf) { | if (showzipf) { | ||||
printf("\n************* ZIPF curve ****************\n"); | printf("\n************* ZIPF curve ****************\n"); | ||||
for (j = ZIPFSIZE; j > 1; j--) | for (j = ZIPFSIZE; j > 1; j--) | ||||
if (zipf[j]) | |||||
if (zipf[j]) | |||||
break; | break; | ||||
for (i = 1; i < j; ++i) { | for (i = 1; i < j; ++i) { | ||||
printf("%3d -%6d ", i, zipf[i]); | printf("%3d -%6d ", i, zipf[i]); | ||||
@@ -386,7 +386,7 @@ invnewterm(void) | |||||
} | } | ||||
supfing = i + SUPFING; | supfing = i + SUPFING; | ||||
#if DEBUG | #if DEBUG | ||||
printf("reallocated superfinger space to %d, totpost=%ld\n", | |||||
printf("reallocated superfinger space to %d, totpost=%ld\n", | |||||
supersize, totpost); | supersize, totpost); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -427,7 +427,7 @@ invnewterm(void) | |||||
} | } | ||||
logicalblk.invblk[0] = numinvitems; | logicalblk.invblk[0] = numinvitems; | ||||
/* set forward pointer pointing to next */ | /* set forward pointer pointing to next */ | ||||
logicalblk.invblk[1] = numlogblk + 1; | |||||
logicalblk.invblk[1] = numlogblk + 1; | |||||
/* set back pointer to last block */ | /* set back pointer to last block */ | ||||
logicalblk.invblk[2] = numlogblk - 1; | logicalblk.invblk[2] = numlogblk - 1; | ||||
if (fwrite(logicalblk.chrblk, 1, sizeof(t_logicalblk), outfile) == 0) { | if (fwrite(logicalblk.chrblk, 1, sizeof(t_logicalblk), outfile) == 0) { | ||||
@@ -440,7 +440,7 @@ invnewterm(void) | |||||
/* check if had to back up, if so do it */ | /* check if had to back up, if so do it */ | ||||
if (backupflag) { | if (backupflag) { | ||||
char *tptr2; | char *tptr2; | ||||
/* find out where the end of the new block is */ | /* find out where the end of the new block is */ | ||||
iteminfo.packword[0] = logicalblk.invblk[numinvitems*2+1]; | iteminfo.packword[0] = logicalblk.invblk[numinvitems*2+1]; | ||||
tptr3 = logicalblk.chrblk + iteminfo.e.offset; | tptr3 = logicalblk.chrblk + iteminfo.e.offset; | ||||
@@ -507,13 +507,13 @@ invnewterm(void) | |||||
return(1); | return(1); | ||||
} | } | ||||
/* | |||||
/* | |||||
* If 'invname' ends with the 'from' substring, it is replaced inline with the | * If 'invname' ends with the 'from' substring, it is replaced inline with the | ||||
* 'to' substring (which must be of the exact same length), and the function | * 'to' substring (which must be of the exact same length), and the function | ||||
* returns 0. Otherwise, returns -1. | |||||
* returns 0. Otherwise, returns -1. | |||||
*/ | */ | ||||
static int | |||||
static int | |||||
invflipname(char * invname, const char *from, const char *to) | invflipname(char * invname, const char *from, const char *to) | ||||
{ | { | ||||
char *temp, *i = NULL; | char *temp, *i = NULL; | ||||
@@ -540,9 +540,9 @@ open_for_reading(char *name, int stat) | |||||
/* handle opening of a file under a possibly "flipped" name */ | /* handle opening of a file under a possibly "flipped" name */ | ||||
/* If db created without '-f', but now invoked with '-f cscope.out', | /* If db created without '-f', but now invoked with '-f cscope.out', | ||||
* we need to check for 'cscope.in.out', rather than 'cscope.out.in': | |||||
* we need to check for 'cscope.in.out', rather than 'cscope.out.in': | |||||
* I.e, hack around our own violation of the inverse db naming convention */ | * I.e, hack around our own violation of the inverse db naming convention */ | ||||
/* more silliness: if you create the db with '-f cscope', then try to open | |||||
/* more silliness: if you create the db with '-f cscope', then try to open | |||||
* it without '-f cscope', you'll fail unless we check for 'cscope.out.in' | * it without '-f cscope', you'll fail unless we check for 'cscope.out.in' | ||||
* here. */ | * here. */ | ||||
static FILE * | static FILE * | ||||
@@ -708,31 +708,31 @@ static void | |||||
invstep(INVCONTROL *invcntl) | invstep(INVCONTROL *invcntl) | ||||
{ | { | ||||
if (invcntl->keypnt < (invcntl->logblk->invblk[0] - 1)) { | if (invcntl->keypnt < (invcntl->logblk->invblk[0] - 1)) { | ||||
invcntl->keypnt++; | |||||
invcntl->keypnt++; | |||||
return; | return; | ||||
} | } | ||||
/* move forward a block else wrap */ | /* move forward a block else wrap */ | ||||
invcntl->numblk = invcntl->logblk->invblk[1]; /* was: *(int *)(invcntl->logblk + sizeof(long))*/ | |||||
invcntl->numblk = invcntl->logblk->invblk[1]; /* was: *(int *)(invcntl->logblk + sizeof(long))*/ | |||||
/* now read in the block */ | /* now read in the block */ | ||||
fseek(invcntl->invfile, | fseek(invcntl->invfile, | ||||
invcntl->numblk*invcntl->param.sizeblk + invcntl->param.cntlsize, | invcntl->numblk*invcntl->param.sizeblk + invcntl->param.cntlsize, | ||||
SEEK_SET); | SEEK_SET); | ||||
fread(invcntl->logblk, (int) invcntl->param.sizeblk, 1, | fread(invcntl->logblk, (int) invcntl->param.sizeblk, 1, | ||||
invcntl->invfile); | |||||
invcntl->keypnt = 0; | |||||
invcntl->invfile); | |||||
invcntl->keypnt = 0; | |||||
} | } | ||||
/** invforward moves forward one term in the inverted file **/ | /** invforward moves forward one term in the inverted file **/ | ||||
int | int | ||||
invforward(INVCONTROL *invcntl) | invforward(INVCONTROL *invcntl) | ||||
{ | { | ||||
invstep(invcntl); | |||||
invstep(invcntl); | |||||
/* skip things with 0 postings */ | /* skip things with 0 postings */ | ||||
/* FIXME HBB: magic number alert! (3) */ | /* FIXME HBB: magic number alert! (3) */ | ||||
while (((ENTRY * )(invcntl->logblk->invblk + 3) + invcntl->keypnt)->post == 0) { | while (((ENTRY * )(invcntl->logblk->invblk + 3) + invcntl->keypnt)->post == 0) { | ||||
invstep(invcntl); | |||||
invstep(invcntl); | |||||
} | } | ||||
/* Check for having wrapped - reached start of inverted file! */ | /* Check for having wrapped - reached start of inverted file! */ | ||||
if ((invcntl->numblk == 0) && (invcntl->keypnt == 0)) | if ((invcntl->numblk == 0) && (invcntl->keypnt == 0)) | ||||
@@ -894,14 +894,14 @@ static int | |||||
boolready(void) | boolready(void) | ||||
{ | { | ||||
numitems = 0; | numitems = 0; | ||||
if (item1 != NULL) | |||||
if (item1 != NULL) | |||||
free(item1); | free(item1); | ||||
setsize1 = SETINC; | setsize1 = SETINC; | ||||
if ((item1 = malloc(SETINC * sizeof(*item1))) == NULL) { | if ((item1 = malloc(SETINC * sizeof(*item1))) == NULL) { | ||||
invcannotalloc(SETINC); | invcannotalloc(SETINC); | ||||
return(-1); | return(-1); | ||||
} | } | ||||
if (item2 != NULL) | |||||
if (item2 != NULL) | |||||
free(item2); | free(item2); | ||||
setsize2 = SETINC; | setsize2 = SETINC; | ||||
if ((item2 = malloc(SETINC * sizeof(*item2))) == NULL) { | if ((item2 = malloc(SETINC * sizeof(*item2))) == NULL) { | ||||
@@ -1155,7 +1155,7 @@ boolsave(int clear) /* flag about whether to clear core */ | |||||
POSTING *oldstuff, *newstuff; | POSTING *oldstuff, *newstuff; | ||||
if (numitems == 0) { | if (numitems == 0) { | ||||
if (clear) | |||||
if (clear) | |||||
boolclear(); | boolclear(); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,25 +27,25 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#ifndef CSCOPE_INVLIB_H | #ifndef CSCOPE_INVLIB_H | ||||
#define CSCOPE_INVLIB_H | #define CSCOPE_INVLIB_H | ||||
#include <stdio.h> /* need definition of FILE* */ | |||||
#include <stdio.h> /* need definition of FILE* */ | |||||
#include <limits.h> /* need definition of CHAR_MAX */ | #include <limits.h> /* need definition of CHAR_MAX */ | ||||
/* inverted index definitions */ | /* inverted index definitions */ | ||||
/* postings temporary file long number coding into characters */ | /* postings temporary file long number coding into characters */ | ||||
#if CHAR_MAX==255 | #if CHAR_MAX==255 | ||||
# define BASE 223 /* 255 - ' ' */ | |||||
# define PRECISION 4 /* maximum digits after converting a long */ | |||||
# define BASE 223 /* 255 - ' ' */ | |||||
# define PRECISION 4 /* maximum digits after converting a long */ | |||||
#else | #else | ||||
# if CHAR_MAX==127 /* assume sign-extension of a char when converted to an int */ | # if CHAR_MAX==127 /* assume sign-extension of a char when converted to an int */ | ||||
# define BASE 95 /* 127 - ' ' */ | |||||
# define PRECISION 5 /* maximum digits after converting a long */ | |||||
# define BASE 95 /* 127 - ' ' */ | |||||
# define PRECISION 5 /* maximum digits after converting a long */ | |||||
# else | # else | ||||
#error Need a platform with 8 bits in a char value | #error Need a platform with 8 bits in a char value | ||||
# endif | # endif | ||||
@@ -53,34 +53,34 @@ | |||||
/* inverted index access parameters */ | /* inverted index access parameters */ | ||||
#define INVAVAIL 0 | #define INVAVAIL 0 | ||||
#define INVBUSY 1 | |||||
#define INVBUSY 1 | |||||
#define INVALONE 2 | #define INVALONE 2 | ||||
/* boolean set operations */ | /* boolean set operations */ | ||||
#define BOOL_OR 3 | |||||
#define AND 4 | |||||
#define NOT 5 | |||||
#define REVERSENOT 6 | |||||
#define BOOL_OR 3 | |||||
#define AND 4 | |||||
#define NOT 5 | |||||
#define REVERSENOT 6 | |||||
/* note that the entire first block is for parameters */ | /* note that the entire first block is for parameters */ | ||||
typedef struct { | |||||
long version; /* inverted index format version */ | |||||
long filestat; /* file status word */ | |||||
long sizeblk; /* size of logical block in bytes */ | |||||
long startbyte; /* first byte of superfinger */ | |||||
long supsize; /* size of superfinger in bytes */ | |||||
long cntlsize; /* size of max cntl space (should be a multiple of BUFSIZ) */ | |||||
long share; /* flag whether to use shared memory */ | |||||
typedef struct { | |||||
long version; /* inverted index format version */ | |||||
long filestat; /* file status word */ | |||||
long sizeblk; /* size of logical block in bytes */ | |||||
long startbyte; /* first byte of superfinger */ | |||||
long supsize; /* size of superfinger in bytes */ | |||||
long cntlsize; /* size of max cntl space (should be a multiple of BUFSIZ) */ | |||||
long share; /* flag whether to use shared memory */ | |||||
} PARAM; | } PARAM; | ||||
typedef struct { | typedef struct { | ||||
FILE *invfile; /* the inverted file ptr */ | |||||
FILE *postfile; /* posting file ptr */ | |||||
PARAM param; /* control parameters for the file */ | |||||
char *iindex; /* ptr to space for superindex */ | |||||
union logicalblk *logblk; /* ptr to space for a logical block */ | |||||
long numblk; /* number of block presently at *logblk */ | |||||
long keypnt; /* number item in present block found */ | |||||
FILE *invfile; /* the inverted file ptr */ | |||||
FILE *postfile; /* posting file ptr */ | |||||
PARAM param; /* control parameters for the file */ | |||||
char *iindex; /* ptr to space for superindex */ | |||||
union logicalblk *logblk; /* ptr to space for a logical block */ | |||||
long numblk; /* number of block presently at *logblk */ | |||||
long keypnt; /* number item in present block found */ | |||||
} INVCONTROL; | } INVCONTROL; | ||||
typedef struct { | typedef struct { | ||||
@@ -91,14 +91,14 @@ typedef struct { | |||||
} ENTRY; | } ENTRY; | ||||
typedef struct { | typedef struct { | ||||
long lineoffset; /* source line database offset */ | |||||
long fcnoffset; /* function name database offset */ | |||||
long fileindex : 24; /* source file name index */ | |||||
long type : 8; /* reference type (mark character) */ | |||||
long lineoffset; /* source line database offset */ | |||||
long fcnoffset; /* function name database offset */ | |||||
long fileindex : 24; /* source file name index */ | |||||
long type : 8; /* reference type (mark character) */ | |||||
} POSTING; | } POSTING; | ||||
extern long *srcoffset; /* source file name database offsets */ | |||||
extern int nsrcoffset; /* number of file name database offsets */ | |||||
extern long *srcoffset; /* source file name database offsets */ | |||||
extern int nsrcoffset; /* number of file name database offsets */ | |||||
void boolclear(void); | void boolclear(void); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,13 +27,13 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#ifndef CSCOPE_LIBRARY_H | #ifndef CSCOPE_LIBRARY_H | ||||
#define CSCOPE_LIBRARY_H | #define CSCOPE_LIBRARY_H | ||||
#include <stdio.h> /* need FILE* type def. */ | |||||
#include <stdio.h> /* need FILE* type def. */ | |||||
/* private library */ | /* private library */ | ||||
char *compath(char *pathname); | char *compath(char *pathname); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* | /* | ||||
@@ -66,11 +66,11 @@ logdir(char *name) | |||||
char *p; | char *p; | ||||
int i, j; | int i, j; | ||||
int pwf; | int pwf; | ||||
/* attempt to open the password file */ | /* attempt to open the password file */ | ||||
if ((pwf = myopen("/etc/passwd", 0, 0)) == -1) | if ((pwf = myopen("/etc/passwd", 0, 0)) == -1) | ||||
return(0); | return(0); | ||||
/* find the matching password entry */ | /* find the matching password entry */ | ||||
do { | do { | ||||
/* get the next line in the password file */ | /* get the next line in the password file */ | ||||
@@ -87,13 +87,13 @@ logdir(char *name) | |||||
} while (*name != *line || /* fast pretest */ | } while (*name != *line || /* fast pretest */ | ||||
strcmp(name, line) != 0); | strcmp(name, line) != 0); | ||||
(void) close(pwf); | (void) close(pwf); | ||||
/* skip the intervening fields */ | /* skip the intervening fields */ | ||||
p = nextfield(p); | p = nextfield(p); | ||||
p = nextfield(p); | p = nextfield(p); | ||||
p = nextfield(p); | p = nextfield(p); | ||||
p = nextfield(p); | p = nextfield(p); | ||||
/* return the login directory */ | /* return the login directory */ | ||||
(void) nextfield(p); | (void) nextfield(p); | ||||
return(p); | return(p); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -84,7 +84,7 @@ struct keystruct keyword[] = { | |||||
{"unsigned", ' ', NULL}, | {"unsigned", ' ', NULL}, | ||||
{"void", ' ', NULL}, | {"void", ' ', NULL}, | ||||
{"while", '(', NULL}, | {"while", '(', NULL}, | ||||
/* these keywords are not compressed */ | /* these keywords are not compressed */ | ||||
{"do", '\0', NULL}, | {"do", '\0', NULL}, | ||||
{"auto", ' ', NULL}, | {"auto", ' ', NULL}, | ||||
@@ -106,7 +106,7 @@ initsymtab(void) | |||||
{ | { | ||||
unsigned int i, j; | unsigned int i, j; | ||||
struct keystruct *p; | struct keystruct *p; | ||||
for (i = 1; i < KEYWORDS; ++i) { | for (i = 1; i < KEYWORDS; ++i) { | ||||
p = keyword + i; | p = keyword + i; | ||||
j = hash(p->text) % HASHMOD; | j = hash(p->text) % HASHMOD; | ||||
@@ -122,7 +122,7 @@ lookup(char *ident) | |||||
{ | { | ||||
struct keystruct *p; | struct keystruct *p; | ||||
int c; | int c; | ||||
/* look up the identifier in the keyword table */ | /* look up the identifier in the keyword table */ | ||||
for (p = hashtab[hash(ident) % HASHMOD]; p != NULL; p = p->next) { | for (p = hashtab[hash(ident) % HASHMOD]; p != NULL; p = p->next) { | ||||
if (strequal(ident, p->text)) { | if (strequal(ident, p->text)) { | ||||
@@ -142,7 +142,7 @@ hash(char *ss) | |||||
{ | { | ||||
int i; | int i; | ||||
unsigned char *s = (unsigned char *)ss; | unsigned char *s = (unsigned char *)ss; | ||||
for (i = 0; *s != '\0'; ) | for (i = 0; *s != '\0'; ) | ||||
i += *s++; /* += is faster than <<= for cscope */ | i += *s++; /* += is faster than <<= for cscope */ | ||||
return(i); | return(i); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#ifndef CSCOPE_LOOKUP_H | #ifndef CSCOPE_LOOKUP_H | ||||
@@ -36,10 +36,10 @@ | |||||
/* declarations for objects defined in lookup.c */ | /* declarations for objects defined in lookup.c */ | ||||
/* keyword text for fast testing of keywords in the scanner */ | /* keyword text for fast testing of keywords in the scanner */ | ||||
extern char enumtext[]; | |||||
extern char externtext[]; | |||||
extern char structtext[]; | |||||
extern char typedeftext[]; | |||||
extern char uniontext[]; | |||||
extern char enumtext[]; | |||||
extern char externtext[]; | |||||
extern char structtext[]; | |||||
extern char typedeftext[]; | |||||
extern char uniontext[]; | |||||
#endif /* CSCOPE_LOOKUP_H */ | #endif /* CSCOPE_LOOKUP_H */ |
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -89,7 +89,7 @@ mouseinit(void) | |||||
/* see if this is emacsterm or viterm */ | /* see if this is emacsterm or viterm */ | ||||
term = mygetenv("TERM", ""); | term = mygetenv("TERM", ""); | ||||
if (strcmp(term, "emacsterm") == 0 || | |||||
if (strcmp(term, "emacsterm") == 0 || | |||||
strcmp(term, "viterm") == 0) { | strcmp(term, "viterm") == 0) { | ||||
emacsviterm = YES; | emacsviterm = YES; | ||||
mouse = YES; | mouse = YES; | ||||
@@ -101,7 +101,7 @@ mouseinit(void) | |||||
mouse = YES; | mouse = YES; | ||||
} | } | ||||
#if UNIXPC | #if UNIXPC | ||||
else if (strcmp(term,"s4") == 0 || | |||||
else if (strcmp(term,"s4") == 0 || | |||||
strcmp(term,"s120") == 0 || | strcmp(term,"s120") == 0 || | ||||
strcmp(term,"s90") == 0) { | strcmp(term,"s90") == 0) { | ||||
int retval; | int retval; | ||||
@@ -109,11 +109,11 @@ mouseinit(void) | |||||
struct umdata umd; /* Mouse data structure */ | struct umdata umd; /* Mouse data structure */ | ||||
/* Ask for character size info */ | /* Ask for character size info */ | ||||
retval = ioctl(1,WIOCGETD,&uwd); | retval = ioctl(1,WIOCGETD,&uwd); | ||||
if(retval || uwd.uw_hs <= 0 || uwd.uw_vs <= 0) { | if(retval || uwd.uw_hs <= 0 || uwd.uw_vs <= 0) { | ||||
/************************************************** | /************************************************** | ||||
* something wrong with the kernel, so fake it... | |||||
* something wrong with the kernel, so fake it... | |||||
**************************************************/ | **************************************************/ | ||||
if(!strcmp(term,"s4")) { | if(!strcmp(term,"s4")) { | ||||
uw_hs = 9; | uw_hs = 9; | ||||
@@ -129,7 +129,7 @@ mouseinit(void) | |||||
uw_hs = uwd.uw_hs; | uw_hs = uwd.uw_hs; | ||||
uw_vs = uwd.uw_vs; | uw_vs = uwd.uw_vs; | ||||
} | } | ||||
/************************************************** | /************************************************** | ||||
* Now turn on mouse reporting so we can actually | * Now turn on mouse reporting so we can actually | ||||
* make use of all this stuff. | * make use of all this stuff. | ||||
@@ -178,13 +178,13 @@ loadmenu(MENU *menu) | |||||
} | } | ||||
else { /* myx */ | else { /* myx */ | ||||
int len; | int len; | ||||
mousecleanup(); | mousecleanup(); | ||||
(void) printf("\033[6;1X\033[9;1X"); | (void) printf("\033[6;1X\033[9;1X"); | ||||
for (i = 0; menu[i].text != NULL; ++i) { | for (i = 0; menu[i].text != NULL; ++i) { | ||||
len = strlen(menu[i].text); | len = strlen(menu[i].text); | ||||
(void) printf("\033[%d;%dx%s%s", len, | (void) printf("\033[%d;%dx%s%s", len, | ||||
(int) (len + strlen(menu[i].value)), | |||||
(int) (len + strlen(menu[i].value)), | |||||
menu[i].text, menu[i].value); | menu[i].text, menu[i].value); | ||||
} | } | ||||
loaded = menu; | loaded = menu; | ||||
@@ -214,7 +214,7 @@ mousecleanup(void) | |||||
int i; | int i; | ||||
if (loaded != NULL) { /* only true for myx */ | if (loaded != NULL) { /* only true for myx */ | ||||
/* remove the mouse menu */ | /* remove the mouse menu */ | ||||
(void) printf("\033[6;0X\033[9;0X"); | (void) printf("\033[6;0X\033[9;0X"); | ||||
for (i = 0; loaded[i].text != NULL; ++i) { | for (i = 0; loaded[i].text != NULL; ++i) { | ||||
@@ -273,7 +273,7 @@ getmouseaction(char leading_char) | |||||
*/ | */ | ||||
int x = 0, y = 0, button = 0, reason = 0; | int x = 0, y = 0, button = 0, reason = 0; | ||||
int i; | int i; | ||||
/* Get a mouse report. The form is: XX;YY;B;RM where | /* Get a mouse report. The form is: XX;YY;B;RM where | ||||
* XX is 1,2, or 3 decimal digits with the X pixel position. | * XX is 1,2, or 3 decimal digits with the X pixel position. | ||||
* Similarly for YY. B is a single decimal digit with the | * Similarly for YY. B is a single decimal digit with the | ||||
@@ -286,13 +286,13 @@ getmouseaction(char leading_char) | |||||
* return the last character read to the input stream with | * return the last character read to the input stream with | ||||
* myungetch(). | * myungetch(). | ||||
*/ | */ | ||||
/* Check for "[?" being next 2 chars */ | /* Check for "[?" being next 2 chars */ | ||||
if(((i = mygetch()) != '[') || ((i = mygetch()) != '?')) { | if(((i = mygetch()) != '[') || ((i = mygetch()) != '?')) { | ||||
myungetch(i); | myungetch(i); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
/* Grab the X position (in pixels) */ | /* Grab the X position (in pixels) */ | ||||
while(isdigit(i = mygetch())) { | while(isdigit(i = mygetch())) { | ||||
x = (x*10) + (i - '0'); | x = (x*10) + (i - '0'); | ||||
@@ -301,7 +301,7 @@ getmouseaction(char leading_char) | |||||
myungetch(i); | myungetch(i); | ||||
return(NULL); /* not a mouse report after all */ | return(NULL); /* not a mouse report after all */ | ||||
} | } | ||||
/* Grab the Y position (in pixels) */ | /* Grab the Y position (in pixels) */ | ||||
while(isdigit(i = mygetch())) { | while(isdigit(i = mygetch())) { | ||||
y = (y*10) + (i - '0'); | y = (y*10) + (i - '0'); | ||||
@@ -310,7 +310,7 @@ getmouseaction(char leading_char) | |||||
myungetch(i); | myungetch(i); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
/* Get which button */ | /* Get which button */ | ||||
if((button = mygetch()) > '4') { | if((button = mygetch()) > '4') { | ||||
myungetch(button); | myungetch(button); | ||||
@@ -320,20 +320,20 @@ getmouseaction(char leading_char) | |||||
myungetch(i); | myungetch(i); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
/* Get the reason for this mouse report */ | /* Get the reason for this mouse report */ | ||||
if((reason = mygetch()) > '8') { | if((reason = mygetch()) > '8') { | ||||
myungetch(reason); | myungetch(reason); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
/* sequence should terminate with an 'M' */ | /* sequence should terminate with an 'M' */ | ||||
if((i = mygetch()) != 'M') { | if((i = mygetch()) != 'M') { | ||||
myungetch(i); | myungetch(i); | ||||
return(NULL); | return(NULL); | ||||
} | } | ||||
/* OK. We get a mouse report whenever a button is depressed | /* OK. We get a mouse report whenever a button is depressed | ||||
* or released. Let's ignore the report whenever the button | * or released. Let's ignore the report whenever the button | ||||
* is depressed until when I am ready to implement sweeping. | * is depressed until when I am ready to implement sweeping. | ||||
@@ -341,23 +341,23 @@ getmouseaction(char leading_char) | |||||
if(reason != '2') { | if(reason != '2') { | ||||
return(NULL); /* '2' means button is released */ | return(NULL); /* '2' means button is released */ | ||||
} | } | ||||
/************************************************************ | /************************************************************ | ||||
* Always indicate button 1 irregardless of which button was | * Always indicate button 1 irregardless of which button was | ||||
* really pushed. | * really pushed. | ||||
************************************************************/ | ************************************************************/ | ||||
m.button = 1; | m.button = 1; | ||||
/************************************************************ | /************************************************************ | ||||
* Convert pixel coordinates to line and column coords. | * Convert pixel coordinates to line and column coords. | ||||
* The height and width are obtained using an ioctl() call | * The height and width are obtained using an ioctl() call | ||||
* in mouseinit(). This assumes that variable width chars | * in mouseinit(). This assumes that variable width chars | ||||
* are not being used ('though it would probably work anyway). | * are not being used ('though it would probably work anyway). | ||||
************************************************************/ | ************************************************************/ | ||||
m.x1 = x/uw_hs; /* pixel/horizontal_spacing */ | m.x1 = x/uw_hs; /* pixel/horizontal_spacing */ | ||||
m.y1 = y/uw_vs; /* pixel/vertical_spacing */ | m.y1 = y/uw_vs; /* pixel/vertical_spacing */ | ||||
/* "null" out the other fields */ | /* "null" out the other fields */ | ||||
m.percent = m.x2 = m.y2 = -1; | m.percent = m.x2 = m.y2 = -1; | ||||
} | } | ||||
@@ -365,7 +365,7 @@ getmouseaction(char leading_char) | |||||
#endif /* not UNIXPC */ | #endif /* not UNIXPC */ | ||||
if (mouse == YES && leading_char == ctrl('X')) { | if (mouse == YES && leading_char == ctrl('X')) { | ||||
switch (mygetch()) { | switch (mygetch()) { | ||||
case ctrl('_'): /* click */ | case ctrl('_'): /* click */ | ||||
if ((m.button = mygetch()) == '0') { /* if scrollbar */ | if ((m.button = mygetch()) == '0') { /* if scrollbar */ | ||||
@@ -377,7 +377,7 @@ getmouseaction(char leading_char) | |||||
m.x2 = m.y2 = -1; | m.x2 = m.y2 = -1; | ||||
} | } | ||||
break; | break; | ||||
case ctrl(']'): /* sweep */ | case ctrl(']'): /* sweep */ | ||||
m.button = mygetch(); | m.button = mygetch(); | ||||
m.x1 = getcoordinate(); | m.x1 = getcoordinate(); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#include "library.h" | #include "library.h" | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#include <stdio.h> | #include <stdio.h> | ||||
@@ -74,7 +74,7 @@ myopen(char *path, int flag, int mode) | |||||
fd = open(path, flag); | fd = open(path, flag); | ||||
#ifdef __DJGPP__ /* FIXME: test feature, not platform */ | #ifdef __DJGPP__ /* FIXME: test feature, not platform */ | ||||
/* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it | |||||
/* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it | |||||
* always fails this call. Have to skip that step */ | * always fails this call. Have to skip that step */ | ||||
if(fd != -1) | if(fd != -1) | ||||
return(fd); | return(fd); | ||||
@@ -109,9 +109,9 @@ myfopen(char *path, char *mode) | |||||
SETMODE(fileno(fp), O_TEXT); | SETMODE(fileno(fp), O_TEXT); | ||||
} | } | ||||
#endif /* SETMODE */ | #endif /* SETMODE */ | ||||
#ifdef __DJGPP__ /* FIXME: test feature, not platform */ | #ifdef __DJGPP__ /* FIXME: test feature, not platform */ | ||||
/* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it | |||||
/* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it | |||||
* always fails this call. Have to skip that step */ | * always fails this call. Have to skip that step */ | ||||
if(fp) | if(fp) | ||||
#else | #else | ||||
@@ -178,7 +178,7 @@ mypopen(char *cmd, char *mode) | |||||
int | int | ||||
mypclose(FILE *ptr) | mypclose(FILE *ptr) | ||||
{ | { | ||||
#ifdef __DJGPP__ | |||||
#ifdef __DJGPP__ | |||||
/* HBB 20010705: This system has its own pclose(), which we | /* HBB 20010705: This system has its own pclose(), which we | ||||
* don't want to replace */ | * don't want to replace */ | ||||
return (pclose)(ptr); | return (pclose)(ptr); | ||||
@@ -1,9 +1,9 @@ | |||||
#include "global.h" | #include "global.h" | ||||
#include "build.h" | |||||
#include "build.h" | |||||
#include "vp.h" | #include "vp.h" | ||||
#include "version.h" /* FILEVERSION and FIXVERSION */ | #include "version.h" /* FILEVERSION and FIXVERSION */ | ||||
#include "scanner.h" | |||||
#include "scanner.h" | |||||
#include <stdlib.h> /* atoi */ | #include <stdlib.h> /* atoi */ | ||||
#include <getopt.h> | #include <getopt.h> | ||||
@@ -55,7 +55,7 @@ char ** parse_options(int *argc, char **argv) | |||||
cscope: pattern too long, cannot be > \ | cscope: pattern too long, cannot be > \ | ||||
%d characters\n", PATLEN); | %d characters\n", PATLEN); | ||||
} | } | ||||
strcpy(input_line, optarg); | |||||
strcpy(input_line, optarg); | |||||
break; | break; | ||||
case 'b': /* only build the cross-reference */ | case 'b': /* only build the cross-reference */ | ||||
buildonly = YES; | buildonly = YES; | ||||
@@ -150,7 +150,7 @@ char ** parse_options(int *argc, char **argv) | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* This adjusts argv so that we only see the remaining | |||||
* This adjusts argv so that we only see the remaining | |||||
* args. Its ugly, but we need to do it so that the rest | * args. Its ugly, but we need to do it so that the rest | ||||
* of the main routine doesn't get all confused | * of the main routine doesn't get all confused | ||||
*/ | */ | ||||
@@ -76,11 +76,11 @@ static int rebuild_reference(){ | |||||
if (errorsfound == YES) { | if (errorsfound == YES) { | ||||
errorsfound = NO; | errorsfound = NO; | ||||
askforreturn(); | askforreturn(); | ||||
} | |||||
} | |||||
entercurses(); | entercurses(); | ||||
clearmsg(); /* clear any previous message */ | clearmsg(); /* clear any previous message */ | ||||
totallines = 0; | totallines = 0; | ||||
disprefs = 0; | |||||
disprefs = 0; | |||||
topline = nextline = 1; | topline = nextline = 1; | ||||
return(YES); | return(YES); | ||||
} | } | ||||
@@ -95,7 +95,7 @@ static int process_mouse(){ | |||||
if (p->button == '0') { | if (p->button == '0') { | ||||
//scrollbar(p); // XXX | //scrollbar(p); // XXX | ||||
return(NO); | return(NO); | ||||
} | |||||
} | |||||
/* ignore a sweep */ | /* ignore a sweep */ | ||||
if (p->x2 >= 0) { | if (p->x2 >= 0) { | ||||
return(NO); | return(NO); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
Copyright (c) 2001, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
#ifndef CSCOPE_SCANNER_H | #ifndef CSCOPE_SCANNER_H | ||||
@@ -35,56 +35,56 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#undef YYLMAX | |||||
#define YYLMAX STMTMAX + PATLEN + 1 /* scanner line buffer size */ | |||||
#undef YYLMAX | |||||
#define YYLMAX STMTMAX + PATLEN + 1 /* scanner line buffer size */ | |||||
/* cross-reference database mark characters (when new ones are added, | |||||
/* cross-reference database mark characters (when new ones are added, | |||||
* update the cscope.out format description in cscope.1) | * update the cscope.out format description in cscope.1) | ||||
*/ | */ | ||||
#define CLASSDEF 'c' | #define CLASSDEF 'c' | ||||
#define DEFINE '#' | |||||
#define DEFINEEND ')' | |||||
#define ENUMDEF 'e' | |||||
#define FCNCALL '`' | |||||
#define FCNDEF '$' | |||||
#define FCNEND '}' | |||||
#define DEFINE '#' | |||||
#define DEFINEEND ')' | |||||
#define ENUMDEF 'e' | |||||
#define FCNCALL '`' | |||||
#define FCNDEF '$' | |||||
#define FCNEND '}' | |||||
#define GLOBALDEF 'g' | #define GLOBALDEF 'g' | ||||
#define INCLUDE '~' | |||||
#define INCLUDE '~' | |||||
#define MEMBERDEF 'm' | #define MEMBERDEF 'm' | ||||
#define NEWFILE '@' | |||||
#define NEWFILE '@' | |||||
#define STRUCTDEF 's' | #define STRUCTDEF 's' | ||||
#define TYPEDEF 't' | |||||
#define TYPEDEF 't' | |||||
#define UNIONDEF 'u' | #define UNIONDEF 'u' | ||||
/* other scanner token types */ | /* other scanner token types */ | ||||
#define LEXEOF 0 | |||||
#define LEXERR 1 | |||||
#define IDENT 2 | |||||
#define NEWLINE 3 | |||||
#define LEXEOF 0 | |||||
#define LEXERR 1 | |||||
#define IDENT 2 | |||||
#define NEWLINE 3 | |||||
/* scanner.l global data */ | /* scanner.l global data */ | ||||
extern int first; /* buffer index for first char of symbol */ | |||||
extern int last; /* buffer index for last char of symbol */ | |||||
extern int lineno; /* symbol line number */ | |||||
extern FILE *yyin; /* input file descriptor */ | |||||
extern FILE *yyout; /* output file */ | |||||
extern int myylineno; /* input line number */ | |||||
extern int first; /* buffer index for first char of symbol */ | |||||
extern int last; /* buffer index for last char of symbol */ | |||||
extern int lineno; /* symbol line number */ | |||||
extern FILE *yyin; /* input file descriptor */ | |||||
extern FILE *yyout; /* output file */ | |||||
extern int myylineno; /* input line number */ | |||||
#ifdef USING_LEX | #ifdef USING_LEX | ||||
/* HBB 20010430: if lex is used instead of flex, have to simulate the | /* HBB 20010430: if lex is used instead of flex, have to simulate the | ||||
* private copies of yytext and yytext for the world outside scanner.l: */ | * private copies of yytext and yytext for the world outside scanner.l: */ | ||||
/* FIXME: there should be a feature test for this! */ | /* FIXME: there should be a feature test for this! */ | ||||
#if defined(__OSF1__) || defined(__sun) || defined(_AIX) | #if defined(__OSF1__) || defined(__sun) || defined(_AIX) | ||||
extern char yytext[]; | |||||
extern char yytext[]; | |||||
#else | #else | ||||
extern unsigned char yytext[]; | |||||
extern unsigned char yytext[]; | |||||
#endif | #endif | ||||
extern int yyleng; | |||||
extern int yyleng; | |||||
# define my_yytext yytext | # define my_yytext yytext | ||||
# define my_yyleng yyleng | # define my_yyleng yyleng | ||||
#else | #else | ||||
extern char *my_yytext; /* private copy of input line */ | |||||
extern size_t my_yyleng; /* ... and current length of it */ | |||||
extern char *my_yytext; /* private copy of input line */ | |||||
extern size_t my_yyleng; /* ... and current length of it */ | |||||
#endif | #endif | ||||
/* The master function exported by scanner.l */ | /* The master function exported by scanner.l */ | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* cscope - interactive C symbol cross-reference | /* cscope - interactive C symbol cross-reference | ||||
@@ -39,7 +39,7 @@ | |||||
#ifndef CSCOPE_VERSION_H | #ifndef CSCOPE_VERSION_H | ||||
#define CSCOPE_VERSION_H | #define CSCOPE_VERSION_H | ||||
#define FILEVERSION 15 /* Initial Open Source and Linux Port */ | |||||
#define FIXVERSION ".9" /* feature and bug fix version */ | |||||
#define FILEVERSION 15 /* Initial Open Source and Linux Port */ | |||||
#define FIXVERSION ".9" /* feature and bug fix version */ | |||||
#endif /* CSCOPE_VERSION_H */ | #endif /* CSCOPE_VERSION_H */ |
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,41 +27,41 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* | /* | ||||
* VPATH assumptions: | * VPATH assumptions: | ||||
* VPATH is the environment variable containing the view path | |||||
* where each path name is followed by ':', '\n', or '\0'. | |||||
* Embedded blanks are considered part of the path. | |||||
* VPATH is the environment variable containing the view path | |||||
* where each path name is followed by ':', '\n', or '\0'. | |||||
* Embedded blanks are considered part of the path. | |||||
*/ | */ | ||||
#ifndef CSCOPE_VP_H | #ifndef CSCOPE_VP_H | ||||
#define CSCOPE_VP_H | #define CSCOPE_VP_H | ||||
#define MAXPATH 200 /* max length for entire name */ | |||||
#define MAXPATH 200 /* max length for entire name */ | |||||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | ||||
# include "config.h" | # include "config.h" | ||||
#else | #else | ||||
# define HAVE_FCNTL_H 1 /* in case of doubt, assume it's there */ | |||||
# define HAVE_FCNTL_H 1 /* in case of doubt, assume it's there */ | |||||
#endif | #endif | ||||
#ifdef HAVE_FCNTL_H | #ifdef HAVE_FCNTL_H | ||||
# include <fcntl.h> /* needed for O_... open flags */ | |||||
# include <fcntl.h> /* needed for O_... open flags */ | |||||
#endif | #endif | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#if !NOMALLOC | #if !NOMALLOC | ||||
extern char **vpdirs; /* directories (including current) in view path */ | |||||
extern char **vpdirs; /* directories (including current) in view path */ | |||||
#else | #else | ||||
#define MAXDIR 25 /* same as libVP */ | |||||
#define DIRLEN 80 /* same as libVP */ | |||||
extern char vpdirs[MAXDIR][DIRLEN + 1]; | |||||
#define MAXDIR 25 /* same as libVP */ | |||||
#define DIRLEN 80 /* same as libVP */ | |||||
extern char vpdirs[MAXDIR][DIRLEN + 1]; | |||||
#endif | #endif | ||||
extern int vpndirs; /* number of directories in view path */ | |||||
extern int vpndirs; /* number of directories in view path */ | |||||
void vpinit(char *current_dir); | void vpinit(char *current_dir); | ||||
int vpopen(char *path, int oflag); | int vpopen(char *path, int oflag); | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* vpaccess - view path version of the access system call */ | /* vpaccess - view path version of the access system call */ | ||||
@@ -36,7 +36,7 @@ | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "vp.h" | #include "vp.h" | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
int | int | ||||
vpaccess(char *path, mode_t amode) | vpaccess(char *path, mode_t amode) | ||||
{ | { | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* vpfopen - view path version of the fopen library function */ | /* vpfopen - view path version of the fopen library function */ | ||||
@@ -44,8 +44,8 @@ vpfopen(char *filename, char *type) | |||||
FILE *returncode; | FILE *returncode; | ||||
int i; | int i; | ||||
if ((returncode = myfopen(filename, type)) == NULL | |||||
&& filename[0] != '/' | |||||
if ((returncode = myfopen(filename, type)) == NULL | |||||
&& filename[0] != '/' | |||||
/* && strcmp(type, "r") == 0 */ /* HBB: this breaks if type=="rb" */ | /* && strcmp(type, "r") == 0 */ /* HBB: this breaks if type=="rb" */ | ||||
&& type[0] == 'r' | && type[0] == 'r' | ||||
) { | ) { | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||
/* vpinit - initialize vpdirs or update vpdirs based on currentdir */ | /* vpinit - initialize vpdirs or update vpdirs based on currentdir */ | ||||
@@ -62,7 +62,7 @@ vpinit(char *current_dir) | |||||
char *node; /* view path node */ | char *node; /* view path node */ | ||||
char vpathbuf[MAXVPATH + 1]; | char vpathbuf[MAXVPATH + 1]; | ||||
#endif | #endif | ||||
/* if an existing directory list is to be updated, free it */ | /* if an existing directory list is to be updated, free it */ | ||||
if (current_dir != NULL && vpndirs > 0) { | if (current_dir != NULL && vpndirs > 0) { | ||||
#if !NOMALLOC | #if !NOMALLOC | ||||
@@ -107,7 +107,7 @@ vpinit(char *current_dir) | |||||
/* don't change VPATH in the environment */ | /* don't change VPATH in the environment */ | ||||
vpath = strdup(vpath); | vpath = strdup(vpath); | ||||
/* split the view path into nodes */ | /* split the view path into nodes */ | ||||
for (i = 0, s = vpath; *s != '\0'; ++i) { | for (i = 0, s = vpath; *s != '\0'; ++i) { | ||||
vpdirs[i] = s; | vpdirs[i] = s; | ||||
@@ -136,10 +136,10 @@ vpinit(char *current_dir) | |||||
} | } | ||||
(void) strcpy(vpathbuf, vpath); | (void) strcpy(vpathbuf, vpath); | ||||
s = vpathbuf; | s = vpathbuf; | ||||
/* convert the view path nodes to directories */ | /* convert the view path nodes to directories */ | ||||
while (*s != '\0') { | while (*s != '\0') { | ||||
/* get the next node */ | /* get the next node */ | ||||
node = s; | node = s; | ||||
while (*s != '\0' && *++s != ':') { | while (*s != '\0' && *++s != ':') { | ||||
@@ -1,7 +1,7 @@ | |||||
/*=========================================================================== | /*=========================================================================== | ||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
Copyright (c) 1998-2000, The Santa Cruz Operation | |||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
@@ -14,7 +14,7 @@ | |||||
*Neither name of The Santa Cruz Operation nor the names of its contributors | *Neither name of The Santa Cruz Operation nor the names of its contributors | ||||
may be used to endorse or promote products derived from this software | may be used to endorse or promote products derived from this software | ||||
without specific prior written permission. | |||||
without specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS | ||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
@@ -27,7 +27,7 @@ | |||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
DAMAGE. | |||||
DAMAGE. | |||||
=========================================================================*/ | =========================================================================*/ | ||||