Browse Source

formatting cont.

Removes all leading whitespace
Converts the tabs in headers
emil
Emil 10 months ago
parent
commit
e672fc4f57
37 changed files with 651 additions and 652 deletions
  1. +5
    -5
      src/basename.c
  2. +28
    -29
      src/build.c
  3. +18
    -18
      src/build.h
  4. +10
    -10
      src/command.c
  5. +5
    -5
      src/compath.c
  6. +46
    -46
      src/constants.h
  7. +21
    -21
      src/crossref.c
  8. +32
    -32
      src/dir.c
  9. +9
    -9
      src/edit.c
  10. +11
    -11
      src/egrep.c
  11. +12
    -12
      src/egrep.y
  12. +14
    -14
      src/exec.c
  13. +70
    -70
      src/find.c
  14. +42
    -42
      src/fscanner.l
  15. +98
    -98
      src/global.h
  16. +1
    -1
      src/gscope.c
  17. +5
    -5
      src/help.c
  18. +6
    -6
      src/history.c
  19. +8
    -8
      src/input.c
  20. +24
    -24
      src/invlib.c
  21. +35
    -35
      src/invlib.h
  22. +5
    -5
      src/library.h
  23. +8
    -8
      src/logdir.c
  24. +8
    -8
      src/lookup.c
  25. +9
    -9
      src/lookup.h
  26. +27
    -27
      src/mouse.c
  27. +4
    -4
      src/mygetenv.c
  28. +8
    -8
      src/mypopen.c
  29. +4
    -4
      src/opt.c
  30. +3
    -3
      src/readline.c
  31. +31
    -31
      src/scanner.h
  32. +6
    -6
      src/version.h
  33. +15
    -15
      src/vp.h
  34. +5
    -5
      src/vpaccess.c
  35. +6
    -6
      src/vpfopen.c
  36. +8
    -8
      src/vpinit.c
  37. +4
    -4
      src/vpopen.c

+ 5
- 5
src/basename.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* get a file's base name from its path name */
@@ -38,7 +38,7 @@ char *
basename(char *path)
{
char *s;
if ((s = strrchr(path, '/')) != 0) {
return(s + 1);
}


+ 28
- 29
src/build.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/


@@ -102,7 +102,7 @@ cscope: cannot create inverted index; ignoring -q option\n");
invertedindex = NO;
errorsfound = YES;
fprintf(stderr, "\
cscope: removed files %s and %s\n",
cscope: removed files %s and %s\n",
newinvname, newinvpost);
unlink(newinvname);
unlink(newinvpost);
@@ -165,7 +165,7 @@ opendatabase(void)
myexit(1);
}
blocknumber = -1; /* force next seek to read the first block */
/* open any inverted index */
if (invertedindex == YES &&
invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) {
@@ -232,7 +232,7 @@ build(void)
/* or this is an unconditional build */
if ((oldrefs = vpfopen(reffile, "rb")) != NULL
&& 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, newdir) == 0)) {
/* 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;
}
/* 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 */
|| fscanf(oldrefs, "%lu", &oldnum) != 1
|| fscanf(oldrefs, "%lu", &oldnum) != 1
/* skip the string space size */
|| (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) {
goto outofdate;
@@ -320,7 +320,7 @@ cscope: -q option mismatch between command line and old symbol database\n");
}
fclose(oldrefs);
return;
outofdate:
/* if the database format has changed, rebuild it all */
if (fileversion != FILEVERSION) {
@@ -339,7 +339,7 @@ cscope: converting to new symbol database file format\n");
scanpast('\t'); /* skip the header */
oldfile = getoldfile();
} else { /* force cross-referencing of all the source files */
force:
force:
reftime = 0;
oldfile = NULL;
}
@@ -377,7 +377,7 @@ cscope: converting to new symbol database file format\n");

/* get the next source file name */
for (fileindex = firstfile; fileindex < lastfile; ++fileindex) {
/* display the progress about every three seconds */
if (interactive == YES && fileindex % 10 == 0) {
progress("Building symbol database", fileindex, lastfile);
@@ -396,14 +396,14 @@ cscope: converting to new symbol database file format\n");
/* if this file was modified */
crossref(file);
++built;
/* skip its old crossref so modifying the last source
* file does not cause all included files to be built.
* Unfortunately a new file that is alphabetically
* last will cause all included files to be build, but
* this is less likely */
oldfile = getoldfile();
} else {
} else {
/* copy its cross-reference */
putfilename(file);
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 */
putfilename("");
dbputc('\n');
/* get the file trailer offset */
traileroffset = dboffset;
/* output the source and include directory and file lists */
putlist(srcdirs, nsrcdirs);
putlist(incdirs, nincdirs);
@@ -474,7 +474,7 @@ cscope: converting to new symbol database file format\n");
rewind(newrefs);
putheader(newdir);
fclose(newrefs);
/* close the old database file */
if (symrefs >= 0) {
close(symrefs);
@@ -485,7 +485,7 @@ cscope: converting to new symbol database file format\n");
/* replace it with the new database file */
movefile(newreffile, reffile);
}

/* string comparison function for qsort */
static int
@@ -493,14 +493,14 @@ compare(const void *arg_s1, const void *arg_s2)
{
const char **s1 = (const char **) arg_s1;
const char **s2 = (const char **) arg_s2;
return(strcmp(*s1, *s2));
}


/* 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) {
postfatal("cscope: cannot read trailer offset from file %s\n", reffile);
@@ -541,7 +541,7 @@ void free_newbuildfiles(void)
free(newinvname);
free(newinvpost);
free(newreffile);
}
}


/* output the cscope version, current directory, database format options, and
@@ -555,7 +555,7 @@ putheader(char *dir)
}
if (invertedindex == YES) {
dboffset += fprintf(newrefs, " -q %.10ld", totalterms);
} else {
} else {
/* leave space so if the header is overwritten without -q
* because writing the inverted index failed, the header
* is the same length */
@@ -567,7 +567,7 @@ putheader(char *dir)

dboffset += fprintf(newrefs, " %.10ld\n", traileroffset);
#ifdef PRINTF_RETVAL_BROKEN
dboffset = ftell(newrefs);
dboffset = ftell(newrefs);
#endif
}

@@ -577,7 +577,7 @@ static void
putlist(char **names, int count)
{
int i, size = 0;
fprintf(newrefs, "%d\n", count);
if (names == srcfiles) {

@@ -613,7 +613,7 @@ copydata(void)
}
} while (*++cp == '\0' && (cp = read_block()) != NULL);
dbputc('\t'); /* copy the tab */
/* get the next character */
/* HBB 2010-08-21: potential problem if above loop was left
* with cp==NULL */
@@ -659,7 +659,7 @@ copyinverted(void)
}
} while (*++cp == '\0' && (cp = read_block()) != NULL);
dbputc('\n'); /* copy the newline */
/* get the next character */
/* HBB 2010-08-21: potential problem if above loop was left
* with cp==NULL */
@@ -735,4 +735,3 @@ fetch_include_from_dbase(char *s, size_t length)
fetch_string_from_dbase(s, length);
incfile(s + 1, s);
}


+ 18
- 18
src/build.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 2001, The Santa Cruz Operation
Copyright (c) 2001, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#ifndef CSCOPE_BUILD_H
#define CSCOPE_BUILD_H

#include "global.h" /* FIXME: temp. only */
#include "global.h" /* FIXME: temp. only */
#include "invlib.h"

/* types and macros of build.c to be used by other modules */

/* 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 */

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 */



