Ticket #18239: winchpatch

File winchpatch, 1.3 KB (added by jcduell@…, 16 years ago)

patch to fix cscope sigwinch crashes. Applies to src/main.c

Line 
1--- src/main.c  2006-09-30 01:13:00.000000000 -0700
2+++ /Users/jduell/cscope/cscope/src/main.c      2008-04-11 04:23:55.000000000 -0700
3@@ -127,9 +127,10 @@
4 {
5     (void) sig;
6     (void) info;
7     (void) unused;
8-    ungetch(KEY_RESIZE);
9+    if(incurses == YES)
10+        ungetch(KEY_RESIZE);
11 }
12 #endif
13 
14 int
15@@ -152,14 +153,9 @@
16     yyin = stdin;
17     yyout = stdout;
18     /* save the command name for messages */
19     argv0 = argv[0];
20-#if defined(KEY_RESIZE) && !defined(__DJGPP__)
21-    winch_action.sa_sigaction = sigwinch_handler;
22-    sigemptyset(&winch_action.sa_mask);
23-    winch_action.sa_flags = SA_SIGINFO;
24-    sigaction(SIGWINCH,&winch_action,NULL);
25-#endif
26+
27     /* set the options */
28     while (--argc > 0 && (*++argv)[0] == '-') {
29        /* HBB 20030814: add GNU-style --help and --version options */
30        if (strequal(argv[0], "--help")
31@@ -402,8 +401,15 @@
32     if (linemode == NO) {
33        signal(SIGINT, SIG_IGN);        /* ignore interrupts */
34        signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */
35 
36+#if defined(KEY_RESIZE) && !defined(__DJGPP__)
37+       winch_action.sa_sigaction = sigwinch_handler;
38+       sigemptyset(&winch_action.sa_mask);
39+       winch_action.sa_flags = SA_SIGINFO;
40+       sigaction(SIGWINCH,&winch_action,NULL);
41+#endif
42+
43        /* initialize the curses display package */
44        initscr();      /* initialize the screen */
45        entercurses();
46 #if TERMINFO