Update of /cvsroot/cscope/cscope/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5194/src
Modified Files:
command.c input.c main.c
Log Message:
Fixing inadvertent exit on window resize (SourceForge Bug 1071236)
Index: command.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/command.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** command.c 27 Oct 2004 11:32:46 -0000 1.24
--- command.c 4 Feb 2005 12:19:08 -0000 1.25
***************
*** 82,85 ****
--- 82,86 ----
struct cmd *curritem, *item; /* command history */
char *s;
+ int lines, cols;
switch (commandc) {
***************
*** 411,414 ****
--- 412,434 ----
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 */
#ifdef KEY_CLEAR
Index: input.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/input.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** input.c 30 Apr 2004 12:09:14 -0000 1.11
--- input.c 4 Feb 2005 12:19:08 -0000 1.12
***************
*** 44,47 ****
--- 44,48 ----
#include <setjmp.h> /* jmp_buf */
#include <stdlib.h>
+ #include <errno.h>
#if HAVE_SYS_TERMIOS_H
#include <sys/termios.h>
***************
*** 89,94 ****
c = prevchar;
prevchar = 0;
! } else
! c = getch(); /* get a character from the terminal */
} else { /* longjmp to here from signal handler */
c = KEY_BREAK;
--- 90,102 ----
c = prevchar;
prevchar = 0;
! } 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;
Index: main.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/main.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** main.c 6 Dec 2004 14:56:43 -0000 1.34
--- main.c 4 Feb 2005 12:19:08 -0000 1.35
***************
*** 51,54 ****
--- 51,55 ----
#include <sys/types.h> /* needed by stat.h */
#include <sys/stat.h> /* stat */
+ #include <signal.h>
/* defaults for unset environment variables */
***************
*** 122,125 ****
--- 123,131 ----
#endif
+ void sigwinch_handler(int sig, siginfo_t *info, void *unused)
+ {
+ ungetch(KEY_RESIZE);
+ }
+
int
main(int argc, char **argv)
***************
*** 133,136 ****
--- 139,143 ----
pid_t pid;
struct stat stat_buf;
+ struct sigaction winch_action;
mode_t orig_umask;
***************
*** 140,143 ****
--- 147,155 ----
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] == '-') {
|