cscope/cscope-15.5-resize.patch

115 lines
2.9 KiB
Diff
Raw Normal View History

2004-11-22 21:51:21 +00:00
--- cscope-15.5/src/input.c.orig 2001-07-18 09:49:01.000000000 -0400
2007-03-05 18:15:00 +00:00
+++ cscope-15.5/src/input.c 2007-03-05 11:52:23.000000000 -0500
2004-11-22 21:51:21 +00:00
@@ -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
2007-03-05 18:15:00 +00:00
@@ -91,8 +92,15 @@ mygetch(void)
2004-11-22 21:51:21 +00:00
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
2007-03-05 18:15:00 +00:00
+++ cscope-15.5/src/main.c 2007-03-05 11:53:59.000000000 -0500
2004-11-22 21:51:21 +00:00
@@ -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"
2007-03-05 18:15:00 +00:00
@@ -120,6 +121,11 @@ static void usage(void);
2004-11-22 21:51:21 +00:00
void fixkeypad();
#endif
+void sigwinch_handler(int sig, siginfo_t *info, void *unused)
+{
+ ungetch(KEY_RESIZE);
2004-11-22 21:51:21 +00:00
+}
+
int
main(int argc, char **argv)
{
2007-03-05 18:15:00 +00:00
@@ -131,12 +137,13 @@ main(int argc, char **argv)
2004-11-22 21:51:21 +00:00
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];
2007-03-05 18:15:00 +00:00
-
2004-11-22 21:51:21 +00:00
+
/* set the options */
while (--argc > 0 && (*++argv)[0] == '-') {
/* HBB 20030814: add GNU-style --help and --version
2007-03-05 18:15:00 +00:00
@@ -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: