Anonymous avatar Anonymous committed 7413bb4

add -w for passing SIGWINCHs

Comments (0)

Files changed (2)

 .SY srw
 .OP \-p prompt
 .OP \-v
+.OP \-w
 .I cmd
 .RI [ args... ]
 .YS
 .TP
 .B \-v
 print version information and exit
+.TP
+.B \-w
+pass along SIGWINCHs to the child
 
 .SH USAGE
 srw supports the usual arrow keys, Home, End, Delete, as well as the following shortcuts
 static void quit(int sig);
 static void run(void);
 static void sigchld(int unused);
-static void sigwinch(int unused);
+static void sigwinch(int sig);
 static int  start_pos(int start, int cur, int len, int cols);
 static void stop(int unused);
 static void term_set(int unused);
 static int mfd;
 static pid_t child;
 static struct winsize ws;
+static int winch = 0;
 
 static struct termios set, dfl;
 
 	}
 }
 
-void sigwinch(int unused)
+void sigwinch(int sig)
 {
+	if (!winch && sig == SIGWINCH)
+		return;
+
 	if (ioctl(STDOUT, TIOCGWINSZ, &ws) < 0)
 		err(1, "failed ioctl");
 
 		switch (argv[i][1]) {
 			case 'p' : nrml_prompt = argv[++i]; break;
 			case 'v' : printf("srw-"VERSION" © Evan Gates\n"); exit(1);
+			case 'w' : winch = 1; break;
 			default  : usage();
 		}
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.