adding resize patch for bz139938
This commit is contained in:
		
							parent
							
								
									79b1fc9930
								
							
						
					
					
						commit
						067719aa63
					
				
							
								
								
									
										112
									
								
								cscope-15.5-resize.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								cscope-15.5-resize.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,112 @@ | ||||
| --- cscope-15.5/src/input.c.orig	2001-07-18 09:49:01.000000000 -0400
 | ||||
| +++ cscope-15.5/src/input.c	2004-11-22 14:43:09.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 @@
 | ||||
|  			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/display.c.orig	2004-11-22 14:42:32.000000000 -0500
 | ||||
| +++ cscope-15.5/src/display.c	2004-11-22 14:43:05.000000000 -0500
 | ||||
| @@ -129,6 +129,15 @@
 | ||||
|  	if (mouse == NO && mdisprefs > strlen(dispchars)) | ||||
|  		mdisprefs = strlen(dispchars); | ||||
|   | ||||
| +	/*
 | ||||
| +	 *this function can be called from a signal handler 
 | ||||
| +	 *as well as the main routine, meaning we might need
 | ||||
| +	 *to free memory that we alloc later in here to avoid 
 | ||||
| +	 *a leak
 | ||||
| +	 */
 | ||||
| +	if(displine)
 | ||||
| +		free(displine);
 | ||||
| +
 | ||||
|  	/* allocate the displayed line array */ | ||||
|  	displine = mymalloc(mdisprefs * sizeof(int)); | ||||
|  } | ||||
| --- cscope-15.5/src/main.c.orig	2003-08-14 10:36:18.000000000 -0400
 | ||||
| +++ cscope-15.5/src/main.c	2004-11-22 14:45:21.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,34 @@
 | ||||
|  void	fixkeypad(); | ||||
|  #endif | ||||
|   | ||||
| +/*
 | ||||
| + *this handler gets called every time the terminal size changes
 | ||||
| + *basically all it does is tear down ncurses, and re-initalizes 
 | ||||
| + *it, allowing it to repaint the screen at the new dimensions
 | ||||
| + *There may well be a more elegant way to do this, but this is
 | ||||
| + *pretty straightforward, and isn't very intrusive.
 | ||||
| + */
 | ||||
| +void sigwinch_handler(int sig, siginfo_t *info, void *unused)
 | ||||
| +{
 | ||||
| +	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
 | ||||
| +	postmsg("");
 | ||||
| +	dispinit();	/* initialize display parameters */
 | ||||
| +	setfield();	/* set the initial cursor position */
 | ||||
| +	postmsg("");	/* clear any build progress message */
 | ||||
| +	display();	/* display the version number and input fields */
 | ||||
| +}
 | ||||
| +
 | ||||
|  int | ||||
|  main(int argc, char **argv) | ||||
|  { | ||||
| @@ -131,12 +160,20 @@
 | ||||
|  	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;
 | ||||
| +	winch_action.sa_restorer = NULL;
 | ||||
| +
 | ||||
| +	sigaction(SIGWINCH,&winch_action,NULL);	
 | ||||
| +
 | ||||
|  	/* set the options */ | ||||
|  	while (--argc > 0 && (*++argv)[0] == '-') { | ||||
|  		/* HBB 20030814: add GNU-style --help and --version | ||||
| @ -18,6 +18,7 @@ Patch1:cscope-15.5-findassign.patch | ||||
| Patch2:cscope-15.5-ocs-dash_s_fix.patch | ||||
| Patch3:cscope-15.5-xcscope-man.patch | ||||
| Patch4:cscope-15.5-inverted.patch | ||||
| Patch5:cscope-15.5-resize.patch | ||||
| 
 | ||||
| %description | ||||
| cscope is a mature, ncurses based, C source code tree browsing tool.  It  | ||||
| @ -33,6 +34,7 @@ matches for use in file editing. | ||||
| %patch2 -p1 | ||||
| %patch3 -p1 | ||||
| %patch4 -p1 | ||||
| %patch5 -p1 | ||||
| 
 | ||||
| %build | ||||
| %configure | ||||
| @ -81,8 +83,9 @@ rm -f %{xemacs_lisp_path}/xcscope.el | ||||
| rm -f %{emacs_lisp_path}/xcscope.el | ||||
| 
 | ||||
| %changelog | ||||
| * Mon Nov 15 2004 Frank Ch. Eigler <fche@redhat.com> | ||||
| - dummy version bump after RHEL3 fork | ||||
| * Mon Nov 22 2004 Neil Horman <nhorman@redhat.com> | ||||
| - added cscope-1.5.-resize patch to allow terminal | ||||
|   resizing while cscope is running | ||||
| 
 | ||||
| * Tue Oct 5  2004 Neil Horman <nhorman@redhat.com> | ||||
| - modified cscope-15.5.-inverted patch to be upstream | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user