+ 10
- 10
src/command.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol or text cross-reference
@@ -119,7 +119,7 @@ static void
mark(unsigned int i)
{
unsigned int j;
j = i + topline - 1;
if (j < totallines) {
move(displine[i], 1);
@@ -144,13 +144,13 @@ scrollbar(MOUSE *p)
return;
}
switch (p->percent) {
case 101: /* scroll down one page */
if (nextline + mdisprefs > totallines) {
nextline = totallines - mdisprefs + 1;
}
break;
case 102: /* scroll up one page */
nextline = topline - mdisprefs;
if (nextline < 1) {
@@ -161,7 +161,7 @@ scrollbar(MOUSE *p)
case 103: /* scroll down one line */
nextline = topline + 1;
break;
case 104: /* scroll up one line */
if (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,
* since it's not used. But it has to be assigned just so the return value
* 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]",
file, function, linenum, tempstring
)
@@ -230,7 +230,7 @@ countrefs(void)
rewind(refsfound);

/* restrict the width of displayed columns */
/* HBB FIXME 20060419: magic number alert! */
/* HBB FIXME 20060419: magic number alert! */
i = (COLS - 5) / 3;
if (ogs == YES) {
i = (COLS - 7) / 5;


+ 5
- 5
src/compath.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/*
@@ -163,7 +163,7 @@ compath(char *pathname) /*FDEF*/

sofar = nextchar - 1;
while ((*nextchar++ = *lastchar++) != '\0');
lastchar = sofar;

/*


+ 46
- 46
src/constants.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -38,43 +38,43 @@
#ifndef 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) */
#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 */
#define setmark(c) (blockmark = c, block[blocklen] = blockmark)
#define setmark(c) (blockmark = c, block[blocklen] = blockmark)

/* get the next character in the cross-reference */
/* 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 */
/* note that blockp is assumed not to be null and that
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
# define ESC '\033' /* escape character */
# define ESC '\033' /* escape character */
#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 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 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 STRINGIZE(x) STR2(x)
@@ -84,32 +84,32 @@
#define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)

/* 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) */
#define SYMBOL 0
#define SYMBOL 0
#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 INCLUDES 8
#define FIELDS 10
#define FIELDS 10

/* file open modes */
#ifndef R_OK
# define READ R_OK
# define READ R_OK
#else
# define READ 4
# define READ 4
#endif
#ifdef W_OK
# define WRITE W_OK
# define WRITE W_OK
#else
# define WRITE 2
# define WRITE 2
#endif

#define O_TEXT 0x00
@@ -159,7 +159,7 @@

/**/
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__
# define TERMINFO 0 /* no terminfo curses */
# define TERMINFO 0 /* no terminfo curses */
#else
# define TERMINFO 1
#endif
@@ -167,25 +167,25 @@

#if !TERMINFO
# 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
# ifndef KEY_ENTER
# define KEY_ENTER 0401
# define KEY_ENTER 0401
# endif
# ifndef KEY_BACKSPACE
# define KEY_BACKSPACE 0402
# define KEY_BACKSPACE 0402
# endif

# if !sun
# define cbreak() crmode() /* name change */
# define cbreak() crmode() /* name change */
# endif

# 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
# 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 !TERMINFO */



+ 21
- 21
src/crossref.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/


@@ -103,7 +103,7 @@ crossref(char *srcfile)
errorsfound = YES;
return;
}
entry_no = 0;
/* open the source file */
if ((yyin = myfopen(srcfile, "r")) == NULL) {
@@ -124,7 +124,7 @@ crossref(char *srcfile)
symbol = malloc(msymbols * sizeof(*symbol));
}
for (;;) {
/* get the next token */
switch (token = yylex()) {
default:
@@ -149,7 +149,7 @@ crossref(char *srcfile)
if (length == symbol[i].length
&& strncmp(my_yytext + first,
my_yytext + symbol[i].first,
length) == 0
length) == 0
&& entry_no == symbol[i].fcn_level
&& token == symbol[i].type
) { /* could be a::a() */
@@ -175,10 +175,10 @@ crossref(char *srcfile)
my_yyleng = 0;
#endif
break;
case LEXERR: /* Lexer error, abort further parsing of this file */
case LEXEOF: /* end of file; last line may not have \n */
/* if there were symbols, output them and the source line */
if (symbols > 0) {
putcrossref();
@@ -253,7 +253,7 @@ putcrossref(void)

blank = NO;
for (i = 0; i < my_yyleng; ++i) {
/* change a tab to a blank and compress blanks */
if ((c = my_yytext[i]) == ' ' || c == '\t') {
blank = YES;
@@ -266,7 +266,7 @@ putcrossref(void)
dbputc(' ');
}
dbputc('\n'); /* symbols start on a new line */
/* output any symbol type */
if ((type = symbol[symput].type) != IDENT) {
dbputc('\t');
@@ -287,7 +287,7 @@ putcrossref(void)
i = j - 1;
++symput;
} 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 */
if (compress == NO) {
if (blank == YES) {
@@ -323,11 +323,11 @@ putcrossref(void)
}
dbputc((int) c);
blank = NO;
/* skip compressed characters */
if (c < ' ') {
++i;
/* skip blanks before a preprocesor keyword */
/* note: don't use isspace() because \f and \v
are used for keywords */
@@ -436,10 +436,10 @@ putposting(char *term, int type)
do {
(void) putc(*s, postings);
} while (*++s != '\0');
/* postings are also sorted by type */
(void) putc(type, postings);
/* function or macro name offset */
if (offset > 0) {
(void) putc(' ', postings);
@@ -462,12 +462,12 @@ writestring(char *s)
{
unsigned char c;
int i;
if (compress == NO) {
/* Save some I/O overhead by using puts() instead of putc(): */
dbfputs(s);
return;
}
}
/* compress digraphs */
for (i = 0; (c = s[i]) != '\0'; ++i) {
if (/* dicode1[c] && dicode2[(unsigned char) s[i + 1]] */
@@ -476,7 +476,7 @@ writestring(char *s)
c = DICODE_COMPRESS(c, s[i + 1]);
++i;
}
dbputc(c);
dbputc(c);
}
}

@@ -485,8 +485,8 @@ writestring(char *s)
void
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);
errorsfound = YES;
}

+ 32
- 32
src/dir.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/


@@ -125,7 +125,7 @@ sourcedir(char *dirlist)

makevpsrcdirs(); /* make the view source directory list */
dirlist = strdup(dirlist); /* don't change environment variable text */
/* parse the directory list */
dir = strtok(dirlist, DIRSEPS);
while (dir != NULL) {
@@ -133,10 +133,10 @@ sourcedir(char *dirlist)

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 */
if (*dirlist != '/' && vpndirs > 1) {
/* compute its path from higher view path source dirs */
for (i = 1; i < nvpsrcdirs; ++i) {
snprintf(path, sizeof(path), "%.*s/%s",
@@ -158,7 +158,7 @@ addsrcdir(char *dir)
struct stat statstruct;

/* make sure it is a directory */
if (lstat(compath(dir), &statstruct) == 0 &&
if (lstat(compath(dir), &statstruct) == 0 &&
S_ISDIR(statstruct.st_mode)) {

/* note: there already is a source directory list */
@@ -193,7 +193,7 @@ includedir(char *dirlist)

makevpsrcdirs(); /* make the view source directory list */
dirlist = strdup(dirlist); /* don't change environment variable text */
/* parse the directory list */
dir = strtok(dirlist, DIRSEPS);
while (dir != NULL) {
@@ -201,13 +201,13 @@ includedir(char *dirlist)

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 */
if (*dirlist != '/' && vpndirs > 1) {
/* compute its path from higher view path source dirs */
for (i = 1; i < nvpsrcdirs; ++i) {
snprintf(path, sizeof(path), "%.*s/%s",
snprintf(path, sizeof(path), "%.*s/%s",
(int)(PATHLEN - 2 - dir_len),
srcdirs[i], dir);
addincdir(dir, path);
@@ -226,7 +226,7 @@ addincdir(char *name, char *path)
struct stat statstruct;

/* make sure it is a directory */
if (lstat(compath(path), &statstruct) == 0 &&
if (lstat(compath(path), &statstruct) == 0 &&
S_ISDIR(statstruct.st_mode)) {
if (incdirs == NULL) {
incdirs = malloc(mincdirs * sizeof(*incdirs));
@@ -247,7 +247,7 @@ addincdir(char *name, char *path)
void
freeinclist()
{
if (!incdirs)
if (!incdirs)
return;
while(nincdirs>0) {
free(incdirs[--nincdirs]);
@@ -275,7 +275,7 @@ makefilelist(void)

/* if -i was NOT given and there are source file arguments */
if (namefile == NULL && fileargc > 0) {
/* put them in a list that can be expanded */
for (i = 0; i < fileargc; ++i) {
file = fileargv[i];
@@ -325,24 +325,24 @@ makefilelist(void)
/* Kill away \n left at end of fgets()'d string: */
if (*point_in_line == '\n')
*point_in_line = '\0';
/* Parse whitespace-terminated strings in line: */
point_in_line = line;
while (sscanf(point_in_line, "%" PATHLEN_STR "s", path) == 1) {
/* Have to store this length --- inviewpath() will
* modify path, later! */
length_of_name = strlen(path);
if (*path == '-') { /* if an option */
if (unfinished_option) {
/* Can't have another option directly after an
* -I or -p option with no name after it! */
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);
unfinished_option = 0;
}
i = path[1];
switch (i) {
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" */
if (*s == '\0') { /* if "-I path" */
unfinished_option = i;
break;
}
break;
}

/* this code block used several times in here
* --> 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)
break;
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);
} /* switch(i) */
} /* if('-') */
@@ -424,7 +424,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
} else {
newpath[out++] = point_in_line[in++];
}
} /* while(in) */
} /* while(in) */
if (in >= PATHLEN) { /* safeguard against almost-overflow */
newpath[out]='\0';
}
@@ -489,7 +489,7 @@ scan_dir(const char *adir, BOOL recurse_dir)
struct dirent *entry;
char path[PATHLEN + 1];

while ((entry = readdir(dirfile)) != NULL) {
while ((entry = readdir(dirfile)) != NULL) {
if ((strcmp(".",entry->d_name) != 0)
&& (strcmp("..",entry->d_name) != 0)) {
struct stat buf;
@@ -499,7 +499,7 @@ scan_dir(const char *adir, BOOL recurse_dir)
entry->d_name);

if (lstat(path,&buf) == 0) {
if (recurse_dir
if (recurse_dir
&& S_ISDIR(buf.st_mode) ) {
scan_dir(path, recurse_dir);
} else if (issrcfile(path)
@@ -552,13 +552,13 @@ issrcfile(char *path)
}
} else if ((s[2] == '\0') /* 2 char suffix */
&& ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */
|| (s[0] == 'q'
|| (s[0] == 'q'
&& (s[1] == 'c' || s[1] == 'h')) /* Ingres */
|| (s[0] == 's' && s[1] == 'd') /* SDL */
|| (s[0] == 'c' && s[1] == 'c') /* C++ source */
|| (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */
looks_like_source = YES;
} else if((s[3] == '\0') /* 3 char suffix */
/* C++ template source */
&& ((s[0] == 't' && s[1] == 'c' && s[2] == 'c' )
@@ -573,9 +573,9 @@ issrcfile(char *path)

if (looks_like_source != YES)
return NO;
/* make sure it is a file */
if (lstat(path, &statstruct) == 0 &&
if (lstat(path, &statstruct) == 0 &&
S_ISREG(statstruct.st_mode)) {
return(YES);
}
@@ -695,7 +695,7 @@ addsrcfile(char *path)
{
struct listitem *p;
int i;
/* make sure there is room for the file */
if (nsrcfiles == msrcfiles) {
msrcfiles += SRCINC;
@@ -718,7 +718,7 @@ freefilelist(void)
struct listitem *p, *nextp;
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) {
while (nsrcfiles > 0) {
free (srcfiles[--nsrcfiles]);
@@ -734,7 +734,7 @@ freefilelist(void)
free (srcfiles); /* HBB 20000421: avoid leak */
msrcfiles = 0;
srcfiles=0;
for (i = 0; i < HASHMOD; ++i) {
for (p = srcnames[i]; p != NULL; p = nextp) {
/* HBB 20000421: avoid memory leak */


+ 9
- 9
src/edit.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -56,7 +56,7 @@ editref(int i)
}
/* get the selected line */
seekline(i + topline);
/* get the file name and line number */
if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file, linenum) == 2) {
edit(file, linenum); /* edit it */
@@ -79,7 +79,7 @@ editall(void)
}
/* get the first line */
seekline(1);
/* get each file name and line number */
while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) {
edit(file, linenum); /* edit it */
@@ -92,7 +92,7 @@ editall(void)
}
seekline(topline);
}
/* call the editor */

void
@@ -108,7 +108,7 @@ edit(char *file, char *linenum)
(void) snprintf(plusnum, sizeof(plusnum), lineflag, linenum);
/* if this is the more or page commands */
if (strcmp(s = basename(editor), "more") == 0 || strcmp(s, "page") == 0) {
/* get it to pause after displaying a file smaller than the screen
length */
(void) execute(editor, editor, plusnum, file, "/dev/null", NULL);
@@ -128,7 +128,7 @@ char *
filepath(char *file)
{
static char path[PATHLEN + 1];
if (prependpath != NULL && *file != '/') {
(void) snprintf(path, sizeof(path), "%s/%s", prependpath, file);
file = path;


+ 11
- 11
src/egrep.c View File

@@ -70,9 +70,9 @@
#line 1 "src/egrep.y"

/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/*
@@ -1565,7 +1565,7 @@ yylex(void)
return (DOT);
case '\0':
return (0);
case '[':
case '[':
x = CCL;
cclcnt = 0;
count = nxtchar++;
@@ -1679,12 +1679,12 @@ cfoll(int v)

if (left[v] == 0) {
count = 0;
for (i = 1; i <= line; i++)
for (i = 1; i <= line; i++)
tmpstat[i] = 0;
follow(v);
add(foll, v);
} else if (right[v] == 0)
cfoll(left[v]);
cfoll(left[v]);
else {
cfoll(left[v]);
cfoll(right[v]);
@@ -1877,7 +1877,7 @@ follow(unsigned int v)
{
unsigned int p;

if (v == line)
if (v == line)
return;
p = parent[v];
switch(name[p]) {
@@ -1896,7 +1896,7 @@ follow(unsigned int v)
follow(p);
return;
}
} else
} else
follow(p);
return;
case FINAL:
@@ -1968,7 +1968,7 @@ egrep(char *file, FILE *output, char *format)
int in_line;
FILE *fptr;

if ((fptr = myfopen(file, "r")) == NULL)
if ((fptr = myfopen(file, "r")) == NULL)
return(-1);

lnum = 1;
@@ -2037,7 +2037,7 @@ egrep(char *file, FILE *output, char *format)
brk2:
if (--ccount <= 0) {
ccount = read_next_chunk(&p, fptr);
if (ccount <= 0)
if (ccount <= 0)
break;
}
in_line = 1;


+ 12
- 12
src/egrep.y View File

@@ -1,8 +1,8 @@
%{
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/*
@@ -140,7 +140,7 @@ r: r OR r
{ $$ = unary(QUEST, $1); }
| '(' r ')'
{ $$ = $2; }
| error
| error
;

%%
@@ -175,7 +175,7 @@ yylex(void)
return (DOT);
case '\0':
return (0);
case '[':
case '[':
x = CCL;
cclcnt = 0;
count = nxtchar++;
@@ -289,12 +289,12 @@ cfoll(int v)

if (left[v] == 0) {
count = 0;
for (i = 1; i <= line; i++)
for (i = 1; i <= line; i++)
tmpstat[i] = 0;
follow(v);
add(foll, v);
} else if (right[v] == 0)
cfoll(left[v]);
cfoll(left[v]);
else {
cfoll(left[v]);
cfoll(right[v]);
@@ -487,7 +487,7 @@ follow(unsigned int v)
{
unsigned int p;

if (v == line)
if (v == line)
return;
p = parent[v];
switch(name[p]) {
@@ -506,7 +506,7 @@ follow(unsigned int v)
follow(p);
return;
}
} else
} else
follow(p);
return;
case FINAL:
@@ -578,7 +578,7 @@ egrep(char *file, FILE *output, char *format)
int in_line;
FILE *fptr;

if ((fptr = myfopen(file, "r")) == NULL)
if ((fptr = myfopen(file, "r")) == NULL)
return(-1);

lnum = 1;
@@ -647,7 +647,7 @@ egrep(char *file, FILE *output, char *format)
brk2:
if (--ccount <= 0) {
ccount = read_next_chunk(&p, fptr);
if (ccount <= 0)
if (ccount <= 0)
break;
}
in_line = 1;


+ 14
- 14
src/exec.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -91,10 +91,10 @@ execute(char *a, ...) /* note: "exec" is already defined on u370 */
exitcode = join(p); /* parent */
}
#endif /* MSDOS */
/* the menu and scrollbar may be changed by the command executed */
#if UNIXPC || !TERMINFO
# ifndef __DJGPP__ /* leave CRLF handling as is */
# ifndef __DJGPP__ /* leave CRLF handling as is */
nonl();
# endif
raw(); /* endwin() turns off cbreak mode so restore it */
@@ -115,7 +115,7 @@ static int
myexecvp(char *a, char **args)
{
char msg[MSGLEN + 1];
/* modify argv[0] to reference the last component of its path name */
args[0] = basename(args[0]);

@@ -137,14 +137,14 @@ myfork(void)
pid_t p; /* process number */

p = fork();
/* the parent ignores the interrupt, quit, and hangup signals */
if (p > 0) {
oldsigquit = signal(SIGQUIT, SIG_IGN);
oldsighup = signal(SIGHUP, SIG_IGN);
#ifdef SIGTSTP
#ifdef SIGTSTP
oldsigtstp = signal(SIGTSTP, SIG_DFL);
#endif
#endif
}
/* so they can be used to stop the child */
else if (p == 0) {
@@ -153,7 +153,7 @@ myfork(void)
signal(SIGHUP, SIG_DFL);
#ifdef SIGTSTP
signal(SIGTSTP, SIG_DFL);
#endif
#endif
}
/* check for fork failure */
if (p == -1) {
@@ -165,9 +165,9 @@ myfork(void)
/* join is the compliment of fork */

static int
join(pid_t p)
join(pid_t p)
{
int status = -1;
int status = -1;
pid_t w;

/* wait for the correct child to exit */
@@ -180,7 +180,7 @@ join(pid_t p)
signal(SIGHUP, oldsighup);
#ifdef SIGTSTP
signal(SIGTSTP, oldsigtstp);
#endif
#endif

/* return the child's exit code */
return(status >> 8);


+ 70
- 70
src/find.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol or text cross-reference
@@ -49,7 +49,7 @@
#include <regex.h>

/* 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.
* 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
@@ -101,7 +101,7 @@ findassign(char *pattern)
/* Test reference whether it's an assignment to the symbol found at
* (global variable) 'blockp' */
static BOOL
check_for_assignment(void)
check_for_assignment(void)
{
/* Do the extra work here to determine if this is an
* assignment or not. Do this by examining the next character
@@ -123,21 +123,21 @@ check_for_assignment(void)
return YES;
}
/* 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] != '=')))) {
return YES;
}

/* 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[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 >>= ? */
if ( ( (asgn_char[0] == '<')
if ( ( (asgn_char[0] == '<')
|| (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));
strcpy(function, global); /* set the dummy global function name */
strcpy(macro, global); /* set the dummy global macro name */
/* find the next symbol */
/* note: this code was expanded in-line for speed */
/* 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 */
skiprefchar();
fetch_string_from_dbase(file, sizeof(file));
/* check for the end of the symbols */
if (*file == '\0') {
return NULL;
}
progress("Search", searchcount, nsrcfiles);
/* FALLTHROUGH */
case FCNEND: /* function end */
(void) strcpy(function, global);
goto notmatched; /* don't match name */
case FCNDEF: /* function name */
fcndef = YES;
s = function;
s = function;
s_len = sizeof(function);
break;

@@ -242,7 +242,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
if (fileversion >= 10) {
s = macro;
s_len = sizeof(macro);
} else {
} else {
s = symbol;
s_len = sizeof(symbol);
}
@@ -254,7 +254,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)

case INCLUDE: /* #include file */
goto notmatched; /* don't match name */
default: /* other symbol */
s = 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);

/* see if this is a regular expression pattern */
if (isregexp_valid == YES) {
if (isregexp_valid == YES) {
if (caseless == YES) {
s = lcasify(s);
}
if (*s != '\0' && regexec (&regexp, s, (size_t)0, NULL, 0) == 0) {
if (*s != '\0' && regexec (&regexp, s, (size_t)0, NULL, 0) == 0) {
goto matched;
}
}
@@ -280,9 +280,9 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
}
/* if this is a regular expression pattern */
if (isregexp_valid == YES) {
/* if this is a symbol */
/**************************************************
* The first character may be a digraph'ed char, so
* unpack it into firstchar, and then test that.
@@ -296,7 +296,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
else {
firstchar = *cp;
}
if (isalpha((unsigned char)firstchar) || firstchar == '_') {
blockp = cp;
fetch_string_from_dbase(symbol, sizeof(symbol));
@@ -306,7 +306,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
else {
s = symbol;
}
/* match the symbol to the regular expression */
if (*s != '\0' && regexec (&regexp, s, (size_t)0, NULL, 0) == 0) {
goto matched;
@@ -386,7 +386,7 @@ finddef(char *pattern)
/* find the next file name or definition */
while (scanpast('\t') != NULL) {
switch (*blockp) {
case NEWFILE:
skiprefchar(); /* save file name */
fetch_string_from_dbase(file, sizeof(file));
@@ -407,14 +407,14 @@ finddef(char *pattern)
case GLOBALDEF: /* other global definition */
skiprefchar(); /* match name to pattern */
if (match()) {
/* output the file, function and source line */
putref(0, file, pattern);
}
break;
}
}
return NULL;
}
/* find all function definitions (used by samuel only) */
@@ -430,7 +430,7 @@ findallfcns(char *dummy)
/* find the next file name or definition */
while (scanpast('\t') != NULL) {
switch (*blockp) {
case NEWFILE:
skiprefchar(); /* save file name */
fetch_string_from_dbase(file, sizeof(file));
@@ -439,7 +439,7 @@ findallfcns(char *dummy)
}
progress("Search", searchcount, nsrcfiles);
/* FALLTHROUGH */
case FCNEND: /* function end */
(void) strcpy(function, global);
break;
@@ -471,7 +471,7 @@ findcalling(char *pattern)

if (invertedindex == YES) {
POSTING *p;
findterm(pattern);
while ((p = getposting()) != NULL) {
if (p->type == FCNCALL) {
@@ -487,7 +487,7 @@ findcalling(char *pattern)
for (i = 0; i < 10; i++) *(tmpfunc[i]) = '\0';
while (scanpast('\t') != NULL) {
switch (*blockp) {
case NEWFILE: /* save file name */
skiprefchar();
fetch_string_from_dbase(file, sizeof(file));
@@ -497,7 +497,7 @@ findcalling(char *pattern)
progress("Search", searchcount, nsrcfiles);
(void) strcpy(function, global);
break;
case DEFINE: /* could be a macro */
if (fileversion >= 10) {
skiprefchar();
@@ -520,7 +520,7 @@ findcalling(char *pattern)
if (++morefuns >= 10) morefuns = 9;
}
break;
case FCNEND:
for (i = 0; i < morefuns; i++)
*(tmpfunc[i]) = '\0';
@@ -530,7 +530,7 @@ findcalling(char *pattern)
case FCNCALL: /* match function called to pattern */
skiprefchar();
if (match()) {
/* output the file, calling function or macro, and source */
if (*macro != '\0') {
putref(1, file, macro);
@@ -545,7 +545,7 @@ findcalling(char *pattern)
}
}
}
return NULL;
}

@@ -566,7 +566,7 @@ findstring(char *pattern)
*cp++ = *pp;
}
*cp = '\0';
/* search the source files */
return(findregexp(egreppat));
}
@@ -601,7 +601,7 @@ char *
findfile(char *dummy)
{
unsigned int i;
(void) dummy; /* unused argument */

for (i = 0; i < nsrcfiles; ++i) {
@@ -613,7 +613,7 @@ findfile(char *dummy)
s = srcfiles[i];
}
if (regexec (&regexp, 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]);
}
}
@@ -643,7 +643,7 @@ findinclude(char *pattern)
/* find the next file name or function definition */
while (scanpast('\t') != NULL) {
switch (*blockp) {
case NEWFILE: /* save file name */
skiprefchar();
fetch_string_from_dbase(file, sizeof(file));
@@ -652,18 +652,18 @@ findinclude(char *pattern)
}
progress("Search", searchcount, nsrcfiles);
break;
case INCLUDE: /* match function called to pattern */
skiprefchar();
skiprefchar(); /* skip global or local #include marker */
if (match()) {
/* output the file and source line */
putref(0, file, global);
}
}
}
return NULL;
}

@@ -685,7 +685,7 @@ findinit(char *pattern)
isregexp_valid = NO;

/* remove trailing white space */
for (s = pattern + strlen(pattern) - 1;
for (s = pattern + strlen(pattern) - 1;
isspace((unsigned char)*s);
--s) {
*s = '\0';
@@ -700,7 +700,7 @@ findinit(char *pattern)

/* allow a partial match for a file name */
if (field == FILENAME || field == INCLUDES) {
if (regcomp (&regexp, pattern, REG_EXTENDED | REG_NOSUB) != 0) {
if (regcomp (&regexp, pattern, REG_EXTENDED | REG_NOSUB) != 0) {
return(REGCMPERROR);
} else {
isregexp_valid = YES;
@@ -818,7 +818,7 @@ static BOOL
matchrest(void)
{
int i = 1;
skiprefchar();
do {
while (*blockp == cpattern[i]) {
@@ -826,7 +826,7 @@ matchrest(void)
++i;
}
} while (*(blockp + 1) == '\0' && read_block() != NULL);
if (*blockp == '\n' && cpattern[i] == '\0') {
return(YES);
}
@@ -858,7 +858,7 @@ putsource(int seemore, FILE *output)
char *tmpblockp;
char *cp, nextc = '\0';
BOOL Change = NO, retreat = NO;
if (fileversion <= 5) {
(void) scanpast(' ');
putline(output);
@@ -877,7 +877,7 @@ putsource(int seemore, FILE *output)
}
}
blockp = cp;
if (*blockp != '\n' || getrefchar() != '\n' ||
if (*blockp != '\n' || getrefchar() != '\n' ||
(!isdigit(getrefchar()) && fileversion >= 12)) {
postfatal("Internal error: cannot get source line from database");
/* NOTREACHED */
@@ -913,12 +913,12 @@ putline(FILE *output)
{
char *cp;
unsigned c;
setmark('\n');
cp = blockp;
do {
while ((c = (unsigned)(*cp)) != '\n') {
/* check for a compressed digraph */
if (c > '\177') {
c &= 0177;
@@ -980,7 +980,7 @@ char *
scanpast(char c)
{
char *cp;
setmark(c);
cp = blockp;
do { /* innermost loop optimized to only one test */
@@ -1003,11 +1003,11 @@ read_block(void)
/* read the next block */
blocklen = read(symrefs, block, BUFSIZ);
blockp = block;
/* add the search character and end-of-block mark */
block[blocklen] = blockmark;
block[blocklen + 1] = '\0';
/* return NULL on end-of-file */
if (blocklen == 0) {
blockp = NULL;
@@ -1023,7 +1023,7 @@ lcasify(char *s)
{
static char ls[PATLEN+1]; /* largest possible match string */
char *lptr = ls;
while(*s) {
*lptr = tolower((unsigned char)*s);
lptr++;
@@ -1049,7 +1049,7 @@ findcalledby(char *pattern)

if (invertedindex == YES) {
POSTING *p;
findterm(pattern);
while ((p = getposting()) != NULL) {
switch (p->type) {
@@ -1067,7 +1067,7 @@ findcalledby(char *pattern)
/* find the function definition(s) */
while (scanpast('\t') != NULL) {
switch (*blockp) {
case NEWFILE:
skiprefchar(); /* save file name */
fetch_string_from_dbase(file, sizeof(file));
@@ -1118,7 +1118,7 @@ findterm(char *pattern)
}
/* if letter case is to be ignored */
if (caseless == YES) {
/* convert the prefix to upper case because it is lexically
less than lower case */
s = prefix;
@@ -1146,7 +1146,7 @@ findterm(char *pattern)
}
/* if it matches */
if (regexec (&regexp, s, (size_t)0, NULL, 0) == 0) {
/* add its postings to the set */
if ((postingp = boolfile(&invcontrol, &npostings, BOOL_OR)) == NULL) {
break;
@@ -1154,7 +1154,7 @@ findterm(char *pattern)
}
/* if there is a prefix */
else if (len > 0) {
/* if ignoring letter case and the term is out of the
range of possible matches */
if (caseless == YES) {
@@ -1172,7 +1172,7 @@ findterm(char *pattern)
progress("Symbols matched", searchcount, totalterms);
}
} while (invforward(&invcontrol)); /* while didn't wrap around */
/* initialize the progress message for retrieving the references */
searchcount = 0;
postingsfound = npostings;
@@ -1235,7 +1235,7 @@ dbseek(long offset)
{
long n;
int rc = 0;
if ((n = offset / BUFSIZ) != blocknumber) {
if ((rc = lseek(symrefs, n * BUFSIZ, 0)) == -1) {
myperror("Lseek failed");
@@ -1255,15 +1255,15 @@ findcalledbysub(char *file, BOOL macro)
/* find the next function call or the end of this function */
while (scanpast('\t') != NULL) {
switch (*blockp) {
case DEFINE: /* #define inside a function */
if (fileversion >= 10) { /* skip it */
while (scanpast('\t') != NULL &&
*blockp != DEFINEEND)
*blockp != DEFINEEND)
;
}
break;
case FCNCALL: /* function call */

/* output the file name */
@@ -1279,7 +1279,7 @@ findcalledbysub(char *file, BOOL macro)
break;

case DEFINEEND: /* #define end */
if (invertedindex == NO) {
if (macro == YES) {
return;


+ 42
- 42
src/fscanner.l View File

@@ -1,8 +1,8 @@
%{
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* 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 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(). */
size_t my_yyleng = 0;
char *my_yytext = NULL;
@@ -141,7 +141,7 @@ wsnl [ \t\r\v\f\n]|{comment}
first = strlen(my_yytext);
if (lex == YES) {
(void) strcat(my_yytext, "yylex");
} else {
} else {
/* yacc: yyparse implicitly calls yylex */
char *s = " yylex()";
char *cp = s + strlen(s);
@@ -179,7 +179,7 @@ wsnl [ \t\r\v\f\n]|{comment}

\{ { /* count unmatched left braces for fcn def detection */
++braces;
/* mark an untagged enum/struct/union so its beginning
can be found */
if (tagdef) {
@@ -214,7 +214,7 @@ wsnl [ \t\r\v\f\n]|{comment}
}
<WAS_ENDIF>\n{wsnl}*#{ws}*if(ndef|def)?{ws}+ {
/* attempt to correct erroneous brace count caused by:
*
*
* #if ...
* ... {
* #endif
@@ -274,7 +274,7 @@ wsnl [ \t\r\v\f\n]|{comment}
<IN_PREPROC>else({ws}.*)? { /* #else --- eat up whole line */
elseelif = YES;
if (iflevel > 0) {
/* save the maximum brace count for this #if */
if (braces > maxifbraces[iflevel - 1]) {
maxifbraces[iflevel - 1] = braces;
@@ -290,7 +290,7 @@ wsnl [ \t\r\v\f\n]|{comment}
/* elseelif = YES; --- HBB I doubt this is correct */
elif:
if (iflevel > 0) {
/* save the maximum brace count for this #if */
if (braces > maxifbraces[iflevel - 1]) {
maxifbraces[iflevel - 1] = braces;
@@ -307,7 +307,7 @@ wsnl [ \t\r\v\f\n]|{comment}
<IN_PREPROC>include{ws}*<[^>\n]+> { /* #include file */
char *s;
char remember = yytext[yyleng-1];
my_yymore();
s = strpbrk(my_yytext, "\"<");
if (!s)
@@ -418,7 +418,7 @@ wsnl [ \t\r\v\f\n]|{comment}
/* NOTREACHED */
}
<IN_PREPROC>define{ws}+{identifier} {
/* preprocessor macro or constant definition */
ppdefine = YES;
token = DEFINE;
@@ -484,7 +484,7 @@ class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ { /* class definition */
tagdef = '\0';
goto more;
}
({wsnl}+{identifier})?{wsnl}* |
({wsnl}+{identifier})?{wsnl}* |
.|\n { /* e/s/u usage */
BEGIN(WAS_IDENTIFIER);
goto ident;
@@ -495,7 +495,7 @@ if{wsnl}*\( { /* ignore 'if' */
yyless(2);
yy_set_bol(0);
goto more;
}
}

{identifier} { /* identifier found: do nothing, yet. (!) */
BEGIN(WAS_IDENTIFIER);
@@ -504,14 +504,14 @@ if{wsnl}*\( { /* ignore 'if' */
/* NOTREACHED */
}

<WAS_IDENTIFIER>{
<WAS_IDENTIFIER>{
{ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.:])*\)([()]|{wsnl})*[:a-zA-Z_#{] {
/* 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! */
/* 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 */
/* FIXME HBB 20001003: the above 'not allowed' may well be the
* reason for the parsing bug concerning function pointer usage,
@@ -548,10 +548,10 @@ if{wsnl}*\( { /* ignore 'if' */
char *s;

if (global == YES && ppdefine == NO && my_yytext[0] != '#' &&
external == NO && initializer == NO &&
external == NO && initializer == NO &&
arraydimension == NO && structfield == NO &&
template == NO && fcndef == NO) {
if (esudef == YES) {
if (esudef == YES) {
/* if enum/struct/union */
token = MEMBERDEF;
} else {
@@ -564,7 +564,7 @@ if{wsnl}*\( { /* ignore 'if' */
fcn:
if (YYSTATE == WAS_IDENTIFIER) {
/* Position back to the actual identifier: */
last = first;
last = first;
first = ident_start;
yyless(0);
/* HBB 20001008: if the anti-backup-pattern above matched,
@@ -583,10 +583,10 @@ if{wsnl}*\( { /* ignore 'if' */
/* if a long line */
if (yyleng > STMTMAX) {
int c;
/* skip to the end of the line */
warning("line too long");
while ((c = input()) > LEXEOF) {
while ((c = input()) > LEXEOF) {
if (c == '\n') {
unput(c);
break;
@@ -603,7 +603,7 @@ if{wsnl}*\( { /* ignore 'if' */
/* if found word was a keyword: */
if ((s = lookup(my_yytext + first)) != NULL) {
first = my_yyleng;
/* if the start of a typedef */
if (s == typedeftext) {
typedefbraces = braces;
@@ -619,19 +619,19 @@ if{wsnl}*\( { /* ignore 'if' */
externalbraces = braces;
external = YES;
} else if (templateparens == parens && template == YES) {
/* keyword doesn't start a function
/* keyword doesn't start a function
* template */
templateparens = -1;
template = NO;
} else {
/* identifier after typedef was a
} else {
/* identifier after typedef was a
* keyword */
oldtype = NO;
}
} else {
} else {
/* not a keyword --> found an identifier */
/* last = yyleng; */
/* if a class/enum/struct/union tag definition */
/* FIXME HBB 20001001: why reject "class"? */
if (tagdef && strnotequal(my_yytext + first, "class")) {
@@ -722,12 +722,12 @@ if{wsnl}*\( { /* ignore 'if' */
}

\' { /* character constant */
if (sdl == NO)
if (sdl == NO)
BEGIN(IN_SQUOTE);
goto more;
/* NOTREACHED */
}
<IN_SQUOTE>\' {
<IN_SQUOTE>\' {
BEGIN(INITIAL);
goto more;
/* NOTREACHED */
@@ -737,7 +737,7 @@ if{wsnl}*\( { /* ignore 'if' */
goto more;
/* NOTREACHED */
}
<IN_DQUOTE>\" {
<IN_DQUOTE>\" {
BEGIN(INITIAL);
goto more;
/* NOTREACHED */
@@ -759,10 +759,10 @@ if{wsnl}*\( { /* ignore 'if' */
/* NOTREACHED */
}
}
^{ws}+ { /* don't save leading white space */
}
{ws}+\n { /* eat whitespace at end of line */
unput('\n');
}
@@ -794,7 +794,7 @@ if{wsnl}*\( { /* ignore 'if' */
unput(' ');
yy_pop_state();
}
}
}

"//".*\n? {
/* C++-style one-line comment */
@@ -805,7 +805,7 @@ if{wsnl}*\( { /* ignore 'if' */
{number} | /* number */
<SDL>STATE[ \t]+ | /* ... and other syntax error catchers... */
. { /* punctuation and operators */
more:
more:
my_yymore();
first = my_yyleng;
}
@@ -816,7 +816,7 @@ void
initscanner(char *srcfile)
{
char *s;
if (maxifbraces == NULL) {
maxifbraces = malloc(miflevel * sizeof(*maxifbraces));
preifbraces = malloc(miflevel * sizeof(*preifbraces));
@@ -855,7 +855,7 @@ initscanner(char *srcfile)
if (my_yytext)
*my_yytext = '\0';
my_yyleng = 0;
BEGIN(INITIAL);

/* if this is not a C file */
@@ -892,13 +892,13 @@ static void
my_yymore(void)
{
static size_t yytext_size = 0;
/* my_yytext is an ever-growing buffer. It will not ever
* shrink, nor will it be freed at end of program, for now */
while (my_yyleng + yyleng + 1 >= yytext_size) {
my_yytext = realloc(my_yytext, yytext_size += MY_YY_ALLOCSTEP);
}
strncpy (my_yytext + my_yyleng, yytext, yyleng+1);
my_yyleng += yyleng;
}

+ 98
- 98
src/global.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -58,30 +58,30 @@ typedef void (*sighandler_t)(int);

#include <fcntl.h>

typedef enum { /* boolean data type */
typedef enum { /* boolean data type */
NO,
YES
} BOOL;

typedef enum { /* findinit return code */
typedef enum { /* findinit return code */
NOERROR,
NOTSYMBOL,
REGCMPERROR
} 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;

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 {
@@ -100,113 +100,113 @@ enum {


/* 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: */
/* 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)])
/* Combine the pair into a dicode */
#define DICODE_COMPRESS(inchar1, inchar2) \
#define DICODE_COMPRESS(inchar1, inchar2) \
((0200 - 2) + dicode1[(unsigned char)(inchar1)] \
+ dicode2[(unsigned char)(inchar2)])

/* 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
extern BOOL displayversion; /* display the C Compilation System version */
extern BOOL displayversion; /* display the C Compilation System version */
#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 */
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 char newpat[]; /* new pattern */
extern char newpat[]; /* new pattern */

/* 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 */
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 msrcfiles; /* maximum number of source files */

/* 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;

/* 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 */
extern struct keystruct {
char *text;
char delim;
struct keystruct *next;
extern struct keystruct {
char *text;
char delim;
struct keystruct *next;
} keyword[];

/* mouse.c global data */
extern BOOL mouse; /* mouse interface */
extern BOOL mouse; /* mouse interface */

/* readline.c global data */
extern char* rl_line_buffer;
@@ -214,10 +214,10 @@ extern char input_line[PATLEN + 1];
extern int rl_point;

#if UNIXPC
extern BOOL unixpcmouse; /* UNIX PC mouse interface */
extern BOOL unixpcmouse; /* UNIX PC mouse interface */
#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 *findcalledby(char *pattern);
@@ -241,8 +241,8 @@ void error_usage(void);
void longusage(void);
void usage(void);
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 horswp_field(void);
BOOL interpret(int c); // XXX: probably rename


+ 1
- 1
src/gscope.c View File

@@ -1 +1 @@
/* Placeholder file --- replace by real gscope.c if you have it */
/* Placeholder file --- replace by real gscope.c if you have it */

+ 5
- 5
src/help.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -51,7 +51,7 @@
void
help(void)
{
char **ep, *s, **tp, *text[MAXHELP];
char **ep, *s, **tp, *text[MAXHELP];
int ln;

tp = text;


+ 6
- 6
src/history.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol or text cross-reference
@@ -73,7 +73,7 @@ prevcmd(void)
return current;
} else if( tail)
return current = tail;
else
else
return NULL;
}

@@ -86,7 +86,7 @@ nextcmd(void)
return current = current->next;
else
return current;
} else
} else
return NULL;
}



+ 8
- 8
src/input.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -259,7 +259,7 @@ askforreturn(void)
/* expand the ~ and $ shell meta characters in a path */

void
shellpath(char *out, int limit, char *in)
shellpath(char *out, int limit, char *in)
{
char *lastchar;
char *s, *v;
@@ -311,7 +311,7 @@ shellpath(char *out, int limit, char *in)
*s++ = *in++;
}
*s = '\0';
/* get its value, but only it isn't too big */
if ((v = getenv(out)) != NULL && strlen(v) < (lastchar - out)) {
strcpy(out - 1, v);
@@ -403,7 +403,7 @@ global_input(const int c){
case KEY_NPAGE:
if (totallines == 0) { return(NO); } /* don't redisplay if there are no lines */
/* 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
* the next page to optimize paging forward
*/
@@ -435,7 +435,7 @@ global_input(const int c){
break;
case '>': /* write or append the lines to a file */
break; // XXX
//char filename[PATHLEN + 1];
//char filename[PATHLEN + 1];
//char* s;
//char ch;
//FILE* file;


+ 24
- 24
src/invlib.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/


@@ -279,8 +279,8 @@ invmake(char *invname, char *invpost, FILE *infile)
}
/* save the size for reference later */
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);
/* write out junk to fill log blk */
@@ -329,7 +329,7 @@ invmake(char *invname, char *invpost, FILE *infile)
if (showzipf) {
printf("\n************* ZIPF curve ****************\n");
for (j = ZIPFSIZE; j > 1; j--)
if (zipf[j])
if (zipf[j])
break;
for (i = 1; i < j; ++i) {
printf("%3d -%6d ", i, zipf[i]);
@@ -386,7 +386,7 @@ invnewterm(void)
}
supfing = i + SUPFING;
#if DEBUG
printf("reallocated superfinger space to %d, totpost=%ld\n",
printf("reallocated superfinger space to %d, totpost=%ld\n",
supersize, totpost);
#endif
}
@@ -427,7 +427,7 @@ invnewterm(void)
}
logicalblk.invblk[0] = numinvitems;
/* set forward pointer pointing to next */
logicalblk.invblk[1] = numlogblk + 1;
logicalblk.invblk[1] = numlogblk + 1;
/* set back pointer to last block */
logicalblk.invblk[2] = numlogblk - 1;
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 */
if (backupflag) {
char *tptr2;
/* find out where the end of the new block is */
iteminfo.packword[0] = logicalblk.invblk[numinvitems*2+1];
tptr3 = logicalblk.chrblk + iteminfo.e.offset;
@@ -507,13 +507,13 @@ invnewterm(void)
return(1);
}

/*
/*
* 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
* returns 0. Otherwise, returns -1.
* returns 0. Otherwise, returns -1.
*/

static int
static int
invflipname(char * invname, const char *from, const char *to)
{
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 */
/* 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 */
/* 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'
* here. */
static FILE *
@@ -708,31 +708,31 @@ static void
invstep(INVCONTROL *invcntl)
{
if (invcntl->keypnt < (invcntl->logblk->invblk[0] - 1)) {
invcntl->keypnt++;
invcntl->keypnt++;
return;
}

/* 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 */
fseek(invcntl->invfile,
invcntl->numblk*invcntl->param.sizeblk + invcntl->param.cntlsize,
SEEK_SET);
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 **/
int
invforward(INVCONTROL *invcntl)
{
invstep(invcntl);
invstep(invcntl);
/* skip things with 0 postings */
/* FIXME HBB: magic number alert! (3) */
while (((ENTRY * )(invcntl->logblk->invblk + 3) + invcntl->keypnt)->post == 0) {
invstep(invcntl);
invstep(invcntl);
}
/* Check for having wrapped - reached start of inverted file! */
if ((invcntl->numblk == 0) && (invcntl->keypnt == 0))
@@ -894,14 +894,14 @@ static int
boolready(void)
{
numitems = 0;
if (item1 != NULL)
if (item1 != NULL)
free(item1);
setsize1 = SETINC;
if ((item1 = malloc(SETINC * sizeof(*item1))) == NULL) {
invcannotalloc(SETINC);
return(-1);
}
if (item2 != NULL)
if (item2 != NULL)
free(item2);
setsize2 = SETINC;
if ((item2 = malloc(SETINC * sizeof(*item2))) == NULL) {
@@ -1155,7 +1155,7 @@ boolsave(int clear) /* flag about whether to clear core */
POSTING *oldstuff, *newstuff;

if (numitems == 0) {
if (clear)
if (clear)
boolclear();
return(NULL);
}


+ 35
- 35
src/invlib.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#ifndef 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 */

/* inverted index definitions */

/* postings temporary file long number coding into characters */
#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
# 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
#error Need a platform with 8 bits in a char value
# endif
@@ -53,34 +53,34 @@

/* inverted index access parameters */
#define INVAVAIL 0
#define INVBUSY 1
#define INVBUSY 1
#define INVALONE 2

/* 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 */
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;

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;

typedef struct {
@@ -91,14 +91,14 @@ typedef struct {
} ENTRY;

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;

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);


+ 5
- 5
src/library.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#ifndef CSCOPE_LIBRARY_H
#define CSCOPE_LIBRARY_H

#include <stdio.h> /* need FILE* type def. */
#include <stdio.h> /* need FILE* type def. */

/* private library */
char *compath(char *pathname);


+ 8
- 8
src/logdir.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/*
@@ -66,11 +66,11 @@ logdir(char *name)
char *p;
int i, j;
int pwf;
/* attempt to open the password file */
if ((pwf = myopen("/etc/passwd", 0, 0)) == -1)
return(0);
/* find the matching password entry */
do {
/* get the next line in the password file */
@@ -87,13 +87,13 @@ logdir(char *name)
} while (*name != *line || /* fast pretest */
strcmp(name, line) != 0);
(void) close(pwf);
/* skip the intervening fields */
p = nextfield(p);
p = nextfield(p);
p = nextfield(p);
p = nextfield(p);
/* return the login directory */
(void) nextfield(p);
return(p);


+ 8
- 8
src/lookup.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -84,7 +84,7 @@ struct keystruct keyword[] = {
{"unsigned", ' ', NULL},
{"void", ' ', NULL},
{"while", '(', NULL},
/* these keywords are not compressed */
{"do", '\0', NULL},
{"auto", ' ', NULL},
@@ -106,7 +106,7 @@ initsymtab(void)
{
unsigned int i, j;
struct keystruct *p;
for (i = 1; i < KEYWORDS; ++i) {
p = keyword + i;
j = hash(p->text) % HASHMOD;
@@ -122,7 +122,7 @@ lookup(char *ident)
{
struct keystruct *p;
int c;
/* look up the identifier in the keyword table */
for (p = hashtab[hash(ident) % HASHMOD]; p != NULL; p = p->next) {
if (strequal(ident, p->text)) {
@@ -142,7 +142,7 @@ hash(char *ss)
{
int i;
unsigned char *s = (unsigned char *)ss;
for (i = 0; *s != '\0'; )
i += *s++; /* += is faster than <<= for cscope */
return(i);


+ 9
- 9
src/lookup.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 2001, The Santa Cruz Operation
Copyright (c) 2001, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#ifndef CSCOPE_LOOKUP_H
@@ -36,10 +36,10 @@
/* declarations for objects defined in lookup.c */

/* 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 */

+ 27
- 27
src/mouse.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -89,7 +89,7 @@ mouseinit(void)

/* see if this is emacsterm or viterm */
term = mygetenv("TERM", "");
if (strcmp(term, "emacsterm") == 0 ||
if (strcmp(term, "emacsterm") == 0 ||
strcmp(term, "viterm") == 0) {
emacsviterm = YES;
mouse = YES;
@@ -101,7 +101,7 @@ mouseinit(void)
mouse = YES;
}
#if UNIXPC
else if (strcmp(term,"s4") == 0 ||
else if (strcmp(term,"s4") == 0 ||
strcmp(term,"s120") == 0 ||
strcmp(term,"s90") == 0) {
int retval;
@@ -109,11 +109,11 @@ mouseinit(void)
struct umdata umd; /* Mouse data structure */

/* Ask for character size info */
retval = ioctl(1,WIOCGETD,&uwd);
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")) {
uw_hs = 9;
@@ -129,7 +129,7 @@ mouseinit(void)
uw_hs = uwd.uw_hs;
uw_vs = uwd.uw_vs;
}
/**************************************************
* Now turn on mouse reporting so we can actually
* make use of all this stuff.
@@ -178,13 +178,13 @@ loadmenu(MENU *menu)
}
else { /* myx */
int len;
mousecleanup();
(void) printf("\033[6;1X\033[9;1X");
for (i = 0; menu[i].text != NULL; ++i) {
len = strlen(menu[i].text);
(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);
}
loaded = menu;
@@ -214,7 +214,7 @@ mousecleanup(void)
int i;

if (loaded != NULL) { /* only true for myx */
/* remove the mouse menu */
(void) printf("\033[6;0X\033[9;0X");
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 i;
/* 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.
* 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
* myungetch().
*/
/* Check for "[?" being next 2 chars */
if(((i = mygetch()) != '[') || ((i = mygetch()) != '?')) {
myungetch(i);
return(NULL);
}
/* Grab the X position (in pixels) */
while(isdigit(i = mygetch())) {
x = (x*10) + (i - '0');
@@ -301,7 +301,7 @@ getmouseaction(char leading_char)
myungetch(i);
return(NULL); /* not a mouse report after all */
}
/* Grab the Y position (in pixels) */
while(isdigit(i = mygetch())) {
y = (y*10) + (i - '0');
@@ -310,7 +310,7 @@ getmouseaction(char leading_char)
myungetch(i);
return(NULL);
}
/* Get which button */
if((button = mygetch()) > '4') {
myungetch(button);
@@ -320,20 +320,20 @@ getmouseaction(char leading_char)
myungetch(i);
return(NULL);
}
/* Get the reason for this mouse report */
if((reason = mygetch()) > '8') {
myungetch(reason);
return(NULL);
}
/* sequence should terminate with an 'M' */
if((i = mygetch()) != 'M') {
myungetch(i);
return(NULL);
}
/* OK. We get a mouse report whenever a button is depressed
* or released. Let's ignore the report whenever the button
* is depressed until when I am ready to implement sweeping.
@@ -341,23 +341,23 @@ getmouseaction(char leading_char)
if(reason != '2') {
return(NULL); /* '2' means button is released */
}
/************************************************************
* Always indicate button 1 irregardless of which button was
* really pushed.
************************************************************/
m.button = 1;
/************************************************************
* Convert pixel coordinates to line and column coords.
* The height and width are obtained using an ioctl() call
* in mouseinit(). This assumes that variable width chars
* are not being used ('though it would probably work anyway).
************************************************************/
m.x1 = x/uw_hs; /* pixel/horizontal_spacing */
m.y1 = y/uw_vs; /* pixel/vertical_spacing */
/* "null" out the other fields */
m.percent = m.x2 = m.y2 = -1;
}
@@ -365,7 +365,7 @@ getmouseaction(char leading_char)
#endif /* not UNIXPC */

if (mouse == YES && leading_char == ctrl('X')) {
switch (mygetch()) {
case ctrl('_'): /* click */
if ((m.button = mygetch()) == '0') { /* if scrollbar */
@@ -377,7 +377,7 @@ getmouseaction(char leading_char)
m.x2 = m.y2 = -1;
}
break;
case ctrl(']'): /* sweep */
m.button = mygetch();
m.x1 = getcoordinate();


+ 4
- 4
src/mygetenv.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#include "library.h"


+ 8
- 8
src/mypopen.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#include <stdio.h>
@@ -74,7 +74,7 @@ myopen(char *path, int flag, int mode)
fd = open(path, flag);

#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 */
if(fd != -1)
return(fd);
@@ -109,9 +109,9 @@ myfopen(char *path, char *mode)
SETMODE(fileno(fp), O_TEXT);
}
#endif /* SETMODE */
#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 */
if(fp)
#else
@@ -178,7 +178,7 @@ mypopen(char *cmd, char *mode)
int
mypclose(FILE *ptr)
{
#ifdef __DJGPP__
#ifdef __DJGPP__
/* HBB 20010705: This system has its own pclose(), which we
* don't want to replace */
return (pclose)(ptr);


+ 4
- 4
src/opt.c View File

@@ -1,9 +1,9 @@
#include "global.h"

#include "build.h"
#include "build.h"
#include "vp.h"
#include "version.h" /* FILEVERSION and FIXVERSION */
#include "scanner.h"
#include "scanner.h"

#include <stdlib.h> /* atoi */
#include <getopt.h>
@@ -55,7 +55,7 @@ char ** parse_options(int *argc, char **argv)
cscope: pattern too long, cannot be > \
%d characters\n", PATLEN);
}
strcpy(input_line, optarg);
strcpy(input_line, optarg);
break;
case 'b': /* only build the cross-reference */
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
* of the main routine doesn't get all confused
*/


+ 3
- 3
src/readline.c View File

@@ -76,11 +76,11 @@ static int rebuild_reference(){
if (errorsfound == YES) {
errorsfound = NO;
askforreturn();
}
}
entercurses();
clearmsg(); /* clear any previous message */
totallines = 0;
disprefs = 0;
disprefs = 0;
topline = nextline = 1;
return(YES);
}
@@ -95,7 +95,7 @@ static int process_mouse(){
if (p->button == '0') {
//scrollbar(p); // XXX
return(NO);
}
}
/* ignore a sweep */
if (p->x2 >= 0) {
return(NO);


+ 31
- 31
src/scanner.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 2001, The Santa Cruz Operation
Copyright (c) 2001, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

#ifndef CSCOPE_SCANNER_H
@@ -35,56 +35,56 @@

#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)
*/
#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 INCLUDE '~'
#define INCLUDE '~'
#define MEMBERDEF 'm'
#define NEWFILE '@'
#define NEWFILE '@'
#define STRUCTDEF 's'
#define TYPEDEF 't'
#define TYPEDEF 't'
#define UNIONDEF 'u'

/* 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 */
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
/* 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: */
/* FIXME: there should be a feature test for this! */
#if defined(__OSF1__) || defined(__sun) || defined(_AIX)
extern char yytext[];
extern char yytext[];
#else
extern unsigned char yytext[];
extern unsigned char yytext[];
#endif
extern int yyleng;
extern int yyleng;
# define my_yytext yytext
# define my_yyleng yyleng
#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

/* The master function exported by scanner.l */


+ 6
- 6
src/version.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* cscope - interactive C symbol cross-reference
@@ -39,7 +39,7 @@
#ifndef 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 */

+ 15
- 15
src/vp.h View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/*
* 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
#define CSCOPE_VP_H

#define MAXPATH 200 /* max length for entire name */
#define MAXPATH 200 /* max length for entire name */

#ifdef HAVE_CONFIG_H
# include "config.h"
#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
#ifdef HAVE_FCNTL_H
# include <fcntl.h> /* needed for O_... open flags */
# include <fcntl.h> /* needed for O_... open flags */
#endif

#include <sys/types.h>
#include <sys/stat.h>

#if !NOMALLOC
extern char **vpdirs; /* directories (including current) in view path */
extern char **vpdirs; /* directories (including current) in view path */
#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
extern int vpndirs; /* number of directories in view path */
extern int vpndirs; /* number of directories in view path */

void vpinit(char *current_dir);
int vpopen(char *path, int oflag);


+ 5
- 5
src/vpaccess.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* vpaccess - view path version of the access system call */
@@ -36,7 +36,7 @@
#include <unistd.h>
#include "vp.h"
#include <sys/types.h>
int
vpaccess(char *path, mode_t amode)
{


+ 6
- 6
src/vpfopen.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* vpfopen - view path version of the fopen library function */
@@ -44,8 +44,8 @@ vpfopen(char *filename, char *type)
FILE *returncode;
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" */
&& type[0] == 'r'
) {


+ 8
- 8
src/vpinit.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/

/* vpinit - initialize vpdirs or update vpdirs based on currentdir */
@@ -62,7 +62,7 @@ vpinit(char *current_dir)
char *node; /* view path node */
char vpathbuf[MAXVPATH + 1];
#endif
/* if an existing directory list is to be updated, free it */
if (current_dir != NULL && vpndirs > 0) {
#if !NOMALLOC
@@ -107,7 +107,7 @@ vpinit(char *current_dir)

/* don't change VPATH in the environment */
vpath = strdup(vpath);
/* split the view path into nodes */
for (i = 0, s = vpath; *s != '\0'; ++i) {
vpdirs[i] = s;
@@ -136,10 +136,10 @@ vpinit(char *current_dir)
}
(void) strcpy(vpathbuf, vpath);
s = vpathbuf;
/* convert the view path nodes to directories */
while (*s != '\0') {
/* get the next node */
node = s;
while (*s != '\0' && *++s != ':') {


+ 4
- 4
src/vpopen.c View File

@@ -1,7 +1,7 @@
/*===========================================================================
Copyright (c) 1998-2000, The Santa Cruz Operation
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
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
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
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
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
DAMAGE.
DAMAGE.
=========================================================================*/




Loading…
Cancel
Save