You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(2) |
Feb
(9) |
Mar
(6) |
Apr
(8) |
May
(7) |
Jun
(49) |
Jul
(36) |
Aug
(8) |
Sep
(4) |
Oct
(11) |
Nov
(3) |
Dec
|
2002 |
Jan
(8) |
Feb
|
Mar
(7) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(9) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
|
Dec
(2) |
2003 |
Jan
(6) |
Feb
|
Mar
(2) |
Apr
(3) |
May
|
Jun
(5) |
Jul
|
Aug
(6) |
Sep
(6) |
Oct
(2) |
Nov
|
Dec
|
2004 |
Jan
(2) |
Feb
(12) |
Mar
|
Apr
(10) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
(4) |
2005 |
Jan
(4) |
Feb
(6) |
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
2006 |
Jan
|
Feb
(2) |
Mar
|
Apr
(12) |
May
(2) |
Jun
|
Jul
(6) |
Aug
(4) |
Sep
(11) |
Oct
(10) |
Nov
|
Dec
|
2007 |
Jan
(4) |
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(8) |
2010 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: Hans-Bernhard B. <br...@us...> - 2001-08-27 13:35:46
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv11609 Modified Files: ChangeLog Log Message: Extended {comment} pattern in Flex scanner to allow C++ comments, too. Fixes SF bug report #455441. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -r1.99 -r1.100 *** ChangeLog 2001/08/15 13:04:14 1.99 --- ChangeLog 2001/08/27 13:35:43 1.100 *************** *** 1,2 **** --- 1,5 ---- + (2001/08/27 - broeker) Add C++-style comments to {comment} pattern. Fixes + bug #455441: C++ comments in the middle of a function + definition caused it not be recognized. (2001/08/15 - broeker) Zero out 'disprefs' whenever the count of references, 'totallines' is set to zero. This makes sure that you |
From: Hans-Bernhard B. <br...@us...> - 2001-08-27 13:35:29
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv11494 Modified Files: fscanner.l Log Message: Extended {comment} pattern in Flex scanner to allow C++ comments, too. Fixes SF bug report #455441. Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** fscanner.l 2001/08/03 16:13:10 1.6 --- fscanner.l 2001/08/27 13:35:25 1.7 *************** *** 128,132 **** identifier [a-zA-Z_$][a-zA-Z_0-9$]* number \.?[0-9][.0-9a-fA-FlLuUxX]* ! comment "/*"([^*]*("*"+[^/])?)*"*/" whitespace [ \t\n]|{comment} --- 128,132 ---- identifier [a-zA-Z_$][a-zA-Z_0-9$]* number \.?[0-9][.0-9a-fA-FlLuUxX]* ! comment "/*"([^*]*("*"+[^/])?)*"*/"|"//"[^\n]*\n whitespace [ \t\n]|{comment} |
From: Hans-Bernhard B. <br...@us...> - 2001-08-15 13:04:19
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv749 Modified Files: ChangeLog Log Message: Avoid <Tab>ing into an empty result area Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -r1.98 -r1.99 *** ChangeLog 2001/08/13 15:31:22 1.98 --- ChangeLog 2001/08/15 13:04:14 1.99 *************** *** 1,2 **** --- 1,6 ---- + (2001/08/15 - broeker) Zero out 'disprefs' whenever the count of references, + 'totallines' is set to zero. This makes sure that you + can't <Tab> into the selection area if there's nothing + in it. (2001/08/13 - jcduell) Revisited inverted index file name fixup routines. (Patch #444669 from SourceForge). |
From: Hans-Bernhard B. <br...@us...> - 2001-08-15 13:04:18
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv749/src Modified Files: command.c display.c Log Message: Avoid <Tab>ing into an empty result area Index: command.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/command.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** command.c 2001/07/05 16:47:04 1.14 --- command.c 2001/08/15 13:04:14 1.15 *************** *** 112,115 **** --- 112,116 ---- postmsg(""); /* clear any previous message */ totallines = 0; + disprefs = 0; topline = nextline = 1; selecting = 0; *************** *** 561,564 **** --- 562,566 ---- } totallines = 0; + disprefs = 0; nextline = 1; if (writerefsfound() == YES) { *************** *** 863,866 **** --- 865,869 ---- postmsg("File does not have expected format"); totallines = 0; + disprefs = 0; return; } Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** display.c 2001/07/09 14:00:25 1.17 --- display.c 2001/08/15 13:04:14 1.18 *************** *** 462,465 **** --- 462,466 ---- nextline = 1; totallines = 0; + disprefs = 0; /* see if it is empty */ |
From: Hans-Bernhard B. <br...@us...> - 2001-08-13 15:31:27
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv18214 Modified Files: ChangeLog Log Message: Jason Duell's latest revision of the invname patch Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -r1.97 -r1.98 *** ChangeLog 2001/08/03 16:13:10 1.97 --- ChangeLog 2001/08/13 15:31:22 1.98 *************** *** 1,2 **** --- 1,4 ---- + (2001/08/13 - jcduell) Revisited inverted index file name fixup routines. + (Patch #444669 from SourceForge). (2001/08/03 - broeker) Use %option noyywrap in fscanner.l to avoid problems with broken flex installations that can't find -lfl. |
From: Hans-Bernhard B. <br...@us...> - 2001-08-13 15:31:27
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv18214/src Modified Files: constants.h invlib.c Log Message: Jason Duell's latest revision of the invname patch Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** constants.h 2001/07/09 14:00:25 1.10 --- constants.h 2001/08/13 15:31:22 1.11 *************** *** 73,76 **** --- 73,79 ---- #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 READ 4 /* access(2) parameter */ Index: invlib.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** invlib.c 2001/07/05 16:47:04 1.14 --- invlib.c 2001/08/13 15:31:22 1.15 *************** *** 504,507 **** --- 504,530 ---- } + /* + * 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. + */ + + static int + invflipname(char * invname, const char *from, const char *to) + { + char *temp, *i = NULL; + + assert(strlen(from) == strlen(to)); + + temp = invname - 1; + while( (temp = strstr(temp + 1, from))) + i = temp; + if (!i || i[strlen(from)] != '\0') + return -1; + while(*to) + *i++ = *to++; + return 0; + } + int invopen(INVCONTROL *invcntl, char *invname, char *invpost, int stat) *************** *** 513,525 **** * 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 */ ! if (!strcmp(invname, "cscope.out.in")) { ! if ((invcntl->invfile = vpfopen(INVNAME, ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; /* 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. */ ! } else if (!strcmp(invname, INVNAME)) { ! if ((invcntl->invfile = vpfopen("cscope.out.in", ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; } invcannotopen(invname); --- 536,551 ---- * 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 */ ! if (!invflipname(invname, INVNAME2, INVNAME)) { ! if ((invcntl->invfile = vpfopen(invname, ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; + invflipname(invname, INVNAME, INVNAME2); /* change back for err msg */ + } /* 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. */ ! else if (!invflipname(invname, INVNAME, INVNAME2)) { ! if ((invcntl->invfile = vpfopen(invname, ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; + invflipname(invname, INVNAME2, INVNAME); /* change back for err msg */ } invcannotopen(invname); *************** *** 543,552 **** if ((invcntl->postfile = vpfopen(invpost, ((stat == 0) ? "rb" : "r+b"))) == NULL) { /* exact same naming convention hacks as above for invname */ ! if (!strcmp(invpost, "cscope.out.po")) { ! if ((invcntl->postfile = vpfopen(INVPOST, ((stat == 0) ? "rb" : "r+b")))) goto openedinvpost; ! } else if (!strcmp(invpost, INVPOST)) { ! if ((invcntl->postfile = vpfopen("cscope.out.po",((stat == 0)?"rb":"r+b")))) goto openedinvpost; } invcannotopen(invpost); --- 569,580 ---- if ((invcntl->postfile = vpfopen(invpost, ((stat == 0) ? "rb" : "r+b"))) == NULL) { /* exact same naming convention hacks as above for invname */ ! if (!invflipname(invpost, INVPOST2, INVPOST)) { ! if ((invcntl->postfile = vpfopen(invpost, ((stat == 0) ? "rb" : "r+b")))) goto openedinvpost; ! invflipname(invpost, INVPOST, INVPOST2); /* change back for err msg */ ! } else if (!invflipname(invpost, INVPOST, INVPOST2)) { ! if ((invcntl->postfile = vpfopen(invpost,((stat == 0)?"rb":"r+b")))) goto openedinvpost; + invflipname(invpost, INVPOST2, INVPOST); /* change back for err msg */ } invcannotopen(invpost); |
From: Hans-Bernhard B. <br...@us...> - 2001-08-03 16:13:14
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv32549/src Modified Files: fscanner.l Log Message: Flex scanner: use option noyywrap Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** fscanner.l 2001/06/25 12:13:18 1.5 --- fscanner.l 2001/08/03 16:13:10 1.6 *************** *** 131,136 **** whitespace [ \t\n]|{comment} ! /* flex-only: stack of start conditions */ %option stack %start SDL --- 131,137 ---- whitespace [ \t\n]|{comment} ! /* flex options: stack of start conditions, and don't use yywrap() */ %option stack + %option noyywrap %start SDL |
From: Hans-Bernhard B. <br...@us...> - 2001-08-03 16:13:14
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv32549 Modified Files: ChangeLog Log Message: Flex scanner: use option noyywrap Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -r1.96 -r1.97 *** ChangeLog 2001/07/12 15:10:13 1.96 --- ChangeLog 2001/08/03 16:13:10 1.97 *************** *** 1,2 **** --- 1,4 ---- + (2001/08/03 - broeker) Use %option noyywrap in fscanner.l to avoid problems + with broken flex installations that can't find -lfl. (2001/07/12 - dixon) Updated INSTALL with new configure info for HP-UX. (2001/07/11 - broeker) Fixed #if syntax glitch in cohrs' SUNOS change. |
From: Petr S. <pe...@us...> - 2001-07-12 15:10:16
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv24899 Modified Files: INSTALL ChangeLog Log Message: Updated INSTALL with new HP-UX info. Index: INSTALL =================================================================== RCS file: /cvsroot/cscope/cscope/INSTALL,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** INSTALL 2001/07/12 13:05:37 1.5 --- INSTALL 2001/07/12 15:10:13 1.6 *************** *** 31,56 **** make ! - On HP-UX 10.20, the default version of curses was observed to be ! broken. Get their "cumulative libHcurses patch" (patch PHCO_10947) ! and then compile like this, to work around that bug: ! make CURSES_LIBS=-lHcurses ! ! Also on other versions of HP-UX, if the build fails at link time with ! errors like: ! ! /usr/ccs/bin/ld: Unsatisfied symbols: ! initscr (code) ! wstandend (code) ! ... ! ! you should delete the file, "config.cache", and re-run configure with ! the option "--with-vcurses"; for example: ! ! ./configure --with-vcurses ! ! Note, however, that you should never see this if you build using ! "make CURSES_LIBS=-lHcurses". ! - On Tru64, formerly known as Digital Unix, formerly known as DEC OSF/1, --- 31,38 ---- make ! - On HP-UX several problems exist when using configure. Try the following ! to solve this: ! CFLAGS='-Ae -DYYCHAR_ARRAY' CURSES_LIBS=-lHcurses ./configure - On Tru64, formerly known as Digital Unix, formerly known as DEC OSF/1, Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -r1.95 -r1.96 *** ChangeLog 2001/07/11 13:36:27 1.95 --- ChangeLog 2001/07/12 15:10:13 1.96 *************** *** 1,2 **** --- 1,3 ---- + (2001/07/12 - dixon) Updated INSTALL with new configure info for HP-UX. (2001/07/11 - broeker) Fixed #if syntax glitch in cohrs' SUNOS change. (2001/07/09 - petrs) Substituted lstat() for stat() to prevent core |
From: Hans-Bernhard B. <br...@us...> - 2001-07-12 13:05:41
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv28163 Modified Files: INSTALL Log Message: Added info how to avoid crash after suspend, using Digital's OSF1 curses Index: INSTALL =================================================================== RCS file: /cvsroot/cscope/cscope/INSTALL,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** INSTALL 2001/07/02 16:26:55 1.4 --- INSTALL 2001/07/12 13:05:37 1.5 *************** *** 54,56 **** --- 54,64 ---- + - On Tru64, formerly known as Digital Unix, formerly known as DEC OSF/1, + the system-supplied libcurses causes cscope to terminate itself + immediately as it comes back to foreground after being suspended by + the user (Ctrl-Z). Using GNU Ncurses instead of OSF1 curses works + around the problem. According to the lynx and ncurses people, this + is a design problem of curses vs. signal handling, at the heart of it. + + Browse to http://cscope.sourceforge.net for more current information. |
From: Hans-Bernhard B. <br...@us...> - 2001-07-11 13:36:31
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv22554 Modified Files: ChangeLog Log Message: #if line syntax glitch in SUNOS patch fixed Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** ChangeLog 2001/07/09 14:58:25 1.94 --- ChangeLog 2001/07/11 13:36:27 1.95 *************** *** 1,2 **** --- 1,3 ---- + (2001/07/11 - broeker) Fixed #if syntax glitch in cohrs' SUNOS change. (2001/07/09 - petrs) Substituted lstat() for stat() to prevent core dumps on looping symbolic references. |
From: Hans-Bernhard B. <br...@us...> - 2001-07-11 13:36:31
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv22554/src Modified Files: scanner.h Log Message: #if line syntax glitch in SUNOS patch fixed Index: scanner.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/scanner.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** scanner.h 2001/07/05 21:25:03 1.2 --- scanner.h 2001/07/11 13:36:27 1.3 *************** *** 76,80 **** /* 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: */ ! #ifdef __OSF1__ || defined(__sun) /* FIXME: there should be a feature test for this! */ extern char yytext[]; #else --- 76,81 ---- /* 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) extern char yytext[]; #else |
From: Petr S. <pe...@us...> - 2001-07-09 14:58:28
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv1740 Modified Files: ChangeLog Log Message: Substituted lstat() for stat() to prevent core dumps on infinite symbolic link loops. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** ChangeLog 2001/07/09 14:00:25 1.93 --- ChangeLog 2001/07/09 14:58:25 1.94 *************** *** 1,2 **** --- 1,4 ---- + (2001/07/09 - petrs) Substituted lstat() for stat() to prevent core + dumps on looping symbolic references. (2001/07/06 - broeker) Code dealing with database creation ripped out of main.c and moved to a new module build.c. New |
From: Petr S. <pe...@us...> - 2001-07-09 14:58:28
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv1740/src Modified Files: build.c dir.c main.c Log Message: Substituted lstat() for stat() to prevent core dumps on infinite symbolic link loops. Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** build.c 2001/07/09 14:01:18 1.1 --- build.c 2001/07/09 14:58:25 1.2 *************** *** 289,293 **** if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, srcfiles[i]) || ! stat(srcfiles[i], &statstruct) != 0 || statstruct.st_mtime > reftime) { goto outofdate; --- 289,293 ---- if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, srcfiles[i]) || ! lstat(srcfiles[i], &statstruct) != 0 || statstruct.st_mtime > reftime) { goto outofdate; *************** *** 375,379 **** } /* if this file was modified */ ! else if (stat(file, &statstruct) == 0 && statstruct.st_mtime > reftime) { crossref(file); --- 375,379 ---- } /* if this file was modified */ ! else if (lstat(file, &statstruct) == 0 && statstruct.st_mtime > reftime) { crossref(file); Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** dir.c 2001/07/05 16:47:04 1.11 --- dir.c 2001/07/09 14:58:25 1.12 *************** *** 155,159 **** /* make sure it is a directory */ ! if (stat(compath(dir), &statstruct) == 0 && (statstruct.st_mode & S_IFDIR)) { --- 155,159 ---- /* make sure it is a directory */ ! if (lstat(compath(dir), &statstruct) == 0 && (statstruct.st_mode & S_IFDIR)) { *************** *** 219,223 **** /* make sure it is a directory */ ! if (stat(compath(path), &statstruct) == 0 && (statstruct.st_mode & S_IFDIR)) { if (incdirs == NULL) { --- 219,223 ---- /* make sure it is a directory */ ! if (lstat(compath(path), &statstruct) == 0 && (statstruct.st_mode & S_IFDIR)) { if (incdirs == NULL) { *************** *** 383,387 **** sprintf(path,"%s/%s",adir,entry->d_name); ! if(stat(path,&buf) == 0) { file = entry->d_name; if( recurse_dir --- 383,387 ---- sprintf(path,"%s/%s",adir,entry->d_name); ! if(lstat(path,&buf) == 0) { file = entry->d_name; if( recurse_dir *************** *** 449,453 **** /* some directories have 2 character suffixes so make sure it is a file */ ! if (stat(file, &statstruct) == 0 && (statstruct.st_mode & S_IFREG)) { return(YES); --- 449,453 ---- /* some directories have 2 character suffixes so make sure it is a file */ ! if (lstat(file, &statstruct) == 0 && (statstruct.st_mode & S_IFREG)) { return(YES); *************** *** 461,465 **** 0) { /* make sure it is a file */ ! if (stat(file, &statstruct) == 0 && (statstruct.st_mode & S_IFREG)) { return(YES); --- 461,465 ---- 0) { /* make sure it is a file */ ! if (lstat(file, &statstruct) == 0 && (statstruct.st_mode & S_IFREG)) { return(YES); Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** main.c 2001/07/09 14:00:25 1.24 --- main.c 2001/07/09 14:58:25 1.25 *************** *** 313,317 **** /* make sure that tmpdir exists */ ! if (stat (tmpdir, &stat_buf)) { fprintf (stderr, "cscope: Temporary directory %s does not exist or cannot be accessed\n", tmpdir); --- 313,317 ---- /* make sure that tmpdir exists */ ! if (lstat (tmpdir, &stat_buf)) { fprintf (stderr, "cscope: Temporary directory %s does not exist or cannot be accessed\n", tmpdir); |
From: Hans-Bernhard B. <br...@us...> - 2001-07-09 14:01:21
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv21355/src Added Files: build.c build.h Log Message: Ripped database building code out of main.c into new module build.[ch] --- NEW FILE --- /*=========================================================================== 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: *Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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. =========================================================================*/ /* cscope - interactive C symbol cross-reference * * main functions */ #include "build.h" #include "global.h" /* FIXME: get rid of this! */ #include "library.h" #include "scanner.h" #include "version.h" /* for FILEVERSION */ #include "vp.h" /* Exported variables: */ BOOL buildonly = NO; /* only build the database */ BOOL unconditional = NO; /* unconditionally build database */ BOOL fileschanged; /* assume some files changed */ char *invname = INVNAME; /* inverted index to the database */ char *invpost = INVPOST; /* inverted index postings */ char *reffile = REFFILE; /* cross-reference file path name */ char *newreffile; /* new cross-reference file name */ FILE *newrefs; /* new cross-reference */ FILE *postings; /* new inverted index postings */ int symrefs = -1; /* cross-reference file */ INVCONTROL invcontrol; /* inverted file control structure */ /* Local variables: */ static char *newinvname; /* new inverted index file name */ static char *newinvpost; /* new inverted index postings file name */ static long traileroffset; /* file trailer offset */ /* Internal prototypes: */ static void cannotindex(void); static int compare(const void *s1, const void *s2); static void copydata(void); static void copyinverted(void); static char *getoldfile(void); static void movefile(char *new, char *old); static void putheader(char *dir); static void putinclude(char *s); static void putlist(char **names, int count); static BOOL samelist(FILE *oldrefs, char **names, int count); /* Error handling routine if inverted index creation fails */ static void cannotindex(void) { (void) fprintf(stderr, "cscope: cannot create inverted index; ignoring -q option\n"); invertedindex = NO; errorsfound = YES; (void) fprintf(stderr, "cscope: removed files %s and %s\n", newinvname, newinvpost); (void) unlink(newinvname); (void) unlink(newinvpost); } /* see if the name list is the same in the cross-reference file */ static BOOL samelist(FILE *oldrefs, char **names, int count) { char oldname[PATHLEN + 1]; /* name in old cross-reference */ int oldcount; int i; /* see if the number of names is the same */ if (fscanf(oldrefs, "%d", &oldcount) != 1 || oldcount != count) { return(NO); } /* see if the name list is the same */ for (i = 0; i < count; ++i) { if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, names[i])) { return(NO); } } return(YES); } /* create the file name(s) used for a new cross-referene */ void setup_build_filenames(char *reffile) { char *path; /* file pathname */ char *s; /* pointer to basename in path */ path = mymalloc(strlen(reffile) + 10); (void) strcpy(path, reffile); s = mybasename(path); *s = '\0'; (void) strcat(path, "n"); ++s; (void) strcpy(s, mybasename(reffile)); newreffile = stralloc(path); (void) strcpy(s, mybasename(invname)); newinvname = stralloc(path); (void) strcpy(s, mybasename(invpost)); newinvpost = stralloc(path); free(path); } /* open the database */ void opendatabase(void) { if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { cannotopen(reffile); 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) { askforreturn(); /* so user sees message */ invertedindex = NO; } } /* rebuild the database */ void rebuild(void) { (void) close(symrefs); if (invertedindex == YES) { invclose(&invcontrol); nsrcoffset = 0; npostings = 0; } build(); opendatabase(); /* revert to the initial display */ if (refsfound != NULL) { (void) fclose(refsfound); refsfound = NULL; } } /* build the cross-reference */ void build(void) { int i; FILE *oldrefs; /* old cross-reference file */ time_t reftime; /* old crossref modification time */ char *file; /* current file */ char *oldfile; /* file in old cross-reference */ char newdir[PATHLEN + 1]; /* directory in new cross-reference */ char olddir[PATHLEN + 1]; /* directory in old cross-reference */ char oldname[PATHLEN + 1]; /* name in old cross-reference */ int oldnum; /* number in old cross-ref */ struct stat statstruct; /* file status */ int firstfile; /* first source file in pass */ int lastfile; /* last source file in pass */ int built = 0; /* built crossref for these files */ int copied = 0; /* copied crossref for these files */ long fileindex; /* source file name index */ BOOL interactive = YES; /* output progress messages */ /* normalize the current directory relative to the home directory so the cross-reference is not rebuilt when the user's login is moved */ (void) strcpy(newdir, currentdir); if (strcmp(currentdir, home) == 0) { (void) strcpy(newdir, "$HOME"); } else if (strncmp(currentdir, home, strlen(home)) == 0) { (void) sprintf(newdir, "$HOME%s", currentdir + strlen(home)); } /* sort the source file names (needed for rebuilding) */ qsort(srcfiles, (unsigned) nsrcfiles, sizeof(char *), compare); /* if there is an old cross-reference and its current directory matches */ /* or this is an unconditional build */ if ((oldrefs = vpfopen(reffile, "rb")) != NULL && unconditional == NO && fscanf(oldrefs, "cscope %d %s", &fileversion, olddir) == 2 && (strcmp(olddir, currentdir) == 0 || /* remain compatible */ strcmp(olddir, newdir) == 0)) { /* get the cross-reference file's modification time */ (void) fstat(fileno(oldrefs), &statstruct); reftime = statstruct.st_mtime; if (fileversion >= 8) { BOOL oldcompress = YES; BOOL oldinvertedindex = NO; BOOL oldtruncate = NO; int c; /* see if there are options in the database */ for (;;) { while((c = getc(oldrefs)) == ' ') { ; } if (c != '-') { (void) ungetc(c, oldrefs); break; } switch (c = getc(oldrefs)) { case 'c': /* ASCII characters only */ oldcompress = NO; break; case 'q': /* quick search */ oldinvertedindex = YES; (void) fscanf(oldrefs, "%ld", &totalterms); break; case 'T': /* truncate symbols to 8 characters */ oldtruncate = YES; break; } } /* check the old and new option settings */ if (oldcompress != compress || oldtruncate != trun_syms) { posterr("cscope: -c or -T option mismatch between command line and old symbol database\n"); goto force; } if (oldinvertedindex != invertedindex) { (void) posterr("cscope: -q option mismatch between command line and old symbol database\n"); if (invertedindex == NO) { posterr("cscope: removed files %s and %s\n", invname, invpost); (void) unlink(invname); (void) unlink(invpost); } goto outofdate; } /* seek to the trailer */ if (fscanf(oldrefs, "%ld", &traileroffset) != 1 || fseek(oldrefs, traileroffset, SEEK_SET) == -1) { posterr("cscope: incorrect symbol database file format\n"); goto force; } } /* if assuming that some files have changed */ if (fileschanged == YES) { goto outofdate; } /* see if the directory lists are the same */ if (samelist(oldrefs, srcdirs, nsrcdirs) == NO || samelist(oldrefs, incdirs, nincdirs) == NO || fscanf(oldrefs, "%d", &oldnum) != 1 || /* get the old number of files */ (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) { /* skip the string space size */ goto outofdate; } /* see if the list of source files is the same and none have been changed up to the included files */ for (i = 0; i < nsrcfiles; ++i) { if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, srcfiles[i]) || stat(srcfiles[i], &statstruct) != 0 || statstruct.st_mtime > reftime) { goto outofdate; } } /* the old cross-reference is up-to-date */ /* so get the list of included files */ while (i++ < oldnum && fscanf(oldrefs, "%s", oldname) == 1) { addsrcfile(mybasename(oldname), oldname); } (void) fclose(oldrefs); return; outofdate: /* if the database format has changed, rebuild it all */ if (fileversion != FILEVERSION) { (void) fprintf(stderr, "cscope: converting to new symbol database file format\n"); goto force; } /* reopen the old cross-reference file for fast scanning */ if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { (void) fprintf(stderr, "cscope: cannot open file %s\n", reffile); myexit(1); } /* get the first file name in the old cross-reference */ blocknumber = -1; (void) readblock(); /* read the first cross-ref block */ (void) scanpast('\t'); /* skip the header */ oldfile = getoldfile(); } else { /* force cross-referencing of all the source files */ force: reftime = 0; oldfile = NULL; } /* open the new cross-reference file */ if ((newrefs = myfopen(newreffile, "wb")) == NULL) { (void) fprintf(stderr, "cscope: cannot open file %s\n", reffile); myexit(1); } if (invertedindex == YES && (postings = myfopen(temp1, "wb")) == NULL) { cannotwrite(temp1); cannotindex(); } putheader(newdir); fileversion = FILEVERSION; if (buildonly == YES && !isatty(0)) { interactive = NO; } else { searchcount = 0; } /* output the leading tab expected by crossref() */ dbputc('\t'); /* make passes through the source file list until the last level of included files is processed */ firstfile = 0; lastfile = nsrcfiles; if (invertedindex == YES) { srcoffset = mymalloc((nsrcfiles + 1) * sizeof(long)); } for (;;) { progress("Building symbol database", (long)built, (long)lastfile); if (linemode == NO) refresh(); /* 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", (long)fileindex, (long)lastfile); } /* if the old file has been deleted get the next one */ file = srcfiles[fileindex]; while (oldfile != NULL && strcmp(file, oldfile) > 0) { oldfile = getoldfile(); } /* if there isn't an old database or this is a new file */ if (oldfile == NULL || strcmp(file, oldfile) < 0) { crossref(file); ++built; } /* if this file was modified */ else if (stat(file, &statstruct) == 0 && statstruct.st_mtime > reftime) { 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 { /* copy its cross-reference */ putfilename(file); if (invertedindex == YES) { copyinverted(); } else { copydata(); } ++copied; oldfile = getoldfile(); } } /* see if any included files were found */ if (lastfile == nsrcfiles) { break; } firstfile = lastfile; lastfile = nsrcfiles; if (invertedindex == YES) { srcoffset = myrealloc(srcoffset, (nsrcfiles + 1) * sizeof(long)); } /* sort the included file names */ qsort(&srcfiles[firstfile], (unsigned) (lastfile - firstfile), sizeof(char *), compare); } /* 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); putlist(srcfiles, nsrcfiles); if (fflush(newrefs) == EOF) { /* rewind doesn't check for write failure */ cannotwrite(newreffile); /* NOTREACHED */ } /* create the inverted index if requested */ if (invertedindex == YES) { char sortcommand[PATHLEN + 1]; if (fflush(postings) == EOF) { cannotwrite(temp1); /* NOTREACHED */ } (void) fstat(fileno(postings), &statstruct); (void) fclose(postings); (void) sprintf(sortcommand, "env LC_ALL=C sort -y -T %s %s", tmpdir, temp1); if ((postings = mypopen(sortcommand, "r")) == NULL) { (void) fprintf(stderr, "cscope: cannot open pipe to sort command\n"); cannotindex(); } else { if ((totalterms = invmake(newinvname, newinvpost, postings)) > 0) { movefile(newinvname, invname); movefile(newinvpost, invpost); } else { cannotindex(); } (void) mypclose(postings); } (void) unlink(temp1); (void) free(srcoffset); } /* rewrite the header with the trailer offset and final option list */ rewind(newrefs); putheader(newdir); (void) fclose(newrefs); /* close the old database file */ if (symrefs >= 0) { (void) close(symrefs); } if (oldrefs != NULL) { (void) fclose(oldrefs); } /* replace it with the new database file */ movefile(newreffile, reffile); } /* string comparison function for qsort */ static int 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) { if (fscanf(f, "%ld", &traileroffset) != 1) { posterr("cscope: cannot read trailer offset from file %s\n", reffile); myexit(1); } if (fseek(f, traileroffset, SEEK_SET) == -1) { posterr("cscope: cannot seek to trailer in file %s\n", reffile); myexit(1); } } /* get the next file name in the old cross-reference */ static char * getoldfile(void) { static char file[PATHLEN + 1]; /* file name in old crossref */ if (blockp != NULL) { do { if (*blockp == NEWFILE) { skiprefchar(); putstring(file); if (file[0] != '\0') { /* if not end-of-crossref */ return(file); } return(NULL); } } while (scanpast('\t') != NULL); } return(NULL); } /* Free all storage allocated for filenames: */ void free_newbuildfiles(void) { free(newinvname); free(newinvpost); free(newreffile); } /* output the cscope version, current directory, database format options, and the database trailer offset */ static void putheader(char *dir) { dboffset = fprintf(newrefs, "cscope %d %s", FILEVERSION, dir); if (compress == NO) { dboffset += fprintf(newrefs, " -c"); } if (invertedindex == YES) { dboffset += fprintf(newrefs, " -q %.10ld", totalterms); } else { /* leave space so if the header is overwritten without -q because writing the inverted index failed, the header is the same length */ dboffset += fprintf(newrefs, " "); } if (trun_syms == YES) { dboffset += fprintf(newrefs, " -T"); } dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); #ifdef PRINTF_RETVAL_BROKEN dboffset = ftell(newrefs); #endif } /* put the name list into the cross-reference file */ static void putlist(char **names, int count) { int i, size = 0; (void) fprintf(newrefs, "%d\n", count); if (names == srcfiles) { /* calculate the string space needed */ for (i = 0; i < count; ++i) { size += strlen(names[i]) + 1; } (void) fprintf(newrefs, "%d\n", size); } for (i = 0; i < count; ++i) { if (fputs(names[i], newrefs) == EOF || putc('\n', newrefs) == EOF) { cannotwrite(newreffile); /* NOTREACHED */ } } } /* copy this file's symbol data */ static void copydata(void) { char symbol[PATLEN + 1]; char *cp; setmark('\t'); cp = blockp; for (;;) { /* copy up to the next \t */ do { /* innermost loop optimized to only one test */ while (*cp != '\t') { dbputc(*cp++); } } while (*++cp == '\0' && (cp = readblock()) != NULL); dbputc('\t'); /* copy the tab */ /* get the next character */ if (*(cp + 1) == '\0') { cp = readblock(); } /* exit if at the end of this file's data */ if (cp == NULL || *cp == NEWFILE) { break; } /* look for an #included file */ if (*cp == INCLUDE) { blockp = cp; putinclude(symbol); writestring(symbol); setmark('\t'); cp = blockp; } } blockp = cp; } /* copy this file's symbol data and output the inverted index postings */ static void copyinverted(void) { char *cp; char c; int type; /* reference type (mark character) */ char symbol[PATLEN + 1]; /* note: this code was expanded in-line for speed */ /* while (scanpast('\n') != NULL) { */ /* other macros were replaced by code using cp instead of blockp */ cp = blockp; for (;;) { setmark('\n'); do { /* innermost loop optimized to only one test */ while (*cp != '\n') { dbputc(*cp++); } } while (*++cp == '\0' && (cp = readblock()) != NULL); dbputc('\n'); /* copy the newline */ /* get the next character */ if (*(cp + 1) == '\0') { cp = readblock(); } /* exit if at the end of this file's data */ if (cp == NULL) { break; } switch (*cp) { case '\n': lineoffset = dboffset + 1; continue; case '\t': dbputc('\t'); blockp = cp; type = getrefchar(); switch (type) { case NEWFILE: /* file name */ return; case INCLUDE: /* #included file */ putinclude(symbol); goto output; } dbputc(type); skiprefchar(); putstring(symbol); goto output; } c = *cp; if (c & 0200) { /* digraph char? */ c = dichar1[(c & 0177) / 8]; } /* if this is a symbol */ if (isalpha((unsigned char)c) || c == '_') { blockp = cp; putstring(symbol); type = ' '; output: putposting(symbol, type); writestring(symbol); if (blockp == NULL) { return; } cp = blockp; } } blockp = cp; } /* replace the old file with the new file */ static void movefile(char *new, char *old) { (void) unlink(old); if (rename(new, old) == -1) { (void) myperror("cscope"); posterr("cscope: cannot rename file %s to file %s\n", new, old); myexit(1); } } /* process the #included file in the old database */ static void putinclude(char *s) { dbputc(INCLUDE); skiprefchar(); putstring(s); incfile(s + 1, s); } --- NEW FILE --- /*=========================================================================== 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: *Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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. =========================================================================*/ /* $Id: build.h,v 1.1 2001/07/09 14:01:18 broeker Exp $ */ #ifndef CSCOPE_BUILD_H #define CSCOPE_BUILD_H #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)) /* 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 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 */ /* Prototypes of external functions defined by build.c */ void build(void); void free_newbuildfiles(void); void opendatabase(void); void rebuild(void); void setup_build_filenames(char *reffile); void seek_to_trailer(FILE *f); #endif /* CSCOPE_BUILD_H */ |
From: Hans-Bernhard B. <br...@us...> - 2001-07-09 14:00:28
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv21137/src Modified Files: Makefile.am Makefile.in constants.h crossref.c display.c find.c global.h invlib.h main.c Log Message: Ripped database building code out of main.c into new module build.[ch] Index: Makefile.am =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Makefile.am 2001/06/27 16:07:40 1.7 --- Makefile.am 2001/07/09 14:00:25 1.8 *************** *** 10,14 **** cscope_SOURCES = $(LEXER_SOURCE) egrep.y \ ! alloc.c basename.c command.c compath.c constants.h crossref.c dir.c \ display.c edit.c exec.c find.c global.h help.c history.c input.c \ invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c \ --- 10,14 ---- cscope_SOURCES = $(LEXER_SOURCE) egrep.y \ ! alloc.c basename.c build.c build.h command.c compath.c constants.h crossref.c dir.c \ display.c edit.c exec.c find.c global.h help.c history.c input.c \ invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c \ Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile.in 2001/06/27 16:42:25 1.4 --- Makefile.in 2001/07/09 14:00:25 1.5 *************** *** 74,78 **** @USING_LEX_FALSE@LEXER_SOURCE = fscanner.l ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y alloc.c basename.c command.c compath.c constants.h crossref.c dir.c display.c edit.c exec.c find.c global.h help.c history.c input.c invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c mygetenv.c mypopen.c scanner.h version.h vp.h vpaccess.c vpfopen.c vpinit.c vpopen.c --- 74,78 ---- @USING_LEX_FALSE@LEXER_SOURCE = fscanner.l ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y alloc.c basename.c build.c build.h command.c compath.c constants.h crossref.c dir.c display.c edit.c exec.c find.c global.h help.c history.c input.c invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c mygetenv.c mypopen.c scanner.h version.h vp.h vpaccess.c vpfopen.c vpinit.c vpopen.c *************** *** 99,109 **** LIBS = @LIBS@ @USING_LEX_FALSE@cscope_OBJECTS = fscanner.o egrep.o alloc.o basename.o \ ! @USING_LEX_FALSE@command.o compath.o crossref.o dir.o display.o edit.o \ ! @USING_LEX_FALSE@exec.o find.o help.o history.o input.o invlib.o \ @USING_LEX_FALSE@logdir.o lookup.o main.o mouse.o mygetenv.o mypopen.o \ @USING_LEX_FALSE@vpaccess.o vpfopen.o vpinit.o vpopen.o @USING_LEX_TRUE@cscope_OBJECTS = scanner.o egrep.o alloc.o basename.o \ ! @USING_LEX_TRUE@command.o compath.o crossref.o dir.o display.o edit.o \ ! @USING_LEX_TRUE@exec.o find.o help.o history.o input.o invlib.o \ @USING_LEX_TRUE@logdir.o lookup.o main.o mouse.o mygetenv.o mypopen.o \ @USING_LEX_TRUE@vpaccess.o vpfopen.o vpinit.o vpopen.o --- 99,109 ---- LIBS = @LIBS@ @USING_LEX_FALSE@cscope_OBJECTS = fscanner.o egrep.o alloc.o basename.o \ ! @USING_LEX_FALSE@build.o command.o compath.o crossref.o dir.o display.o \ ! @USING_LEX_FALSE@edit.o exec.o find.o help.o history.o input.o invlib.o \ @USING_LEX_FALSE@logdir.o lookup.o main.o mouse.o mygetenv.o mypopen.o \ @USING_LEX_FALSE@vpaccess.o vpfopen.o vpinit.o vpopen.o @USING_LEX_TRUE@cscope_OBJECTS = scanner.o egrep.o alloc.o basename.o \ ! @USING_LEX_TRUE@build.o command.o compath.o crossref.o dir.o display.o \ ! @USING_LEX_TRUE@edit.o exec.o find.o help.o history.o input.o invlib.o \ @USING_LEX_TRUE@logdir.o lookup.o main.o mouse.o mygetenv.o mypopen.o \ @USING_LEX_TRUE@vpaccess.o vpfopen.o vpinit.o vpopen.o *************** *** 123,131 **** TAR = gtar GZIP_ENV = --best ! DEP_FILES = .deps/alloc.P .deps/basename.P .deps/command.P \ ! .deps/compath.P .deps/crossref.P .deps/dir.P .deps/display.P \ ! .deps/edit.P .deps/egrep.P .deps/exec.P .deps/find.P .deps/fscanner.P \ ! .deps/help.P .deps/history.P .deps/input.P .deps/invlib.P \ ! .deps/logdir.P .deps/lookup.P .deps/main.P .deps/mouse.P \ .deps/mygetenv.P .deps/mypopen.P .deps/scanner.P .deps/vpaccess.P \ .deps/vpfopen.P .deps/vpinit.P .deps/vpopen.P --- 123,131 ---- TAR = gtar GZIP_ENV = --best ! DEP_FILES = .deps/alloc.P .deps/basename.P .deps/build.P \ ! .deps/command.P .deps/compath.P .deps/crossref.P .deps/dir.P \ ! .deps/display.P .deps/edit.P .deps/egrep.P .deps/exec.P .deps/find.P \ ! .deps/fscanner.P .deps/help.P .deps/history.P .deps/input.P \ ! .deps/invlib.P .deps/logdir.P .deps/lookup.P .deps/main.P .deps/mouse.P \ .deps/mygetenv.P .deps/mypopen.P .deps/scanner.P .deps/vpaccess.P \ .deps/vpfopen.P .deps/vpinit.P .deps/vpopen.P Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** constants.h 2001/07/05 14:31:00 1.9 --- constants.h 2001/07/09 14:00:25 1.10 *************** *** 45,52 **** #define ctrl(x) (x & 037) /* control character macro */ - /* database output macros that update its offset */ - #define dbputc(c) (++dboffset, (void) putc(c, newrefs)) - #define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) - /* fast string equality tests (avoids most strcmp() calls) */ #define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0) --- 45,48 ---- Index: crossref.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/crossref.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** crossref.c 2001/07/05 16:47:04 1.10 --- crossref.c 2001/07/09 14:00:25 1.11 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" + + #include "build.h" #include "scanner.h" Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** display.c 2001/07/05 16:47:04 1.16 --- display.c 2001/07/09 14:00:25 1.17 *************** *** 37,40 **** --- 37,42 ---- #include "global.h" + #include "build.h" + #ifdef CCS #include "sgs.h" /* ESG_PKG and ESG_REL */ Index: find.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/find.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** find.c 2001/06/01 12:43:24 1.12 --- find.c 2001/07/09 14:00:25 1.13 *************** *** 37,40 **** --- 37,42 ---- #include "global.h" + + #include "build.h" #include "scanner.h" /* for token definitions */ #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) Index: global.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/global.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** global.h 2001/07/05 16:47:04 1.17 --- global.h 2001/07/09 14:00:25 1.18 *************** *** 151,154 **** --- 151,155 ---- /* 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 */ *************** *** 170,177 **** extern BOOL recurse_dir; /* recurse dirs when searching for src files */ extern char *namefile; /* file of file names */ - extern char *newreffile; /* new cross-reference file name */ - extern FILE *newrefs; /* new cross-reference */ extern BOOL ogs; /* display OGS book and subsystem names */ - extern FILE *postings; /* new inverted index postings */ extern char *prependpath; /* prepend path to file names */ extern FILE *refsfound; /* references found file */ --- 171,175 ---- *************** *** 179,183 **** extern BOOL select_large; /* enable more than 9 select lines */ #endif - extern int symrefs; /* cross-reference file */ extern char temp1[]; /* temporary file name */ extern char temp2[]; /* temporary file name */ --- 177,180 ---- *************** *** 185,188 **** --- 182,186 ---- extern BOOL trun_syms; /* truncate symbols to 8 characters */ extern char tempstring[8192]; /* global dummy string buffer */ + extern char *tmpdir; /* temporary directory */ /* command.c global data */ *************** *** 313,317 **** void putposting(char *term, int type); void putstring(char *s); - void rebuild(void); void resetcmd(void); void seekline(int line); --- 311,314 ---- Index: invlib.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** invlib.h 2001/07/05 16:47:04 1.5 --- invlib.h 2001/07/09 14:00:25 1.6 *************** *** 104,108 **** extern long *srcoffset; /* source file name database offsets */ extern int nsrcoffset; /* number of file name database offsets */ - extern INVCONTROL invcontrol; /* inverted file control structure */ --- 104,107 ---- Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** main.c 2001/07/05 16:47:04 1.23 --- main.c 2001/07/09 14:00:25 1.24 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" + + #include "build.h" #include "vp.h" #include "version.h" /* FILEVERSION and FIXVERSION */ *************** *** 71,74 **** --- 73,77 ---- char *editor, *shell, *lineflag; /* environment variables */ + char *home; /* Home directory */ BOOL lineflagafterfile; char *argv0; /* command name */ *************** *** 84,88 **** int fileversion; /* cross-reference file version */ BOOL incurses = NO; /* in curses */ - INVCONTROL invcontrol; /* inverted file control structure */ BOOL invertedindex; /* the database has an inverted index */ BOOL isuptodate; /* consider the crossref up-to-date */ --- 87,90 ---- *************** *** 91,100 **** BOOL recurse_dir = NO; /* recurse dirs when searching for src files */ char *namefile; /* file of file names */ - static char *newinvname; /* new inverted index file name */ - static char *newinvpost; /* new inverted index postings file name */ - char *newreffile; /* new cross-reference file name */ - FILE *newrefs; /* new cross-reference */ BOOL ogs; /* display OGS book and subsystem names */ - FILE *postings; /* new inverted index postings */ char *prependpath; /* prepend path to file names */ FILE *refsfound; /* references found file */ --- 93,97 ---- *************** *** 102,106 **** BOOL select_large = NO; /* enable more than 9 select lines */ #endif - int symrefs = -1; /* cross-reference file */ char temp1[PATHLEN + 1]; /* temporary file name */ char temp2[PATHLEN + 1]; /* temporary file name */ --- 99,102 ---- *************** *** 109,140 **** char tempstring[8192]; /* use this as a buffer, instead of 'yytext', * which had better be left alone */ - static BOOL buildonly = NO; /* only build the database */ - static BOOL fileschanged; /* assume some files changed */ - static char *home; /* Home directory */ - static char *invname = INVNAME; /* inverted index to the database */ - static char *invpost = INVPOST; /* inverted index postings */ - static long traileroffset; /* file trailer offset */ static BOOL onesearch; /* one search only in line mode */ - static char *reffile = REFFILE; /* cross-reference file path name */ static char *reflines; /* symbol reference lines file */ - static char *tmpdir; /* temporary directory */ - static BOOL unconditional; /* unconditionally build database */ /* Internal prototypes: */ - static void build(void); - static void cannotindex(void); - static int compare(const void *s1, const void *s2); - static void copydata(void); - static void copyinverted(void); - static char *getoldfile(void); static void initcompress(void); static void longusage(void); - static void movefile(char *new, char *old); - static void opendatabase(void); - static void putheader(char *dir); - static void putinclude(char *s); - static void putlist(char **names, int count); - static BOOL samelist(FILE *oldrefs, char **names, int count); static void skiplist(FILE *oldrefs); static void usage(void); --- 105,116 ---- char tempstring[8192]; /* use this as a buffer, instead of 'yytext', * which had better be left alone */ + char *tmpdir; /* temporary directory */ static BOOL onesearch; /* one search only in line mode */ static char *reflines; /* symbol reference lines file */ /* Internal prototypes: */ static void initcompress(void); static void longusage(void); static void skiplist(FILE *oldrefs); static void usage(void); *************** *** 440,453 **** } initcompress(); ! ! /* seek to the trailer */ ! if (fscanf(oldrefs, "%ld", &traileroffset) != 1) { ! posterr("cscope: cannot read trailer offset from file %s\n", reffile); ! myexit(1); ! } ! if (fseek(oldrefs, traileroffset, SEEK_SET) == -1) { ! posterr("cscope: cannot seek to trailer in file %s\n", reffile); ! myexit(1); ! } } /* skip the source and include directory lists */ --- 416,420 ---- } initcompress(); ! seek_to_trailer(oldrefs); } /* skip the source and include directory lists */ *************** *** 549,565 **** /* initialize the C keyword table */ initsymtab(); ! ! /* create the file name(s) used for a new cross-referene */ ! (void) strcpy(path, reffile); ! s = mybasename(path); ! *s = '\0'; ! (void) strcat(path, "n"); ! ++s; ! (void) strcpy(s, mybasename(reffile)); ! newreffile = stralloc(path); ! (void) strcpy(s, mybasename(invname)); ! newinvname = stralloc(path); ! (void) strcpy(s, mybasename(invpost)); ! newinvpost = stralloc(path); /* build the cross-reference */ --- 516,522 ---- /* initialize the C keyword table */ initsymtab(); ! ! /* Tell build.c about the filenames to create: */ ! setup_build_filenames(reffile); /* build the cross-reference */ *************** *** 709,723 **** } - static void - cannotindex(void) - { - (void) fprintf(stderr, "cscope: cannot create inverted index; ignoring -q option\n"); - invertedindex = NO; - errorsfound = YES; - (void) fprintf(stderr, "cscope: removed files %s and %s\n", newinvname, newinvpost); - (void) unlink(newinvname); - (void) unlink(newinvpost); - } - void cannotopen(char *file) --- 666,669 ---- *************** *** 767,1211 **** } - /* open the database */ - - static void - opendatabase(void) - { - if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { - cannotopen(reffile); - 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) { - askforreturn(); /* so user sees message */ - invertedindex = NO; - } - } - - /* rebuild the database */ - - void - rebuild(void) - { - (void) close(symrefs); - if (invertedindex == YES) { - invclose(&invcontrol); - nsrcoffset = 0; - npostings = 0; - } - build(); - opendatabase(); - - /* revert to the initial display */ - if (refsfound != NULL) { - (void) fclose(refsfound); - refsfound = NULL; - } - } - - /* build the cross-reference */ - - static void - build(void) - { - int i; - FILE *oldrefs; /* old cross-reference file */ - time_t reftime; /* old crossref modification time */ - char *file; /* current file */ - char *oldfile; /* file in old cross-reference */ - char newdir[PATHLEN + 1]; /* directory in new cross-reference */ - char olddir[PATHLEN + 1]; /* directory in old cross-reference */ - char oldname[PATHLEN + 1]; /* name in old cross-reference */ - int oldnum; /* number in old cross-ref */ - struct stat statstruct; /* file status */ - int firstfile; /* first source file in pass */ - int lastfile; /* last source file in pass */ - int built = 0; /* built crossref for these files */ - int copied = 0; /* copied crossref for these files */ - long fileindex; /* source file name index */ - BOOL interactive = YES; /* output progress messages */ - - /* normalize the current directory relative to the home directory so - the cross-reference is not rebuilt when the user's login is moved */ - (void) strcpy(newdir, currentdir); - if (strcmp(currentdir, home) == 0) { - (void) strcpy(newdir, "$HOME"); - } - else if (strncmp(currentdir, home, strlen(home)) == 0) { - (void) sprintf(newdir, "$HOME%s", currentdir + strlen(home)); - } - /* sort the source file names (needed for rebuilding) */ - qsort(srcfiles, (unsigned) nsrcfiles, sizeof(char *), compare); - - /* if there is an old cross-reference and its current directory matches */ - /* or this is an unconditional build */ - if ((oldrefs = vpfopen(reffile, "rb")) != NULL && unconditional == NO && - fscanf(oldrefs, "cscope %d %s", &fileversion, olddir) == 2 && - (strcmp(olddir, currentdir) == 0 || /* remain compatible */ - strcmp(olddir, newdir) == 0)) { - /* get the cross-reference file's modification time */ - (void) fstat(fileno(oldrefs), &statstruct); - reftime = statstruct.st_mtime; - if (fileversion >= 8) { - BOOL oldcompress = YES; - BOOL oldinvertedindex = NO; - BOOL oldtruncate = NO; - int c; - /* see if there are options in the database */ - for (;;) { - while((c = getc(oldrefs)) == ' ') { - ; - } - if (c != '-') { - (void) ungetc(c, oldrefs); - break; - } - switch (c = getc(oldrefs)) { - case 'c': /* ASCII characters only */ - oldcompress = NO; - break; - case 'q': /* quick search */ - oldinvertedindex = YES; - (void) fscanf(oldrefs, "%ld", &totalterms); - break; - case 'T': /* truncate symbols to 8 characters */ - oldtruncate = YES; - break; - } - } - /* check the old and new option settings */ - if (oldcompress != compress || oldtruncate != trun_syms) { - posterr("cscope: -c or -T option mismatch between command line and old symbol database\n"); - goto force; - } - if (oldinvertedindex != invertedindex) { - (void) posterr("cscope: -q option mismatch between command line and old symbol database\n"); - if (invertedindex == NO) { - posterr("cscope: removed files %s and %s\n", - invname, invpost); - (void) unlink(invname); - (void) unlink(invpost); - } - goto outofdate; - } - /* seek to the trailer */ - if (fscanf(oldrefs, "%ld", &traileroffset) != 1 || - fseek(oldrefs, traileroffset, SEEK_SET) == -1) { - posterr("cscope: incorrect symbol database file format\n"); - goto force; - } - } - /* if assuming that some files have changed */ - if (fileschanged == YES) { - goto outofdate; - } - /* see if the directory lists are the same */ - if (samelist(oldrefs, srcdirs, nsrcdirs) == NO || - samelist(oldrefs, incdirs, nincdirs) == NO || - fscanf(oldrefs, "%d", &oldnum) != 1 || /* get the old number of files */ - (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) { /* skip the string space size */ - goto outofdate; - } - /* see if the list of source files is the same and - none have been changed up to the included files */ - for (i = 0; i < nsrcfiles; ++i) { - if (fscanf(oldrefs, "%s", oldname) != 1 || - strnotequal(oldname, srcfiles[i]) || - stat(srcfiles[i], &statstruct) != 0 || - statstruct.st_mtime > reftime) { - goto outofdate; - } - } - /* the old cross-reference is up-to-date */ - /* so get the list of included files */ - while (i++ < oldnum && fscanf(oldrefs, "%s", oldname) == 1) { - addsrcfile(mybasename(oldname), oldname); - } - (void) fclose(oldrefs); - return; - - outofdate: - /* if the database format has changed, rebuild it all */ - if (fileversion != FILEVERSION) { - (void) fprintf(stderr, "cscope: converting to new symbol database file format\n"); - goto force; - } - /* reopen the old cross-reference file for fast scanning */ - if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { - (void) fprintf(stderr, "cscope: cannot open file %s\n", reffile); - myexit(1); - } - /* get the first file name in the old cross-reference */ - blocknumber = -1; - (void) readblock(); /* read the first cross-ref block */ - (void) scanpast('\t'); /* skip the header */ - oldfile = getoldfile(); - } - else { /* force cross-referencing of all the source files */ - force: reftime = 0; - oldfile = NULL; - } - /* open the new cross-reference file */ - if ((newrefs = myfopen(newreffile, "wb")) == NULL) { - (void) fprintf(stderr, "cscope: cannot open file %s\n", reffile); - myexit(1); - } - if (invertedindex == YES && (postings = myfopen(temp1, "wb")) == NULL) { - cannotwrite(temp1); - cannotindex(); - } - putheader(newdir); - fileversion = FILEVERSION; - if (buildonly == YES && !isatty(0)) { - interactive = NO; - } - else { - searchcount = 0; - } - /* output the leading tab expected by crossref() */ - dbputc('\t'); - - /* make passes through the source file list until the last level of - included files is processed */ - firstfile = 0; - lastfile = nsrcfiles; - if (invertedindex == YES) { - srcoffset = mymalloc((nsrcfiles + 1) * sizeof(long)); - } - for (;;) { - progress("Building symbol database", (long)built, - (long)lastfile); - if (linemode == NO) - refresh(); - - /* 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", - (long)fileindex, (long)lastfile); - } - /* if the old file has been deleted get the next one */ - file = srcfiles[fileindex]; - while (oldfile != NULL && strcmp(file, oldfile) > 0) { - oldfile = getoldfile(); - } - /* if there isn't an old database or this is a new file */ - if (oldfile == NULL || strcmp(file, oldfile) < 0) { - crossref(file); - ++built; - } - /* if this file was modified */ - else if (stat(file, &statstruct) == 0 && - statstruct.st_mtime > reftime) { - 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 { /* copy its cross-reference */ - putfilename(file); - if (invertedindex == YES) { - copyinverted(); - } - else { - copydata(); - } - ++copied; - oldfile = getoldfile(); - } - } - /* see if any included files were found */ - if (lastfile == nsrcfiles) { - break; - } - firstfile = lastfile; - lastfile = nsrcfiles; - if (invertedindex == YES) { - srcoffset = myrealloc(srcoffset, - (nsrcfiles + 1) * sizeof(long)); - } - /* sort the included file names */ - qsort(&srcfiles[firstfile], (unsigned) (lastfile - - firstfile), sizeof(char *), compare); - } - /* 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); - putlist(srcfiles, nsrcfiles); - if (fflush(newrefs) == EOF) { /* rewind doesn't check for write failure */ - cannotwrite(newreffile); - /* NOTREACHED */ - } - /* create the inverted index if requested */ - if (invertedindex == YES) { - char sortcommand[PATHLEN + 1]; - - if (fflush(postings) == EOF) { - cannotwrite(temp1); - /* NOTREACHED */ - } - (void) fstat(fileno(postings), &statstruct); - (void) fclose(postings); - (void) sprintf(sortcommand, "env LC_ALL=C sort -y -T %s %s", tmpdir, temp1); - if ((postings = mypopen(sortcommand, "r")) == NULL) { - (void) fprintf(stderr, "cscope: cannot open pipe to sort command\n"); - cannotindex(); - } - else { - if ((totalterms = invmake(newinvname, newinvpost, postings)) > 0) { - movefile(newinvname, invname); - movefile(newinvpost, invpost); - } - else { - cannotindex(); - } - (void) mypclose(postings); - } - (void) unlink(temp1); - (void) free(srcoffset); - } - /* rewrite the header with the trailer offset and final option list */ - rewind(newrefs); - putheader(newdir); - (void) fclose(newrefs); - - /* close the old database file */ - if (symrefs >= 0) { - (void) close(symrefs); - } - if (oldrefs != NULL) { - (void) fclose(oldrefs); - } - /* replace it with the new database file */ - movefile(newreffile, reffile); - } - - /* string comparison function for qsort */ - - static int - 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)); - } - - /* get the next file name in the old cross-reference */ - - static char * - getoldfile(void) - { - static char file[PATHLEN + 1]; /* file name in old crossref */ - - if (blockp != NULL) { - do { - if (*blockp == NEWFILE) { - skiprefchar(); - putstring(file); - if (file[0] != '\0') { /* if not end-of-crossref */ - return(file); - } - return(NULL); - } - } while (scanpast('\t') != NULL); - } - return(NULL); - } - - /* output the cscope version, current directory, database format options, and - the database trailer offset */ - - static void - putheader(char *dir) - { - dboffset = fprintf(newrefs, "cscope %d %s", FILEVERSION, dir); - if (compress == NO) { - dboffset += fprintf(newrefs, " -c"); - } - if (invertedindex == YES) { - dboffset += fprintf(newrefs, " -q %.10ld", totalterms); - } - else { /* leave space so if the header is overwritten without -q - because writing the inverted index failed, the header is the - same length */ - dboffset += fprintf(newrefs, " "); - } - if (trun_syms == YES) { - dboffset += fprintf(newrefs, " -T"); - } - - dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); - #ifdef PRINTF_RETVAL_BROKEN - dboffset = ftell(newrefs); - #endif - } - - /* put the name list into the cross-reference file */ - - static void - putlist(char **names, int count) - { - int i, size = 0; - - (void) fprintf(newrefs, "%d\n", count); - if (names == srcfiles) { - - /* calculate the string space needed */ - for (i = 0; i < count; ++i) { - size += strlen(names[i]) + 1; - } - (void) fprintf(newrefs, "%d\n", size); - } - for (i = 0; i < count; ++i) { - if (fputs(names[i], newrefs) == EOF || - putc('\n', newrefs) == EOF) { - cannotwrite(newreffile); - /* NOTREACHED */ - } - } - } - - /* see if the name list is the same in the cross-reference file */ - - static BOOL - samelist(FILE *oldrefs, char **names, int count) - { - char oldname[PATHLEN + 1]; /* name in old cross-reference */ - int oldcount; - int i; - - /* see if the number of names is the same */ - if (fscanf(oldrefs, "%d", &oldcount) != 1 || - oldcount != count) { - return(NO); - } - /* see if the name list is the same */ - for (i = 0; i < count; ++i) { - if (fscanf(oldrefs, "%s", oldname) != 1 || - strnotequal(oldname, names[i])) { - return(NO); - } - } - return(YES); - } - /* skip the list in the cross-reference file */ --- 713,716 ---- *************** *** 1227,1366 **** } - /* copy this file's symbol data */ - - static void - copydata(void) - { - char symbol[PATLEN + 1]; - char *cp; - - setmark('\t'); - cp = blockp; - for (;;) { - /* copy up to the next \t */ - do { /* innermost loop optimized to only one test */ - while (*cp != '\t') { - dbputc(*cp++); - } - } while (*++cp == '\0' && (cp = readblock()) != NULL); - dbputc('\t'); /* copy the tab */ - - /* get the next character */ - if (*(cp + 1) == '\0') { - cp = readblock(); - } - /* exit if at the end of this file's data */ - if (cp == NULL || *cp == NEWFILE) { - break; - } - /* look for an #included file */ - if (*cp == INCLUDE) { - blockp = cp; - putinclude(symbol); - writestring(symbol); - setmark('\t'); - cp = blockp; - } - } - blockp = cp; - } - - /* copy this file's symbol data and output the inverted index postings */ - - static void - copyinverted(void) - { - char *cp; - char c; - int type; /* reference type (mark character) */ - char symbol[PATLEN + 1]; - - /* note: this code was expanded in-line for speed */ - /* while (scanpast('\n') != NULL) { */ - /* other macros were replaced by code using cp instead of blockp */ - cp = blockp; - for (;;) { - setmark('\n'); - do { /* innermost loop optimized to only one test */ - while (*cp != '\n') { - dbputc(*cp++); - } - } while (*++cp == '\0' && (cp = readblock()) != NULL); - dbputc('\n'); /* copy the newline */ - - /* get the next character */ - if (*(cp + 1) == '\0') { - cp = readblock(); - } - /* exit if at the end of this file's data */ - if (cp == NULL) { - break; - } - switch (*cp) { - case '\n': - lineoffset = dboffset + 1; - continue; - case '\t': - dbputc('\t'); - blockp = cp; - type = getrefchar(); - switch (type) { - case NEWFILE: /* file name */ - return; - case INCLUDE: /* #included file */ - putinclude(symbol); - goto output; - } - dbputc(type); - skiprefchar(); - putstring(symbol); - goto output; - } - c = *cp; - if (c & 0200) { /* digraph char? */ - c = dichar1[(c & 0177) / 8]; - } - /* if this is a symbol */ - if (isalpha((unsigned char)c) || c == '_') { - blockp = cp; - putstring(symbol); - type = ' '; - output: - putposting(symbol, type); - writestring(symbol); - if (blockp == NULL) { - return; - } - cp = blockp; - } - } - blockp = cp; - } - - /* process the #included file in the old database */ - - static void - putinclude(char *s) - { - dbputc(INCLUDE); - skiprefchar(); - putstring(s); - incfile(s + 1, s); - } - - /* replace the old file with the new file */ - - static void - movefile(char *new, char *old) - { - (void) unlink(old); - if (rename(new, old) == -1) { - (void) myperror("cscope"); - posterr("cscope: cannot rename file %s to file %s\n", - new, old); - myexit(1); - } - } - /* enter curses mode */ --- 732,735 ---- *************** *** 1469,1476 **** freesrclist(); freecrossref(); ! free(newinvname); ! free(newinvpost); ! free(newreffile); ! exit(sig); } --- 838,843 ---- freesrclist(); freecrossref(); ! free_newbuildfiles(); ! exit(sig); } |
From: Hans-Bernhard B. <br...@us...> - 2001-07-09 14:00:28
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv21137 Modified Files: ChangeLog Log Message: Ripped database building code out of main.c into new module build.[ch] Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** ChangeLog 2001/07/05 21:25:03 1.92 --- ChangeLog 2001/07/09 14:00:25 1.93 *************** *** 1,2 **** --- 1,5 ---- + (2001/07/06 - broeker) Code dealing with database creation ripped out of + main.c and moved to a new module build.c. New + header file build.h to go with it. (2001/07/05 - cohrs) LEX and SUNOS fix for scanner. (2001/07/05 - broeker) Put in lots of 'static' keywords, added prototypes. |
From: Hans-Bernhard B. <br...@us...> - 2001-07-09 13:58:18
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv20677 Modified Files: egrep.y Log Message: Some added 'static' qualifiers and prototypes Index: egrep.y =================================================================== RCS file: /cvsroot/cscope/cscope/src/egrep.y,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** egrep.y 2001/07/05 14:31:00 1.6 --- egrep.y 2001/07/09 13:58:15 1.7 *************** *** 82,85 **** --- 82,89 ---- static jmp_buf env; /* setjmp/longjmp buffer */ static char *message; /* error message */ + + /* Internal prototypes: */ + static void cfoll(int v); + static void cgotofn(void); static int cstate(int v); static int member(int symb, int set, int torf); *************** *** 202,206 **** } ! void synerror(void) { --- 206,210 ---- } ! static void synerror(void) { |
From: Petr S. <pe...@us...> - 2001-07-05 21:25:06
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv22668/src Modified Files: scanner.h Log Message: LEX and SUNOS scanner fix (cohrs) Index: scanner.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/scanner.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** scanner.h 2001/06/01 12:43:24 1.1 --- scanner.h 2001/07/05 21:25:03 1.2 *************** *** 76,80 **** /* 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: */ ! #ifdef __OSF1__ /* FIXME: there should be a feature test for this! */ extern char yytext[]; #else --- 76,80 ---- /* 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: */ ! #ifdef __OSF1__ || defined(__sun) /* FIXME: there should be a feature test for this! */ extern char yytext[]; #else |
From: Petr S. <pe...@us...> - 2001-07-05 21:25:06
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv22668 Modified Files: AUTHORS ChangeLog Log Message: LEX and SUNOS scanner fix (cohrs) Index: AUTHORS =================================================================== RCS file: /cvsroot/cscope/cscope/AUTHORS,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** AUTHORS 2001/06/29 14:20:15 1.28 --- AUTHORS 2001/07/05 21:25:03 1.29 *************** *** 29,30 **** --- 29,31 ---- Ragho Mahalingam <ra...@ma...> - webcscope Dmitry Obukhov - Hilight code in webcscope + David Cohrs - LEX and SUNOS scanner fix Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -r1.91 -r1.92 *** ChangeLog 2001/07/05 16:47:04 1.91 --- ChangeLog 2001/07/05 21:25:03 1.92 *************** *** 1,2 **** --- 1,3 ---- + (2001/07/05 - cohrs) LEX and SUNOS fix for scanner. (2001/07/05 - broeker) Put in lots of 'static' keywords, added prototypes. (2001/07/05 - broeker) Renamed pclose() function to mypclose(), in order not to |
From: Hans-Bernhard B. <br...@us...> - 2001-07-05 18:49:33
|
Update of /cvsroot/cscope/cscope/packages/MSDOS In directory usw-pr-cvs1:/tmp/cvs-serv13511/packages/MSDOS Modified Files: djmake.bat ylwrap.pat Log Message: DOS/DJGPP related fixes Index: djmake.bat =================================================================== RCS file: /cvsroot/cscope/cscope/packages/MSDOS/djmake.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** djmake.bat 2001/06/29 10:49:15 1.2 --- djmake.bat 2001/07/05 13:47:53 1.3 *************** *** 10,14 **** echo with "ln -s": ! patch -p1 -i packages/MSDOS/ylwrap.pat echo ---- Now configure and make it. --- 10,14 ---- echo with "ln -s": ! patch -p0 -i packages/MSDOS/ylwrap.pat echo ---- Now configure and make it. Index: ylwrap.pat =================================================================== RCS file: /cvsroot/cscope/cscope/packages/MSDOS/ylwrap.pat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ylwrap.pat 2001/06/28 15:56:06 1.1 --- ylwrap.pat 2001/07/05 13:47:53 1.2 *************** *** 1,4 **** --- src/ylwrap Tue Jun 26 15:23:52 2001 ! +++ src/ylwrap.DOS Thu Jun 28 17:39:31 2001 @@ -80,7 +80,7 @@ ;; --- 1,4 ---- --- src/ylwrap Tue Jun 26 15:23:52 2001 ! +++ src.DOS/ylwrap Thu Jun 28 17:39:31 2001 @@ -80,7 +80,7 @@ ;; |
From: Hans-Bernhard B. <br...@us...> - 2001-07-05 18:49:33
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv13511 Modified Files: ChangeLog Log Message: DOS/DJGPP related fixes Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -r1.87 -r1.88 *** ChangeLog 2001/07/03 22:09:50 1.87 --- ChangeLog 2001/07/05 13:47:53 1.88 *************** *** 1,2 **** --- 1,3 ---- + (2001/07/05 - broeker) Some post-last-minute DOS/DJGPP build fixes. (2001/07/03 - petrs) Updated the version strings to 16.0a. (2001/07/02 - petrs) Updated the contrib/README to include xcscope. |
From: Hans-Bernhard B. <br...@us...> - 2001-07-05 18:49:33
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv13511/src Modified Files: constants.h invlib.c Log Message: DOS/DJGPP related fixes Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** constants.h 2001/06/01 12:43:24 1.7 --- constants.h 2001/07/05 13:47:54 1.8 *************** *** 44,48 **** /* database output macros that update its offset */ #define dbputc(c) (++dboffset, (void) putc(c, newrefs)) ! #if Linux || BSD && !sun #define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) #else --- 44,48 ---- /* database output macros that update its offset */ #define dbputc(c) (++dboffset, (void) putc(c, newrefs)) ! #if __DJGPP__ || Linux || BSD && !sun #define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) #else Index: invlib.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** invlib.c 2001/06/01 12:31:00 1.11 --- invlib.c 2001/07/05 13:47:54 1.12 *************** *** 515,519 **** * I.e, hack around our own violation of the inverse db naming convention */ if (!strcmp(invname, "cscope.out.in")) { ! if ((invcntl->invfile = vpfopen(INVNAME, ((stat == 0) ? "r" : "r+")))) goto openedinvname; /* more silliness: if you create the db with '-f cscope', then try to open --- 515,519 ---- * I.e, hack around our own violation of the inverse db naming convention */ if (!strcmp(invname, "cscope.out.in")) { ! if ((invcntl->invfile = vpfopen(INVNAME, ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; /* more silliness: if you create the db with '-f cscope', then try to open *************** *** 521,525 **** * here. */ } else if (!strcmp(invname, INVNAME)) { ! if ((invcntl->invfile = vpfopen("cscope.out.in", ((stat == 0) ? "r" : "r+")))) goto openedinvname; } --- 521,525 ---- * here. */ } else if (!strcmp(invname, INVNAME)) { ! if ((invcntl->invfile = vpfopen("cscope.out.in", ((stat == 0) ? "rb" : "r+b")))) goto openedinvname; } *************** *** 545,552 **** /* exact same naming convention hacks as above for invname */ if (!strcmp(invpost, "cscope.out.po")) { ! if ((invcntl->postfile = vpfopen(INVPOST, ((stat == 0) ? "r" : "r+")))) goto openedinvpost; } else if (!strcmp(invpost, INVPOST)) { ! if ((invcntl->postfile = vpfopen("cscope.out.po",((stat == 0)?"r":"r+")))) goto openedinvpost; } --- 545,552 ---- /* exact same naming convention hacks as above for invname */ if (!strcmp(invpost, "cscope.out.po")) { ! if ((invcntl->postfile = vpfopen(INVPOST, ((stat == 0) ? "rb" : "r+b")))) goto openedinvpost; } else if (!strcmp(invpost, INVPOST)) { ! if ((invcntl->postfile = vpfopen("cscope.out.po",((stat == 0)?"rb":"r+b")))) goto openedinvpost; } |
From: Hans-Bernhard B. <br...@us...> - 2001-07-05 18:45:32
|
Update of /cvsroot/cscope/cscope In directory usw-pr-cvs1:/tmp/cvs-serv24008 Modified Files: ChangeLog config.h.in configure configure.in Log Message: Centralization of BSD-specific #ifs, and some further code cleanups Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** ChangeLog 2001/07/05 13:47:53 1.88 --- ChangeLog 2001/07/05 14:30:59 1.89 *************** *** 1,2 **** --- 1,7 ---- + (2001/07/05 - broeker) Centralisation of BSDism configuration stuff. Removal of + some remaining external prototypes from .c files, where + they should never be. Added multiple inclusion guards + to all headers. Ask for feature instead of testing a + list of platform-#defines, wherever possible. (2001/07/05 - broeker) Some post-last-minute DOS/DJGPP build fixes. (2001/07/03 - petrs) Updated the version strings to 16.0a. Index: config.h.in =================================================================== RCS file: /cvsroot/cscope/cscope/config.h.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** config.h.in 2001/06/28 15:12:35 1.8 --- config.h.in 2001/07/05 14:30:59 1.9 *************** *** 58,64 **** --- 58,73 ---- #undef USING_LEX + /* Define if you have the fixkeypad function. */ + #undef HAVE_FIXKEYPAD + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD + /* Define if you have the memcpy function. */ + #undef HAVE_MEMCPY + + /* Define if you have the memset function. */ + #undef HAVE_MEMSET + /* Define if you have the regcmp function. */ #undef HAVE_REGCMP *************** *** 69,72 **** --- 78,84 ---- /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF + + /* Define if you have the strchr function. */ + #undef HAVE_STRCHR /* Define if you have the strerror function. */ Index: configure =================================================================== RCS file: /cvsroot/cscope/cscope/configure,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** configure 2001/07/03 22:09:50 1.13 --- configure 2001/07/05 14:30:59 1.14 *************** *** 2358,2376 **** fi for ac_hdr in fcntl.h sys/window.h sys/termios.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:2365: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2370 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then --- 2358,2431 ---- fi + for ac_func in strchr memcpy memset + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2364: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF + #line 2369 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ + #include <assert.h> + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:2392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF + #define $ac_tr_func 1 + EOF + + else + echo "$ac_t""no" 1>&6 + fi + done + for ac_hdr in fcntl.h sys/window.h sys/termios.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:2420: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2425 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then *************** *** 2400,2409 **** echo $ac_n "checking for working const""... $ac_c" 1>&6 ! echo "configure:2403: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2408 "configure" #include "confdefs.h" --- 2455,2464 ---- echo $ac_n "checking for working const""... $ac_c" 1>&6 ! echo "configure:2458: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2463 "configure" #include "confdefs.h" *************** *** 2454,2458 **** ; return 0; } EOF ! if { (eval echo configure:2457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes --- 2509,2513 ---- ; return 0; } EOF ! if { (eval echo configure:2512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes *************** *** 2475,2484 **** echo $ac_n "checking for mode_t""... $ac_c" 1>&6 ! echo "configure:2478: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2483 "configure" #include "confdefs.h" #include <sys/types.h> --- 2530,2539 ---- echo $ac_n "checking for mode_t""... $ac_c" 1>&6 ! echo "configure:2533: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2538 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2508,2517 **** echo $ac_n "checking for pid_t""... $ac_c" 1>&6 ! echo "configure:2511: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2516 "configure" #include "confdefs.h" #include <sys/types.h> --- 2563,2572 ---- echo $ac_n "checking for pid_t""... $ac_c" 1>&6 ! echo "configure:2566: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2571 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2541,2550 **** echo $ac_n "checking for size_t""... $ac_c" 1>&6 ! echo "configure:2544: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2549 "configure" #include "confdefs.h" #include <sys/types.h> --- 2596,2605 ---- echo $ac_n "checking for size_t""... $ac_c" 1>&6 ! echo "configure:2599: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2604 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2575,2584 **** echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 ! echo "configure:2578: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2583 "configure" #include "confdefs.h" #include <sys/types.h> --- 2630,2639 ---- echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 ! echo "configure:2633: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2638 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2597,2601 **** ; return 0; } EOF ! if { (eval echo configure:2600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void --- 2652,2656 ---- ; return 0; } EOF ! if { (eval echo configure:2655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void *************** *** 2617,2627 **** for ac_func in getcwd regcmp regcomp strerror vsnprintf snprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:2621: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2626 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, --- 2672,2737 ---- for ac_func in getcwd regcmp regcomp strerror vsnprintf snprintf do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2676: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF + #line 2681 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ + #include <assert.h> + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:2704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF + #define $ac_tr_func 1 + EOF + + else + echo "$ac_t""no" 1>&6 + fi + done + + for ac_func in fixkeypad + do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:2731: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 2736 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, *************** *** 2646,2650 **** ; return 0; } EOF ! if { (eval echo configure:2649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" --- 2756,2760 ---- ; return 0; } EOF ! if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" Index: configure.in =================================================================== RCS file: /cvsroot/cscope/cscope/configure.in,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** configure.in 2001/07/03 22:09:50 1.19 --- configure.in 2001/07/05 14:31:00 1.20 *************** *** 477,480 **** --- 477,481 ---- AC_HEADER_DIRENT AC_HEADER_STDC + AC_CHECK_FUNCS(strchr memcpy memset) AC_CHECK_HEADERS(fcntl.h sys/window.h sys/termios.h unistd.h) *************** *** 488,491 **** --- 489,493 ---- AC_TYPE_SIGNAL AC_CHECK_FUNCS(getcwd regcmp regcomp strerror vsnprintf snprintf) + AC_CHECK_FUNCS(fixkeypad) case "$host_os" in |
From: Hans-Bernhard B. <br...@us...> - 2001-07-05 18:45:30
|
Update of /cvsroot/cscope/cscope/src In directory usw-pr-cvs1:/tmp/cvs-serv24008/src Modified Files: basename.c compath.c constants.h crossref.c egrep.y exec.c global.h invlib.c invlib.h library.h main.c mouse.c version.h vp.h Log Message: Centralization of BSD-specific #ifs, and some further code cleanups Index: basename.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/basename.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** basename.c 2001/03/27 14:09:19 1.2 --- basename.c 2001/07/05 14:31:00 1.3 *************** *** 33,46 **** /* get a file's base name from its path name */ - #if BSD - #define strrchr rindex - #endif - static char const rcsid[] = "$Id$"; char * mybasename(char *path) { ! char *s, *strrchr(); if ((s = strrchr(path, '/')) != 0) { --- 33,44 ---- /* get a file's base name from its path name */ static char const rcsid[] = "$Id$"; + #include "global.h" + char * mybasename(char *path) { ! char *s; if ((s = strrchr(path, '/')) != 0) { Index: compath.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/compath.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** compath.c 2000/05/03 22:02:10 1.2 --- compath.c 2001/07/05 14:31:00 1.3 *************** *** 45,55 **** */ - #include <string.h> - static char const rcsid[] = "$Id$"; - #if BSD - #define strchr index - #endif #ifndef NULL #define NULL 0 --- 45,52 ---- */ static char const rcsid[] = "$Id$"; + + #include "global.h" #ifndef NULL #define NULL 0 Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** constants.h 2001/07/05 13:47:54 1.8 --- constants.h 2001/07/05 14:31:00 1.9 *************** *** 38,41 **** --- 38,44 ---- */ + #ifndef CSCOPE_CONSTANTS_H + #define CSCOPE_CONSTANTS_H + #include "config.h" /* Get OS defines */ *************** *** 44,52 **** /* database output macros that update its offset */ #define dbputc(c) (++dboffset, (void) putc(c, newrefs)) - #if __DJGPP__ || Linux || BSD && !sun #define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) - #else - #define dbfputs(s) (dboffset += fputs(s, newrefs)) - #endif /* fast string equality tests (avoids most strcmp() calls) */ --- 47,51 ---- *************** *** 132,133 **** --- 131,134 ---- #endif /* if !TERMINFO */ #endif /* ifndef __FreeBSD__ */ + + #endif /* CSCOPE_CONSTANTS_H */ Index: crossref.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/crossref.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** crossref.c 2001/06/01 12:43:24 1.8 --- crossref.c 2001/07/05 14:31:00 1.9 *************** *** 233,237 **** lineoffset = dboffset; dboffset += fprintf(newrefs, "%d ", lineno); ! #if BSD && !sun && !__FreeBSD__ dboffset = ftell(newrefs); /* fprintf doesn't return chars written */ #endif --- 233,237 ---- lineoffset = dboffset; dboffset += fprintf(newrefs, "%d ", lineno); ! #ifdef PRINTF_RETVAL_BROKEN dboffset = ftell(newrefs); /* fprintf doesn't return chars written */ #endif Index: egrep.y =================================================================== RCS file: /cvsroot/cscope/cscope/src/egrep.y,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** egrep.y 2001/03/27 15:14:02 1.5 --- egrep.y 2001/07/05 14:31:00 1.6 *************** *** 46,69 **** %{ ! /*#include "global.h"*/ #include <ctype.h> #include <stdio.h> - #ifdef BSD /* build command requires #ifdef instead of #if */ - #undef tolower /* BSD tolower doesn't test the character */ - #define tolower(c) (islower(c) ? (c) : (c) - 'A' + 'a') - char *memset(); - #else - #ifdef V9 - char *memset(); - #else /*V9*/ - #include <memory.h> /* memset */ - #endif /*V9*/ - #endif - #include <setjmp.h> /* jmp_buf */ ! /* HBB 20000509: only this line from 'global.h' is really ! * needed. #include'ing all of it would pull in the unwanted ! * non-static prototype for 'yylex()'. */ ! FILE *myfopen(char *path, char *mode); #define nextch() (*input++) --- 46,54 ---- %{ ! #include "global.h" #include <ctype.h> #include <stdio.h> ! #include <setjmp.h> /* jmp_buf */ #define nextch() (*input++) *************** *** 110,113 **** --- 95,99 ---- static int yylex(void); + static int yyerror(char *); %} *************** *** 157,161 **** %% ! int yyerror(char *s) { --- 143,147 ---- %% ! static int yyerror(char *s) { *************** *** 167,173 **** yylex(void) { - /* HBB 20010327: shouldn't be needed: we're inside the Yacc - * source itself */ - /* extern int yylval; */ int cclcnt, x; char c, d; --- 153,156 ---- *************** *** 616,619 **** --- 599,605 ---- return(0); } + + /* FIXME HBB: should export this to a separate file and use + * AC_REPLACE_FUNCS() */ #if BSD /*LINTLIBRARY*/ Index: exec.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/exec.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** exec.c 2001/03/29 15:03:55 1.5 --- exec.c 2001/07/05 14:31:00 1.6 *************** *** 74,78 **** char *argv[BUFSIZ]; pid_t p; - pid_t myfork(); /* fork and exec the program or shell script */ --- 74,77 ---- Index: global.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/global.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** global.h 2001/06/01 12:43:24 1.15 --- global.h 2001/07/05 14:31:00 1.16 *************** *** 38,41 **** --- 38,44 ---- */ + #ifndef CSCOPE_GLOBAL_H + #define CSCOPE_GLOBAL_H + #include "config.h" #include <unistd.h> *************** *** 45,53 **** #include <stdio.h> /* standard I/O package */ #include <stdlib.h> /* standard library functions */ ! #include <string.h> /* string functions */ #include "constants.h" /* misc. constants */ #include "invlib.h" /* inverted index library */ #include "library.h" /* library function return values */ #ifndef RETSIGTYPE #if SVR2 || BSD && !sun --- 48,80 ---- #include <stdio.h> /* standard I/O package */ #include <stdlib.h> /* standard library functions */ ! ! /* Replace most of the #if BSD stuff. Taken straight from the autoconf ! * manual, with an extension for handling memset(). */ ! #if STDC_HEADERS ! # include <string.h> /* string functions */ ! #else ! # ifndef HAVE_STRCHR ! # define strchr index ! # define strrchr rindex ! # endif ! char *strchr (), *strrchr (); ! # ifndef HAVE_MEMCPY ! # define memcpy(d, s, n) bcopy ((s), (d), (n)) ! # define memmove(d, s, n) bcopy ((s), (d), (n)) ! # endif ! # ifndef HAVE_MEMSET ! # ifndef HAVE_MEMORY_H ! char *memset(); ! # else ! # include <memory.h> /* memset */ ! # endif /*V9*/ ! # endif /* HAVE_MEMSET */ ! #endif /* STDC_HEADERS */ ! #include "constants.h" /* misc. constants */ #include "invlib.h" /* inverted index library */ #include "library.h" /* library function return values */ + /* Fallback, in case 'configure' failed to do its part of the job */ #ifndef RETSIGTYPE #if SVR2 || BSD && !sun *************** *** 58,62 **** --- 85,109 ---- #endif /* RETSIGTYPE */ + #if BSD + # undef tolower /* BSD toupper and tolower don't test the character */ + # undef toupper + # define tolower(c) (islower(c) ? (c) : (c) - 'A' + 'a') + # define toupper(c) (isupper(c) ? (c) : (c) - 'a' + 'A') + # if !sun + # if !__FreeBSD__ + /* in traditional BSD, *printf() doesn't return the number of bytes + * written */ + # define PRINTF_RETVAL_BROKEN 1 + # endif /* !FreeBSD */ + # endif /* !sun */ + #endif + + /* Just in case autoconf didn't correctly flag HAVE_FIXKEYPAD */ + #ifndef HAVE_FIXKEYPAD + # if SVR2 && !BSD && !V9 && !u3b2 && !sun + # define HAVE_FIXKEYPAD + # endif + #endif typedef enum { /* boolean data type */ *************** *** 297,298 **** --- 344,346 ---- + #endif /* CSCOPE_GLOBAL_H */ Index: invlib.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** invlib.c 2001/07/05 13:47:54 1.12 --- invlib.c 2001/07/05 14:31:00 1.13 *************** *** 41,50 **** #define ERR -1 #endif - #if BSD - #define strchr index - char *strchr(); - #else - #include <string.h> - #endif #include "invlib.h" #include "global.h" --- 41,44 ---- *************** *** 565,569 **** #if SHARE if (invcntl->param.share == 1) { ! key_t ftok(), shm_key; struct shmid_ds shm_buf; int shm_id; --- 559,563 ---- #if SHARE if (invcntl->param.share == 1) { ! key_t shm_key; struct shmid_ds shm_buf; int shm_id; Index: invlib.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** invlib.h 2001/06/01 12:43:24 1.3 --- invlib.h 2001/07/05 14:31:00 1.4 *************** *** 37,50 **** #define CSCOPE_INVLIB_H /* inverted index definitions */ /* postings temporary file long number coding into characters */ /* FIXME HBB: where would these definitions come from ? */ ! #if u3b || u3b2 || u3b5 || u3b15 || uts # define BASE 223 /* 255 - ' ' */ # define PRECISION 4 /* maximum digits after converting a long */ ! #else /* assume sign-extension of a char when converted to an int */ # define BASE 95 /* 127 - ' ' */ # define PRECISION 5 /* maximum digits after converting a long */ #endif --- 37,57 ---- #define CSCOPE_INVLIB_H + #include <stdio.h> /* need definition of FILE* */ + #include <limits.h> + /* inverted index definitions */ /* postings temporary file long number coding into characters */ /* FIXME HBB: where would these definitions come from ? */ ! #if CHAR_MAX==255 # 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 */ + # else + # error Need a platform with 8 bits in a char value + # endif #endif Index: library.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/library.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** library.h 2001/06/01 12:43:24 1.5 --- library.h 2001/07/05 14:31:00 1.6 *************** *** 33,49 **** /* $Id$ */ - /* library function return value declarations */ - #ifndef CSCOPE_LIBRARY_H #define CSCOPE_LIBRARY_H ! #if BSD ! #define strchr index ! #define strrchr rindex ! #undef tolower /* BSD toupper and tolower don't test the character */ ! #undef toupper ! #define tolower(c) (islower(c) ? (c) : (c) - 'A' + 'a') ! #define toupper(c) (isupper(c) ? (c) : (c) - 'a' + 'A') ! #endif /* private library */ --- 33,40 ---- /* $Id$ */ #ifndef CSCOPE_LIBRARY_H #define CSCOPE_LIBRARY_H ! #include <stdio.h> /* need FILE* type def. */ /* private library */ Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** main.c 2001/06/01 12:43:24 1.20 --- main.c 2001/07/05 14:31:00 1.21 *************** *** 135,138 **** --- 135,142 ---- static void longusage(void); + #ifdef HAVE_FIXKEYPAD + void fixkeypad(); + #endif + int main(int argc, char **argv) *************** *** 146,152 **** pid_t pid; struct stat stat_buf; - #if SVR2 && !BSD && !V9 && !u3b2 && !sun - void fixkeypad(); - #endif yyin = stdin; --- 150,153 ---- *************** *** 381,385 **** #if TERMINFO (void) keypad(stdscr, TRUE); /* enable the keypad */ ! #if SVR2 && !BSD && !V9 && !u3b2 && !sun fixkeypad(); /* fix for getch() intermittently returning garbage */ #endif --- 382,386 ---- #if TERMINFO (void) keypad(stdscr, TRUE); /* enable the keypad */ ! #ifdef HAVE_FIXKEYPAD fixkeypad(); /* fix for getch() intermittently returning garbage */ #endif *************** *** 1147,1153 **** dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); ! ! #if BSD && !sun ! dboffset = ftell(newrefs); /* fprintf doesn't return chars written */ #endif } --- 1148,1153 ---- dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); ! #ifdef PRINTF_RETVAL_BROKEN ! dboffset = ftell(newrefs); #endif } Index: mouse.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/mouse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** mouse.c 2000/05/03 22:02:10 1.3 --- mouse.c 2001/07/05 14:31:00 1.4 *************** *** 89,93 **** { char *term; - char *mygetenv(); /* see if this is emacsterm or viterm */ --- 89,92 ---- Index: version.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/version.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** version.h 2001/07/03 22:09:50 1.7 --- version.h 2001/07/05 14:31:00 1.8 *************** *** 39,42 **** --- 39,47 ---- */ + #ifndef CSCOPE_VERSION_H + #define CSCOPE_VERSION_H + #define FILEVERSION 16 /* Initial Open Source and Linux Port */ #define FIXVERSION ".0a" /* feature and bug fix version */ + + #endif /* CSCOPE_VERSION_H */ Index: vp.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/vp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** vp.h 2001/03/27 14:09:19 1.2 --- vp.h 2001/07/05 14:31:00 1.3 *************** *** 40,43 **** --- 40,46 ---- */ + #ifndef CSCOPE_VP_H + #define CSCOPE_VP_H + #define MAXPATH 200 /* max length for entire name */ *************** *** 68,69 **** --- 71,74 ---- int vpopen(char *path, int oflag); int vpaccess(char *path, mode_t amode); + + #endif /* CSCOPE_VP_H */ |