1. Evan Gates
  2. srw

Source

srw / srw.c

Diff from to

File srw.c

 
 void usage(void)
 {
-	printf("Usage: srw [-p prompt] [-v] [-w] cmd [args]...\n");
+	printf("Usage: srw [-l] [-p prompt] [-v] [-w] cmd [args]...\n");
 	exit(1);
 }
 
 int main(int argc, char **argv)
 {
-	int i;
+	int i, late_start = 0;
 
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-')
 			case 'p' : nrml_prompt = argv[++i]; break;
 			case 'v' : printf("srw-"VERSION" © Evan Gates\n"); exit(1);
 			case 'w' : winch = 1; break;
+			case 'l' : late_start++; break;
 			default  : usage();
 		}
 	}
 	if (ioctl(STDOUT, TIOCGWINSZ, &ws) < 0)
 		err(1, "failed ioctl");
 
+	if (late_start)
+		sleep(late_start);
+
 	if ((child = forkpty(&mfd, NULL, &set, &ws)) == 0) { //child
 		execvp(argv[i], &argv[i]);
 		err(1, "failed execvp %s", argv[i]);
 		if (signal(sig_table[i].sig, sig_table[i].func) == SIG_ERR)
 			err(1, "failed to install %s handler", sig_table[i].name);
 
+	sigwinch(0);
 	print_usr();
 	run();