Evan Gates  committed 7413bb4

add -w for passing SIGWINCHs

  • Participants
  • Parent commits 4de63ff
  • Branches default

Comments (0)

Files changed (2)

 .SY srw
 .OP \-p prompt
 .OP \-v
+.OP \-w
 .I cmd
 .RI [ args... ]
 .B \-v
 print version information and exit
+.B \-w
+pass along SIGWINCHs to the child
 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();