Resolves: bz 343671

This commit is contained in:
Neil Horman 2008-03-14 13:06:42 +00:00
parent fda3dd3800
commit bf72a06f09
17 changed files with 95 additions and 878 deletions

View File

@ -1,2 +1,3 @@
cscope-15.5.tar.gz
cscope-15.5-inverted.patch
cscope-15.6.tar.gz

View File

@ -1,208 +0,0 @@
--- cscope-15.5/src/display.c.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/display.c 2007-03-05 12:02:10.000000000 -0500
@@ -217,7 +217,7 @@ display(void)
disprefs < mdisprefs && screenline <= lastdispline;
++disprefs, ++screenline) {
/* read the reference line */
- if (fscanf(refsfound, "%s%s%s %[^\n]", file, function,
+ if (fscanf(refsfound, "%" PATHLEN_STR "s%" PATHLEN_STR "s%" NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]", file, function,
linenum, tempstring) < 4) {
break;
}
--- cscope-15.5/src/build.c.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/build.c 2007-03-05 12:02:10.000000000 -0500
@@ -115,7 +115,7 @@ samelist(FILE *oldrefs, char **names, in
}
/* see if the name list is the same */
for (i = 0; i < count; ++i) {
- if (fscanf(oldrefs, "%s", oldname) != 1 ||
+ if (! fgets(oldname, sizeof(oldname), oldrefs)||
strnotequal(oldname, names[i])) {
return(NO);
}
@@ -223,8 +223,8 @@ build(void)
/* 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 */
+ fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2
+ && (strcmp(olddir, currentdir) == 0 || /* remain compatible */
strcmp(olddir, newdir) == 0)) {
/* get the cross-reference file's modification time */
(void) fstat(fileno(oldrefs), &statstruct);
@@ -292,7 +292,7 @@ build(void)
/* 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 ||
+ if (! fgets(oldname, sizeof(oldname), oldrefs) ||
strnotequal(oldname, srcfiles[i]) ||
lstat(srcfiles[i], &statstruct) != 0 ||
statstruct.st_mtime > reftime) {
@@ -301,7 +301,7 @@ build(void)
}
/* the old cross-reference is up-to-date */
/* so get the list of included files */
- while (i++ < oldnum && fscanf(oldrefs, "%s", oldname) == 1) {
+ while (i++ < oldnum && fgets(oldname, sizeof(oldname), oldrefs)) {
addsrcfile(oldname);
}
(void) fclose(oldrefs);
--- cscope-15.5/src/dir.c.orig 2003-06-02 06:43:00.000000000 -0400
+++ cscope-15.5/src/dir.c 2007-03-05 12:02:10.000000000 -0500
@@ -319,7 +319,7 @@ makefilelist(void)
/* Parse whitespace-terminated strings in line: */
point_in_line = line;
- while (sscanf(point_in_line, "%s", path) == 1) {
+ while (sscanf(point_in_line, "%" PATHLEN_STR "s", path) == 1) {
/* Have to store this length --- inviewpath() will
* modify path, later! */
length_of_name = strlen(path);
--- cscope-15.5/src/edit.c.orig 2001-07-18 09:49:01.000000000 -0400
+++ cscope-15.5/src/edit.c 2007-03-05 12:02:10.000000000 -0500
@@ -60,7 +60,7 @@ editref(int i)
seekline(i + topline);
/* get the file name and line number */
- if (fscanf(refsfound, "%s%*s%s", file, linenum) == 2) {
+ if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file, linenum) == 2) {
edit(file, linenum); /* edit it */
}
seekline(topline); /* restore the line pointer */
@@ -83,7 +83,7 @@ editall(void)
seekline(1);
/* get each file name and line number */
- while (fscanf(refsfound, "%s%*s%s%*[^\n]", file, linenum) == 2) {
+ while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) {
edit(file, linenum); /* edit it */
if (editallprompt == YES) {
addstr("Type ^D to stop editing all lines, or any other character to continue: ");
--- cscope-15.5/src/input.c.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/input.c 2007-03-05 12:02:10.000000000 -0500
@@ -293,16 +293,15 @@ shellpath(char *out, int limit, char *in
/* if the login name is null, then use $HOME */
if (*out == '\0') {
v = getenv("HOME");
- }
- else { /* get the home directory of the login name */
+ } else { /* get the home directory of the login name */
v = logdir(out);
}
- /* copy the directory name */
- if (v != NULL) {
+ /* copy the directory name if it isn't too big */
+ if (v != NULL && strlen(v) < (lastchar - out)) {
(void) strcpy(out - 1, v);
out += strlen(v) - 1;
- }
- else { /* login not found, so ~ must be part of the file name */
+ } else {
+ /* login not found, so ~ must be part of the file name */
out += strlen(out);
}
}
@@ -322,11 +321,11 @@ shellpath(char *out, int limit, char *in
*s = '\0';
/* get its value */
- if ((v = getenv(out)) != NULL) {
+ if ((v = getenv(out)) != NULL && strlen(v) < (lastchar - out)) {
(void) strcpy(out - 1, v);
out += strlen(v) - 1;
- }
- else { /* var not found, so $ must be part of the file name */
+ } else {
+ /* var not found, so $ must be part of the file name */
out += strlen(out);
}
}
--- cscope-15.5/src/main.c.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/main.c 2007-03-05 12:02:10.000000000 -0500
@@ -102,10 +102,10 @@ BOOL select_large = NO; /* enable more t
#endif
char temp1[PATHLEN + 1]; /* temporary file name */
char temp2[PATHLEN + 1]; /* temporary file name */
-char tempdirpv[PATHLEN +1]; /* private temp directory */
+char tempdirpv[PATHLEN + 1]; /* private temp directory */
long totalterms; /* total inverted index terms */
BOOL trun_syms; /* truncate symbols to 8 characters */
-char tempstring[8192]; /* use this as a buffer, instead of 'yytext',
+char tempstring[TEMPSTRING_LEN + 1]; /* use this as a buffer, instead of 'yytext',
* which had better be left alone */
char *tmpdir; /* temporary directory */
@@ -264,6 +264,13 @@ main(int argc, char **argv)
s[11] = '\0';
}
#endif
+ if (strlen(reffile) > sizeof(path) - 1) {
+ char buffer[512];
+ sprintf(buffer,"cscope: reffile too long, cannot be > %d characters\n", sizeof(path) - 1);
+ postmsg(buffer);
+ myexit(1);
+ /* NOTREACHED */
+ }
s = path + strlen(path);
(void) strcpy(s, ".in");
invname = stralloc(path);
@@ -491,11 +498,11 @@ lastarg:
|| (names = vpfopen(NAMEFILE, "r")) != NULL) {
/* read any -p option from it */
- while (fscanf(names, "%s", path) == 1 && *path == '-') {
+ while (fgets(path, sizeof(path), names) != NULL && *path == '-') {
i = path[1];
s = path + 2; /* for "-Ipath" */
if (*s == '\0') { /* if "-I path" */
- (void) fscanf(names, "%s", path);
+ fgets(path, sizeof(path), names);
s = path;
}
switch (i) {
@@ -512,7 +519,7 @@ lastarg:
}
else {
for (i = 0; i < nsrcfiles; ++i) {
- if (fscanf(oldrefs, "%s", path) != 1) {
+ if (!fgets(path, sizeof(path), oldrefs) ) {
posterr("cscope: cannot read source file name from file %s\n", reffile);
myexit(1);
}
--- cscope-15.5/src/command.c.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/command.c 2007-03-05 12:02:10.000000000 -0500
@@ -727,7 +727,7 @@ changestring(void)
(void) fprintf(script, "ed - <<\\!\n");
*oldfile = '\0';
seekline(1);
- for (i = 0; fscanf(refsfound, "%s%*s%s%*[^\n]", newfile, linenum) == 2;
+ for (i = 0; fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", newfile, linenum) == 2;
++i) {
/* see if the line is to be changed */
if (change[i] == YES) {
--- cscope-15.5/src/constants.h.orig 2007-03-05 12:01:59.000000000 -0500
+++ cscope-15.5/src/constants.h 2007-03-05 12:02:10.000000000 -0500
@@ -68,6 +68,7 @@
#define NUMLEN 5 /* line number length */
#define PATHLEN 250 /* file pathname length */
#define PATLEN 250 /* symbol pattern length */
+#define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */
#define REFFILE "cscope.out" /* cross-reference output file */
#define NAMEFILE "cscope.files" /* default list-of-files file */
#define INVNAME "cscope.in.out" /* inverted index to the database */
@@ -77,6 +78,13 @@
#define STMTMAX 10000 /* maximum source statement length */
+#define STR2(x) #x
+#define STRINGIZE(x) STR2(x)
+#define PATLEN_STR STRINGIZE(PATLEN)
+#define PATHLEN_STR STRINGIZE(PATHLEN)
+#define NUMLEN_STR STRINGIZE(NUMLEN)
+#define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)
+
/* screen lines */
#define FLDLINE (LINES - FIELDS - 1) /* first input field line */
#define MSGLINE 0 /* message line */

View File

@ -1,28 +0,0 @@
--- cscope-15.5/src/invlib.c.overflow 2003-06-20 03:46:03.000000000 -0400
+++ cscope-15.5/src/invlib.c 2006-04-21 10:28:06.000000000 -0400
@@ -47,7 +47,6 @@
#define DEBUG 0 /* debugging code and realloc messages */
#define BLOCKSIZE 2 * BUFSIZ /* logical block size */
-#define LINEMAX 1000 /* sorted posting line max size */
#define POSTINC 10000 /* posting buffer size increment */
#define SEP ' ' /* sorted posting field separator */
#define SETINC 100 /* posting set size increment */
@@ -112,7 +111,7 @@
long fileindex = 0; /* initialze, to avoid warning */
unsigned postsize = POSTINC * sizeof(POSTING);
unsigned long *intptr;
- char line[LINEMAX];
+ char line[TERMMAX];
long tlong;
PARAM param;
POSTING posting;
@@ -177,7 +176,7 @@
lastinblk = sizeof(t_logicalblk);
/* now loop as long as more to read (till eof) */
- while (fgets(line, LINEMAX, infile) != NULL) {
+ while (fgets(line, TERMMAX, infile) != NULL) {
#if DEBUG || STATS
++totpost;
#endif

View File

@ -1,33 +0,0 @@
--- cscope/src/crossref.c.orig 2003-04-29 10:08:45.000000000 -0400
+++ cscope/src/crossref.c 2004-10-05 10:37:19.958700472 -0400
@@ -95,10 +95,16 @@
int token; /* current token */
struct stat st;
+ filename = srcfile;
+ putfilename(srcfile); /* output the file name */
+ dbputc('\n');
+ dbputc('\n');
+
if (! ((stat(srcfile, &st) == 0)
&& S_ISREG(st.st_mode))) {
cannotopen(srcfile);
errorsfound = YES;
+ dbputc('\t');
return;
}
@@ -107,12 +113,9 @@
if ((yyin = myfopen(srcfile, "r")) == NULL) {
cannotopen(srcfile);
errorsfound = YES;
+ dbputc('\t');
return;
}
- filename = srcfile; /* save the file name for warning messages */
- putfilename(srcfile); /* output the file name */
- dbputc('\n');
- dbputc('\n');
/* read the source file */
initscanner(srcfile);

View File

@ -1,11 +0,0 @@
--- cscope-15.5/contrib/ocs.orig 2007-03-05 11:57:36.000000000 -0500
+++ cscope-15.5/contrib/ocs 2007-03-05 11:58:11.000000000 -0500
@@ -119,7 +119,7 @@ SPECDEST= # hops - query for files
#
# Parse the command line
-set -- `getopt xfqdu $*`
+set -- `getopt xfqdus $*`
if [ $? -ne 0 ]
then

View File

@ -1,11 +0,0 @@
--- cscope-15.5/contrib/ocs.old 2006-05-04 10:52:02.000000000 -0400
+++ cscope-15.5/contrib/ocs 2006-05-04 11:18:31.000000000 -0400
@@ -75,7 +75,7 @@
#set the default value for SYSDIR
if [ -z "${SYSDIR}" ]; then
- SYSDIR=/var/lib/cs
+ SYSDIR=/var/run/cs
echo setting default sysdir
fi

View File

@ -1,27 +0,0 @@
--- cscope-15.5/contrib/ocs 2001-07-18 09:48:56.000000000 -0400
+++ cscope-15.5.ocs-fix/contrib/ocs 2004-06-21 00:47:26.000000000 -0400
@@ -70,11 +70,23 @@
#
# Here is where we put things
CSCOPE=cscope
-SYSDIR=/usr/local/lib/cs
HOMEDIR=${HOME}/lib/cs
+#set the default value for SYSDIR
+if [ -z "${SYSDIR}" ]; then
+ SYSDIR=/var/lib/cs
+ echo setting default sysdir
+fi
+
+#check that SYSDIR exists
+if [ ! -d ${SYSDIR} ]; then
+ echo -n $SYSDIR does not exist.
+ echo Please create the directory and set SYSDIR appropriately
+ exit
+fi
+
# Check that cscope is in PATH
type cscope 1>/dev/null 2>&1
if [ $? -ne 0 ]

View File

@ -1,280 +0,0 @@
--- cscope-15.5/src/find.c.stack 2006-06-23 16:00:34.000000000 -0400
+++ cscope-15.5/src/find.c 2006-06-23 16:00:47.000000000 -0400
@@ -184,7 +184,7 @@ find_symbol_or_assignment(char *pattern,
(void) scanpast('\t'); /* find the end of the header */
skiprefchar(); /* skip the file marker */
- putstring(file); /* save the file name */
+ putstring(file, PATHLEN); /* save the file name */
(void) strcpy(function, global);/* set the dummy global function name */
(void) strcpy(macro, global);/* set the dummy global macro name */
@@ -216,7 +216,7 @@ find_symbol_or_assignment(char *pattern,
/* save the name */
skiprefchar();
- putstring(file);
+ putstring(file, PATHLEN);
/* check for the end of the symbols */
if (*file == '\0') {
@@ -255,7 +255,7 @@ find_symbol_or_assignment(char *pattern,
}
/* save the name */
skiprefchar();
- putstring(s);
+ putstring(s, PATHLEN);
/* see if this is a regular expression pattern */
if (isregexp_valid == YES) {
@@ -293,7 +293,7 @@ find_symbol_or_assignment(char *pattern,
if (isalpha((unsigned char)firstchar) || firstchar == '_') {
blockp = cp;
- putstring(symbol);
+ putstring(symbol, PATHLEN);
if (caseless == YES) {
s = lcasify(symbol); /* point to lower case version */
}
@@ -382,7 +382,7 @@ finddef(char *pattern)
case NEWFILE:
skiprefchar(); /* save file name */
- putstring(file);
+ putstring(file, PATHLEN);
if (*file == '\0') { /* if end of symbols */
return NULL;
}
@@ -412,21 +412,36 @@ finddef(char *pattern)
}
/* find all function definitions (used by samuel only) */
+static void blow_up(int line)
+{
+ fprintf(stderr,"STACK CORRUPTION AT %d\n",line);
+ abort();
+}
+
+#define CHECK_STACK() do { if(test != (unsigned int)&test) {\
+blow_up(__LINE__);\
+}} while(0)
+
char *
findallfcns(char *dummy)
{
+ volatile unsigned int test = 0;
char file[PATHLEN + 1]; /* source file name */
char function[PATLEN + 1]; /* function name */
-
+ char oldblockp;
(void) dummy; /* unused argument */
/* find the next file name or definition */
+ test = (unsigned int)&test;
while (scanpast('\t') != NULL) {
+ CHECK_STACK();
+ oldblockp=*blockp;
switch (*blockp) {
case NEWFILE:
skiprefchar(); /* save file name */
- putstring(file);
+ putstring(file, PATHLEN);
+ CHECK_STACK();
if (*file == '\0') { /* if end of symbols */
return NULL;
}
@@ -440,8 +455,7 @@ findallfcns(char *dummy)
case FCNDEF:
case CLASSDEF:
skiprefchar(); /* save function name */
- putstring(function);
-
+ putstring(function, PATHLEN);
/* output the file, function and source line */
putref(0, file, function);
break;
@@ -483,7 +497,7 @@ findcalling(char *pattern)
case NEWFILE: /* save file name */
skiprefchar();
- putstring(file);
+ putstring(file, PATHLEN);
if (*file == '\0') { /* if end of symbols */
return NULL;
}
@@ -494,7 +508,7 @@ findcalling(char *pattern)
case DEFINE: /* could be a macro */
if (fileversion >= 10) {
skiprefchar();
- putstring(macro);
+ putstring(macro, PATHLEN);
}
break;
@@ -504,7 +518,7 @@ findcalling(char *pattern)
case FCNDEF: /* save calling function name */
skiprefchar();
- putstring(function);
+ putstring(function, PATHLEN);
for (i = 0; i < morefuns; i++)
if ( !strcmp(tmpfunc[i], function) )
break;
@@ -639,7 +653,7 @@ findinclude(char *pattern)
case NEWFILE: /* save file name */
skiprefchar();
- putstring(file);
+ putstring(file, PATHLEN);
if (*file == '\0') { /* if end of symbols */
return NULL;
}
@@ -790,7 +804,7 @@ match(void)
/* see if this is a regular expression pattern */
if (isregexp_valid == YES) {
- putstring(string);
+ putstring(string, PATHLEN);
if (*string == '\0') {
return(NO);
}
@@ -940,26 +954,29 @@ putline(FILE *output)
/* put the rest of the cross-reference line into the string */
void
-putstring(char *s)
+putstring(char *s, int length)
{
char *cp;
unsigned c;
-
+ int i=0;
setmark('\n');
cp = blockp;
do {
- while ((c = (unsigned)(*cp)) != '\n') {
+ while (((c = (unsigned)(*cp)) != '\n') && (i<length)) {
if (c > '\177') {
c &= 0177;
*s++ = dichar1[c / 8];
*s++ = dichar2[c & 7];
+ i+=2;
}
else {
*s++ = c;
+ i++;
}
++cp;
}
- } while (*(cp + 1) == '\0' && (cp = readblock()) != NULL);
+ } while (((*(cp + 1) == '\0' && (cp = readblock()) != NULL)) &&
+ (i < length));
blockp = cp;
*s = '\0';
}
@@ -1059,7 +1076,7 @@ findcalledby(char *pattern)
case NEWFILE:
skiprefchar(); /* save file name */
- putstring(file);
+ putstring(file, PATHLEN);
if (*file == '\0') { /* if end of symbols */
return(&found_caller);
}
@@ -1194,7 +1211,7 @@ putpostingref(POSTING *p, char *pat)
if (p->type == FCNDEF) { /* need to find the function name */
if (dbseek(p->lineoffset) != -1) {
scanpast(FCNDEF);
- putstring(function);
+ putstring(function, PATHLEN);
}
}
else if (p->type != FCNCALL) {
@@ -1203,7 +1220,7 @@ putpostingref(POSTING *p, char *pat)
}
else if (p->fcnoffset != lastfcnoffset) {
if (dbseek(p->fcnoffset) != -1) {
- putstring(function);
+ putstring(function, PATHLEN);
lastfcnoffset = p->fcnoffset;
}
}
--- cscope-15.5/src/global.h.stack 2006-06-23 16:01:31.000000000 -0400
+++ cscope-15.5/src/global.h 2006-06-23 16:02:55.000000000 -0400
@@ -370,7 +370,7 @@ void postmsg(char *msg);
void postmsg2(char *msg);
void posterr(char *msg,...);
void putposting(char *term, int type);
-void putstring(char *s);
+void putstring(char *s, int length);
void resetcmd(void);
void seekline(int line);
void setfield(void);
--- cscope-15.5/src/build.c.stack 2003-03-05 05:43:59.000000000 -0500
+++ cscope-15.5/src/build.c 2006-06-23 16:00:47.000000000 -0400
@@ -82,7 +82,7 @@ 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 putinclude(char *s, int len);
static void putlist(char **names, int count);
static BOOL samelist(FILE *oldrefs, char **names, int count);
@@ -512,7 +512,7 @@ getoldfile(void)
do {
if (*blockp == NEWFILE) {
skiprefchar();
- putstring(file);
+ putstring(file, PATHLEN);
if (file[0] != '\0') { /* if not end-of-crossref */
return(file);
}
@@ -614,7 +614,7 @@ copydata(void)
/* look for an #included file */
if (*cp == INCLUDE) {
blockp = cp;
- putinclude(symbol);
+ putinclude(symbol, PATHLEN);
writestring(symbol);
setmark('\t');
cp = blockp;
@@ -666,12 +666,12 @@ copyinverted(void)
case NEWFILE: /* file name */
return;
case INCLUDE: /* #included file */
- putinclude(symbol);
+ putinclude(symbol, PATHLEN);
goto output;
}
dbputc(type);
skiprefchar();
- putstring(symbol);
+ putstring(symbol, PATHLEN);
goto output;
}
c = *cp;
@@ -681,7 +681,7 @@ copyinverted(void)
/* if this is a symbol */
if (isalpha((unsigned char)c) || c == '_') {
blockp = cp;
- putstring(symbol);
+ putstring(symbol, PATHLEN);
type = ' ';
output:
putposting(symbol, type);
@@ -712,11 +712,11 @@ movefile(char *new, char *old)
/* process the #included file in the old database */
static void
-putinclude(char *s)
+putinclude(char *s, int len)
{
dbputc(INCLUDE);
skiprefchar();
- putstring(s);
+ putstring(s, len);
incfile(s + 1, s);
}

View File

@ -1,114 +0,0 @@
--- cscope-15.5/src/input.c.orig 2001-07-18 09:49:01.000000000 -0400
+++ cscope-15.5/src/input.c 2007-03-05 11:52:23.000000000 -0500
@@ -43,6 +43,7 @@
#endif
#include <setjmp.h> /* jmp_buf */
#include <stdlib.h>
+#include <errno.h>
#if HAVE_SYS_TERMIOS_H
#include <sys/termios.h>
#endif
@@ -91,8 +92,15 @@ mygetch(void)
c = prevchar;
prevchar = 0;
}
- else
- c = getch(); /* get a character from the terminal */
+ else {
+ c = -1;
+ while (c == -1) {
+ /* get a character from the terminal */
+ c = getch();
+ if((c == -1) && (errno != EINTR))
+ break;
+ }
+ }
}
else { /* longjmp to here from signal handler */
c = KEY_BREAK;
--- cscope-15.5/src/main.c.orig 2003-08-14 10:36:18.000000000 -0400
+++ cscope-15.5/src/main.c 2007-03-05 11:53:59.000000000 -0500
@@ -50,6 +50,7 @@
#endif
#include <sys/types.h> /* needed by stat.h */
#include <sys/stat.h> /* stat */
+#include <signal.h>
/* defaults for unset environment variables */
#define EDITOR "vi"
@@ -120,6 +121,11 @@ static void usage(void);
void fixkeypad();
#endif
+void sigwinch_handler(int sig, siginfo_t *info, void *unused)
+{
+ ungetch(KEY_RESIZE);
+}
+
int
main(int argc, char **argv)
{
@@ -131,12 +137,13 @@ main(int argc, char **argv)
int c, i;
pid_t pid;
struct stat stat_buf;
+ struct sigaction winch_action;
yyin = stdin;
yyout = stdout;
/* save the command name for messages */
argv0 = argv[0];
-
+
/* set the options */
while (--argc > 0 && (*++argv)[0] == '-') {
/* HBB 20030814: add GNU-style --help and --version
@@ -364,6 +371,12 @@ lastarg:
if (linemode == NO)
{
+
+ winch_action.sa_sigaction = sigwinch_handler;
+ sigemptyset(&winch_action.sa_mask);
+ winch_action.sa_flags = SA_SIGINFO;
+ sigaction(SIGWINCH,&winch_action,NULL);
+
(void) signal(SIGINT, SIG_IGN); /* ignore interrupts */
(void) signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */
--- cscope-15.5/src/command.c.orig 2002-07-29 08:37:49.000000000 -0400
+++ cscope-15.5/src/command.c 2007-03-05 11:52:23.000000000 -0500
@@ -80,6 +80,7 @@ command(int commandc)
FILE *file;
struct cmd *curritem, *item; /* command history */
char *s;
+ int lines, cols;
switch (commandc) {
@@ -405,6 +406,25 @@ command(int commandc)
entercurses();
break;
+ case KEY_RESIZE:
+ exitcurses();
+ initscr();
+ entercurses();
+#if TERMINFO
+ (void) keypad(stdscr, TRUE); /* enable the keypad */
+#ifdef HAVE_FIXKEYPAD
+ fixkeypad(); /* fix for getch() intermittently returning garbage */
+#endif
+#endif
+#if UNIXPC
+ standend(); /* turn off reverse video */
+#endif
+ dispinit(); /* initialize display parameters */
+ setfield(); /* set the initial cursor position */
+ postmsg(""); /* clear any build progress message */
+ display(); /* display the version number and input fields */
+ break;
+
case ctrl('L'): /* redraw screen */
#if TERMINFO
case KEY_CLEAR:

View File

@ -1,24 +0,0 @@
diff -up cscope-15.5/src/build.c.orig cscope-15.5/src/build.c
--- cscope-15.5/src/build.c.orig 2008-03-10 14:12:49.000000000 -0400
+++ cscope-15.5/src/build.c 2008-03-10 14:13:32.000000000 -0400
@@ -106,16 +106,17 @@ samelist(FILE *oldrefs, char **names, in
{
char oldname[PATHLEN + 1]; /* name in old cross-reference */
int oldcount;
- int i;
+ int i, matchcnt;
/* see if the number of names is the same */
- if (fscanf(oldrefs, "%d", &oldcount) != 1 ||
+ if (fscanf(oldrefs, "%d\n", &oldcount) != 1 ||
oldcount != count) {
return(NO);
}
/* see if the name list is the same */
for (i = 0; i < count; ++i) {
- if (! fgets(oldname, sizeof(oldname), oldrefs)||
+ matchcnt = fscanf(oldrefs,"%s\n",oldname);
+ if ((! matchcnt) ||
strnotequal(oldname, names[i])) {
return(NO);
}

View File

@ -1,47 +0,0 @@
--- cscope-15.5/src/main.c.orig 2007-03-05 11:59:08.000000000 -0500
+++ cscope-15.5/src/main.c 2007-03-05 11:59:33.000000000 -0500
@@ -102,6 +102,7 @@ BOOL select_large = NO; /* enable more t
#endif
char temp1[PATHLEN + 1]; /* temporary file name */
char temp2[PATHLEN + 1]; /* temporary file name */
+char tempdirpv[PATHLEN +1]; /* private temp directory */
long totalterms; /* total inverted index terms */
BOOL trun_syms; /* truncate symbols to 8 characters */
char tempstring[8192]; /* use this as a buffer, instead of 'yytext',
@@ -138,6 +139,7 @@ main(int argc, char **argv)
pid_t pid;
struct stat stat_buf;
struct sigaction winch_action;
+ mode_t orig_umask;
yyin = stdin;
yyout = stdout;
@@ -337,9 +339,18 @@ lastarg:
}
/* create the temporary file names */
+ orig_umask = umask(S_IRWXG|S_IRWXO);
pid = getpid();
- (void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
- (void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
+ (void) sprintf(tempdirpv, "%s/cscope.%d", tmpdir, pid);
+ if(mkdir(tempdirpv,S_IRWXU))
+ {
+ fprintf(stderr, "cscope: Could not create private temp dir %s\n",tempdirpv);
+ myexit(1);
+ }
+ umask(orig_umask);
+
+ (void) sprintf(temp1, "%s/cscope.1", tempdirpv, pid);
+ (void) sprintf(temp2, "%s/cscope.2", tempdirpv, pid);
/* if running in the foreground */
if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
@@ -847,6 +858,7 @@ myexit(int sig)
if (temp1[0] != '\0') {
(void) unlink(temp1);
(void) unlink(temp2);
+ (void) rmdir(tempdirpv);
}
/* restore the terminal to its original mode */
if (incurses == YES) {

View File

@ -1,22 +1,6 @@
diff -rU4 -N cscope-15.5/src/constants.h cscope-15.5-findassign/src/constants.h
--- cscope-15.5/src/constants.h 2003-09-04 11:54:02.000000000 -0400
+++ cscope-15.5-findassign/src/constants.h 2004-07-01 21:37:42.000000000 -0400
@@ -92,9 +92,9 @@
#define CHANGE 5
#define REGEXP 6
#define FILENAME 7
#define INCLUDES 8
-#define FIELDS 9
+#define FIELDS 11
#if (BSD || V9) && !__NetBSD__
#define TERMINFO 0 /* no terminfo curses */
#else
diff -rU4 -N cscope-15.5/src/display.c cscope-15.5-findassign/src/display.c
--- cscope-15.5/src/display.c 2003-09-04 11:54:02.000000000 -0400
+++ cscope-15.5-findassign/src/display.c 2004-07-01 21:06:47.000000000 -0400
@@ -104,8 +104,9 @@
{"Find this", "egrep pattern", findregexp},
--- cscope-15.6/src/display.c.orig 2006-09-30 04:13:00.000000000 -0400
+++ cscope-15.6/src/display.c 2007-05-25 10:15:14.000000000 -0400
@@ -113,6 +113,7 @@
{"Find this", "file", findfile},
{"Find", "files #including this file", findinclude},
{"Find all", "function definitions", findallfcns}, /* samuel only */
@ -24,12 +8,19 @@ diff -rU4 -N cscope-15.5/src/display.c cscope-15.5-findassign/src/display.c
};
/* Internal prototypes: */
static RETSIGTYPE jumpback(int sig);
diff -rU4 -N cscope-15.5/src/find.c cscope-15.5-findassign/src/find.c
--- cscope-15.5/src/find.c 2003-09-04 11:58:52.000000000 -0400
+++ cscope-15.5-findassign/src/find.c 2004-07-01 22:10:31.000000000 -0400
@@ -76,8 +76,10 @@
static char *lcasify(char *s);
--- cscope-15.6/src/global.h.orig 2006-09-30 04:13:00.000000000 -0400
+++ cscope-15.6/src/global.h 2007-05-25 10:15:14.000000000 -0400
@@ -327,6 +327,7 @@
char *findfile(char *dummy);
char *findinclude(char *pattern);
char *findsymbol(char *pattern);
+char *findassign(char *pattern);
char *findregexp(char *egreppat);
char *findstring(char *pattern);
char *inviewpath(char *file);
--- cscope-15.6/src/find.c.orig 2006-09-30 04:13:00.000000000 -0400
+++ cscope-15.6/src/find.c 2007-05-25 10:15:27.000000000 -0400
@@ -79,6 +79,8 @@
static void findcalledbysub(char *file, BOOL macro);
static void findterm(char *pattern);
static void putline(FILE *output);
@ -38,9 +29,7 @@ diff -rU4 -N cscope-15.5/src/find.c cscope-15.5-findassign/src/find.c
static void putpostingref(POSTING *p, char *pat);
static void putref(int seemore, char *file, char *func);
static void putsource(int seemore, FILE *output);
@@ -85,8 +87,79 @@
@@ -88,6 +90,77 @@
char *
findsymbol(char *pattern)
{
@ -69,7 +58,7 @@ diff -rU4 -N cscope-15.5/src/find.c cscope-15.5-findassign/src/find.c
+ if (asgn_char[i] == blockmark) {
+ /* get the next block when we reach the end of
+ * the current block */
+ asgn_char = readblock();
+ asgn_char = read_block();
+ i=0;
+ }
+ while (isspace((unsigned char) asgn_char[i])) {
@ -118,9 +107,7 @@ diff -rU4 -N cscope-15.5/src/find.c cscope-15.5-findassign/src/find.c
char file[PATHLEN + 1]; /* source file name */
char function[PATLEN + 1]; /* function name */
char macro[PATLEN + 1]; /* macro name */
char symbol[PATLEN + 1]; /* symbol name */
@@ -242,8 +315,16 @@
/* match the rest of the symbol to the text pattern */
@@ -249,6 +322,14 @@
if (matchrest()) {
s = NULL;
matched:
@ -135,17 +122,14 @@ diff -rU4 -N cscope-15.5/src/find.c cscope-15.5-findassign/src/find.c
/* output the file, function or macro, and source line */
if (strcmp(macro, global) && s != macro) {
putref(0, file, macro);
}
diff -rU4 -N cscope-15.5/src/global.h cscope-15.5-findassign/src/global.h
--- cscope-15.5/src/global.h 2003-09-04 11:54:03.000000000 -0400
+++ cscope-15.5-findassign/src/global.h 2004-07-01 21:19:24.000000000 -0400
@@ -318,8 +318,9 @@
char *finddef(char *pattern);
char *findfile(char *dummy);
char *findinclude(char *pattern);
char *findsymbol(char *pattern);
+char *findassign(char *pattern);
char *findregexp(char *egreppat);
char *findstring(char *pattern);
char *inviewpath(char *file);
char *lookup(char *ident);
--- cscope-15.6/src/constants.h.orig 2006-09-30 04:13:00.000000000 -0400
+++ cscope-15.6/src/constants.h 2007-05-25 10:15:14.000000000 -0400
@@ -101,7 +101,7 @@
#define REGEXP 6
#define FILENAME 7
#define INCLUDES 8
-#define FIELDS 9
+#define FIELDS 11
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
# define TERMINFO 0 /* no terminfo curses */

11
cscope-15.6-ocs.patch Normal file
View File

@ -0,0 +1,11 @@
--- cscope-15.6/contrib/ocs.orig1 2006-09-30 04:12:58.000000000 -0400
+++ cscope-15.6/contrib/ocs 2007-05-25 10:04:01.000000000 -0400
@@ -75,7 +75,7 @@
#set the default value for SYSDIR
if [ -z "${SYSDIR}" ]; then
- SYSDIR=/usr/local/lib/cs
+ SYSDIR=/var/run/cs
echo setting default sysdir
fi

View File

@ -0,0 +1,30 @@
--- cscope-15.6/src/main.c.orig 2007-05-25 10:11:02.000000000 -0400
+++ cscope-15.6/src/main.c 2007-05-25 10:12:43.000000000 -0400
@@ -153,12 +153,7 @@
yyout = stdout;
/* save the command name for messages */
argv0 = argv[0];
-#if defined(KEY_RESIZE) && !defined(__DJGPP__)
- winch_action.sa_sigaction = sigwinch_handler;
- sigemptyset(&winch_action.sa_mask);
- winch_action.sa_flags = SA_SIGINFO;
- sigaction(SIGWINCH,&winch_action,NULL);
-#endif
+
/* set the options */
while (--argc > 0 && (*++argv)[0] == '-') {
/* HBB 20030814: add GNU-style --help and --version options */
@@ -400,6 +395,13 @@
}
if (linemode == NO) {
+
+#if defined(KEY_RESIZE) && !defined(__DJGPP__)
+ winch_action.sa_sigaction = sigwinch_handler;
+ sigemptyset(&winch_action.sa_mask);
+ winch_action.sa_flags = SA_SIGINFO;
+ sigaction(SIGWINCH,&winch_action,NULL);
+#endif
signal(SIGINT, SIG_IGN); /* ignore interrupts */
signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */

View File

@ -1,20 +1,5 @@
diff -rU4 -N -p cscope-15.5/doc/Makefile.in cscope-15.5-xcscope/doc/Makefile.in
--- cscope-15.5/doc/Makefile.in 2003-09-04 12:51:25.000000000 -0400
+++ cscope-15.5-xcscope/doc/Makefile.in 2004-07-20 13:49:11.000000000 -0400
@@ -129,9 +129,9 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-man_MANS = cscope.1
+man_MANS = cscope.1 xcscope.1
EXTRA_DIST = $(man_MANS)
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
diff -rU4 -N -p cscope-15.5/doc/xcscope.1 cscope-15.5-xcscope/doc/xcscope.1
--- cscope-15.5/doc/xcscope.1 1969-12-31 19:00:00.000000000 -0500
+++ cscope-15.5-xcscope/doc/xcscope.1 2004-07-20 13:47:48.000000000 -0400
--- /dev/null 2007-05-12 17:40:21.471089444 -0400
+++ cscope-15.6/doc/xcscope.1 2007-05-25 09:45:31.000000000 -0400
@@ -0,0 +1,577 @@
+'\" t
+.\" The xcscope.el man page
@ -593,3 +578,14 @@ diff -rU4 -N -p cscope-15.5/doc/xcscope.1 cscope-15.5-xcscope/doc/xcscope.1
+`cscope-database-file'). You can manually force the file to be
+created by using touch(1) to create a zero-length file; the
+database will be created the next time a search is done.
--- cscope-15.6/doc/Makefile.in.orig 2006-09-30 11:14:57.000000000 -0400
+++ cscope-15.6/doc/Makefile.in 2007-05-25 09:46:04.000000000 -0400
@@ -148,7 +148,7 @@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-man_MANS = cscope.1
+man_MANS = cscope.1 xcscope.1
EXTRA_DIST = $(man_MANS)
all: all-am

View File

@ -1,8 +1,8 @@
Summary: C source code tree search and browse tool
Name: cscope
Version: 15.5
Release: 18%{?dist}
Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.5.tar.gz
Version: 15.6
Release: 1%{?dist}
Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.6.tar.gz
URL: http://cscope.sourceforge.net
License: BSD
Group: Development/Tools
@ -13,18 +13,10 @@ BuildRequires: pkgconfig ncurses-devel flex bison m4
%define xemacs_lisp_path %{_datadir}/xemacs/site-packages/lisp
%define emacs_lisp_path %{_datadir}/emacs/site-lisp
Patch0:cscope-15.5-ocs.patch
Patch1:cscope-15.5-findassign.patch
Patch2:cscope-15.5-ocs-dash_s_fix.patch
Patch3:cscope-15.5-xcscope-man.patch
Patch4:cscope-15.5-inverted.patch
Patch5:cscope-15.5-resize.patch
Patch6:cscope-15.5-tempsec.patch
Patch7:cscope-15.5-inv-overflow.patch
Patch8:cscope-15.5-ocs-sysdir.patch
Patch9:cscope-15.5-putstring-overflow.patch
Patch10: cscope-15.5-fscanf-overflows.patch
Patch11: cscope-15.5-samelist.patch
Patch0:cscope-15.6-findassign.patch
Patch1:cscope-15.6-ocs.patch
Patch2:cscope-15.6-xcscope-man.patch
Patch3:cscope-15.6-sigwinch-linemode.patch
%description
cscope is a mature, ncurses based, C source code tree browsing tool. It
@ -39,14 +31,6 @@ matches for use in file editing.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
%configure
@ -95,14 +79,8 @@ rm -f %{xemacs_lisp_path}/xcscope.el
rm -f %{emacs_lisp_path}/xcscope.el
%changelog
* Mon Mar 10 2008 Neil Horman <nhorman@redhat.com> -15.5-18
- Fix samelist to properly absorb newlines (bz 436648)
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 15.5-17
- Autorebuild for GCC 4.3
* Fri Jan 18 2008 Neil Horman <nhorman@redhat.com> -15.5-16.dist
- Fix revision sillyness & bump rev for rebuild
* Fri Mar 25 2007 Neil Horman <nhorman@redhat.com> -15.6-1.dist
- Rebase to version 15.6
* Mon Mar 05 2007 Neil Horman <nhorman@redhat.com> -15.5-15.4.dist
- Make sigwinch handler only register for curses mode (bz 230862)

View File

@ -1 +1 @@
beb6032a301bb11524aec74bfb5e4840 cscope-15.5.tar.gz
db87833f90d8267b1fc0c419cfc4d219 cscope-15.6.tar.gz