Update of /cvsroot/cscope/cscope/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4086
Modified Files:
command.c
Log Message:
* Renamed global variable 'pattern' to 'Pattern' to reduce name clashes
with local variables
* Check existence of KEY_* macros themselves when using them, not the
blanket definition TERMINFO.
Index: command.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/command.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** command.c 30 Apr 2004 12:09:14 -0000 1.22
--- command.c 30 Apr 2004 15:24:18 -0000 1.23
***************
*** 56,60 ****
BOOL changing; /* changing text */
char newpat[PATLEN + 1]; /* new pattern */
! char pattern[PATLEN + 1]; /* symbol or text pattern */
static char appendprompt[] = "Append to file: ";
--- 56,62 ----
BOOL changing; /* changing text */
char newpat[PATLEN + 1]; /* new pattern */
! /* HBB 20040430: renamed to avoid lots of clashes with function arguments
! * also named 'pattern' */
! char Pattern[PATLEN + 1]; /* symbol or text pattern */
static char appendprompt[] = "Append to file: ";
***************
*** 175,179 ****
return(NO);
! #if TERMINFO
case KEY_ENTER:
#endif
--- 177,181 ----
return(NO);
! #ifdef KEY_ENTER
case KEY_ENTER:
#endif
***************
*** 188,193 ****
case ctrl('N'):
! #if TERMINFO
case KEY_DOWN:
case KEY_RIGHT:
#endif
--- 190,197 ----
case ctrl('N'):
! #ifdef KEY_DOWN
case KEY_DOWN:
+ #endif
+ #ifdef KEY_RIGHT
case KEY_RIGHT:
#endif
***************
*** 210,215 ****
case ctrl('P'): /* go to previous input field */
! #if TERMINFO
case KEY_UP:
case KEY_LEFT:
#endif
--- 214,221 ----
case ctrl('P'): /* go to previous input field */
! #ifdef KEY_UP
case KEY_UP:
+ #endif
+ #ifdef KEY_LEFT
case KEY_LEFT:
#endif
***************
*** 230,234 ****
}
return(NO);
! #if TERMINFO
case KEY_HOME: /* go to first input field */
if (selecting)
--- 236,240 ----
}
return(NO);
! #ifdef KEY_HOME
case KEY_HOME: /* go to first input field */
if (selecting)
***************
*** 261,269 ****
}
return(NO);
! #endif
case ' ': /* display next page */
case '+':
case ctrl('V'):
! #if TERMINFO
case KEY_NPAGE:
#endif
--- 267,275 ----
}
return(NO);
! #endif /* def(KEY_HOME) */
case ' ': /* display next page */
case '+':
case ctrl('V'):
! #ifdef KEY_NPAGE
case KEY_NPAGE:
#endif
***************
*** 281,285 ****
case ctrl('H'):
case '-': /* display previous page */
! #if TERMINFO
case KEY_PPAGE:
#endif
--- 287,291 ----
case ctrl('H'):
case '-': /* display previous page */
! #ifdef KEY_PPAGE
case KEY_PPAGE:
#endif
***************
*** 407,411 ****
case ctrl('L'): /* redraw screen */
! #if TERMINFO
case KEY_CLEAR:
#endif
--- 413,417 ----
case ctrl('L'): /* redraw screen */
! #ifdef KEY_CLEAR
case KEY_CLEAR:
#endif
***************
*** 433,438 ****
case ctrl('Y'): /* repeat last pattern */
! if (*pattern != '\0') {
! (void) addstr(pattern);
goto repeat;
}
--- 439,444 ----
case ctrl('Y'): /* repeat last pattern */
! if (*Pattern != '\0') {
! (void) addstr(Pattern);
goto repeat;
}
***************
*** 455,459 ****
atfield();
(void) addstr(item->text);
! (void) strcpy(pattern, item->text);
switch (c = mygetch()) {
case '\r':
--- 461,465 ----
atfield();
(void) addstr(item->text);
! (void) strcpy(Pattern, item->text);
switch (c = mygetch()) {
case '\r':
***************
*** 468,473 ****
default:
(void) myungetch(c);
! if (mygetline(pattern, newpat, COLS - fldcolumn - 1, '\0', caseless )) {
! strcpy (pattern, newpat);
resetcmd();
}
--- 474,479 ----
default:
(void) myungetch(c);
! if (mygetline(Pattern, newpat, COLS - fldcolumn - 1, '\0', caseless )) {
! strcpy (Pattern, newpat);
resetcmd();
}
***************
*** 506,513 ****
ispat: if (getline(newpat, COLS - fldcolumn - 1, commandc,
caseless) > 0) {
! (void) strcpy(pattern, newpat);
resetcmd(); /* reset command history */
repeat:
! addcmd(field, pattern); /* add to command history */
if (field == CHANGE) {
--- 512,519 ----
ispat: if (getline(newpat, COLS - fldcolumn - 1, commandc,
caseless) > 0) {
! (void) strcpy(Pattern, newpat);
resetcmd(); /* reset command history */
repeat:
! addcmd(field, Pattern); /* add to command history */
if (field == CHANGE) {
***************
*** 628,632 ****
/* get a character from the terminal */
! if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) {
break; /* change lines */
}
--- 634,640 ----
/* get a character from the terminal */
! if ((c = mygetch()) == EOF
! || c == ctrl('D')
! || c == ctrl('Z')) {
break; /* change lines */
}
***************
*** 636,644 ****
case '+':
case ctrl('V'):
! #if TERMINFO
case KEY_NPAGE:
#endif
case '-': /* display previous page */
! #if TERMINFO
case KEY_PPAGE:
#endif
--- 644,652 ----
case '+':
case ctrl('V'):
! #ifdef KEY_NPAGE
case KEY_NPAGE:
#endif
case '-': /* display previous page */
! #ifdef KEY_PPAGE
case KEY_PPAGE:
#endif
***************
*** 649,653 ****
case ctrl('L'): /* redraw screen */
! #if TERMINFO
case KEY_CLEAR:
#endif
--- 657,661 ----
case ctrl('L'): /* redraw screen */
! #ifdef KEY_CLEAR
case KEY_CLEAR:
#endif
***************
*** 743,747 ****
/* output substitute command */
(void) fprintf(script, "%ss/", linenum); /* change */
! for (s = pattern; *s != '\0'; ++s) { /* old text */
if (strchr("/\\[.^*", *s) != NULL) {
(void) putc('\\', script);
--- 751,756 ----
/* output substitute command */
(void) fprintf(script, "%ss/", linenum); /* change */
! for (s = Pattern; *s != '\0'; ++s) {
! /* old text */
if (strchr("/\\[.^*", *s) != NULL) {
(void) putc('\\', script);
|