Resolves: bz 230862

This commit is contained in:
Neil Horman 2007-03-05 18:15:00 +00:00
parent 8c96a4676a
commit 6eb1cd792b
5 changed files with 192 additions and 182 deletions

View File

@ -1,6 +1,6 @@
--- cscope-15.5/src/display.c.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/display.c 2006-08-23 10:19:41.000000000 -0400
@@ -217,7 +217,7 @@
--- 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 */
@ -9,9 +9,80 @@
linenum, tempstring) < 4) {
break;
}
--- cscope-15.5/src/input.c.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/input.c 2006-08-23 10:57:01.000000000 -0400
@@ -293,16 +293,15 @@
--- 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");
@ -33,7 +104,7 @@
out += strlen(out);
}
}
@@ -322,11 +321,11 @@
@@ -322,11 +321,11 @@ shellpath(char *out, int limit, char *in
*s = '\0';
/* get its value */
@ -48,51 +119,9 @@
out += strlen(out);
}
}
--- cscope-15.5/src/edit.c.orig 2001-07-18 09:49:01.000000000 -0400
+++ cscope-15.5/src/edit.c 2006-08-23 10:16:30.000000000 -0400
@@ -60,7 +60,7 @@
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 @@
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/command.c.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/command.c 2006-08-23 10:08:50.000000000 -0400
@@ -727,7 +727,7 @@
(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/dir.c.orig 2003-06-02 06:43:00.000000000 -0400
+++ cscope-15.5/src/dir.c 2006-08-23 10:09:20.000000000 -0400
@@ -319,7 +319,7 @@
/* 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/main.c.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/main.c 2006-08-23 11:26:48.000000000 -0400
@@ -102,10 +102,10 @@
--- 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 */
@ -105,7 +134,7 @@
* which had better be left alone */
char *tmpdir; /* temporary directory */
@@ -270,6 +270,13 @@
@@ -264,6 +264,13 @@ main(int argc, char **argv)
s[11] = '\0';
}
#endif
@ -119,7 +148,7 @@
s = path + strlen(path);
(void) strcpy(s, ".in");
invname = stralloc(path);
@@ -491,11 +498,11 @@
@@ -491,11 +498,11 @@ lastarg:
|| (names = vpfopen(NAMEFILE, "r")) != NULL) {
/* read any -p option from it */
@ -133,7 +162,7 @@
s = path;
}
switch (i) {
@@ -512,7 +519,7 @@
@@ -512,7 +519,7 @@ lastarg:
}
else {
for (i = 0; i < nsrcfiles; ++i) {
@ -142,8 +171,19 @@
posterr("cscope: cannot read source file name from file %s\n", reffile);
myexit(1);
}
--- cscope-15.5/src/constants.h.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/constants.h 2006-08-23 10:16:30.000000000 -0400
--- 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 */
@ -166,43 +206,3 @@
/* screen lines */
#define FLDLINE (LINES - FIELDS - 1) /* first input field line */
#define MSGLINE 0 /* message line */
--- cscope-15.5/src/build.c.orig 2006-08-23 07:08:40.000000000 -0400
+++ cscope-15.5/src/build.c 2006-08-23 11:17:57.000000000 -0400
@@ -115,7 +115,7 @@
}
/* 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 @@
/* 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 @@
/* 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 @@
}
/* 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);

View File

@ -1,7 +1,6 @@
diff -Nur cscope-15.5-orig/contrib/ocs cscope-15.5/contrib/ocs
--- cscope-15.5-orig/contrib/ocs 2001-07-18 15:48:56.000000000 +0200
+++ cscope-15.5/contrib/ocs 2004-07-03 23:08:38.000000000 +0200
@@ -107,7 +107,7 @@
--- 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

View File

@ -1,6 +1,84 @@
--- cscope-15.5/src/command.c.orig 2004-11-26 21:21:46.523695928 -0500
+++ cscope-15.5/src/command.c 2004-11-26 21:30:35.322306320 -0500
@@ -80,6 +80,7 @@
--- 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;
@ -8,7 +86,7 @@
switch (commandc) {
@@ -405,6 +406,25 @@
@@ -405,6 +406,25 @@ command(int commandc)
entercurses();
break;
@ -34,73 +112,3 @@
case ctrl('L'): /* redraw screen */
#if TERMINFO
case KEY_CLEAR:
--- cscope-15.5/src/input.c.orig 2001-07-18 09:49:01.000000000 -0400
+++ cscope-15.5/src/input.c 2004-11-26 21:18:09.526684488 -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 @@
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 2004-11-26 21:27:12.506139064 -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 @@
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,19 @@
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];
+ winch_action.sa_sigaction = sigwinch_handler;
+ sigemptyset(&winch_action.sa_mask);
+ winch_action.sa_flags = SA_SIGINFO;
+
+ sigaction(SIGWINCH,&winch_action,NULL);
+
/* set the options */
while (--argc > 0 && (*++argv)[0] == '-') {
/* HBB 20030814: add GNU-style --help and --version

View File

@ -1,6 +1,6 @@
--- cscope-15.5/src/main.c.orig 2004-11-30 10:47:56.000000000 -0500
+++ cscope-15.5/src/main.c 2004-11-30 12:58:13.000000000 -0500
@@ -102,6 +102,7 @@
--- 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 */
@ -8,7 +8,7 @@
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 @@
@@ -138,6 +139,7 @@ main(int argc, char **argv)
pid_t pid;
struct stat stat_buf;
struct sigaction winch_action;
@ -16,7 +16,7 @@
yyin = stdin;
yyout = stdout;
@@ -344,9 +346,18 @@
@@ -337,9 +339,18 @@ lastarg:
}
/* create the temporary file names */
@ -37,7 +37,7 @@
/* if running in the foreground */
if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
@@ -848,6 +859,7 @@
@@ -847,6 +858,7 @@ myexit(int sig)
if (temp1[0] != '\0') {
(void) unlink(temp1);
(void) unlink(temp2);

View File

@ -1,7 +1,7 @@
Summary: C source code tree search and browse tool
Name: cscope
Version: 15.5
Release: 15.3%{?dist}
Release: 15.4%{?dist}
Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.5.tar.gz
URL: http://cscope.sourceforge.net
License: BSD
@ -93,6 +93,9 @@ rm -f %{xemacs_lisp_path}/xcscope.el
rm -f %{emacs_lisp_path}/xcscope.el
%changelog
* Mon Mar 05 2007 Neil Horman <nhorman@redhat.com> -15.5-15.4.dist
- Make sigwinch handler only register for curses mode (bz 230862)
* Mon Feb 05 2007 Neil Horman <nhorman@redhat.com> -15.5-15.3.dist
- Fixing dist label in release tag.