Commits

Evan Gates committed 2a1b78c

cleanup and add -v flag

  • Participants
  • Parent commits 18a44b3

Comments (0)

Files changed (1)

+#include <unistd.h>
+#include <err.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
 	kill(getpid(), SIGINT);
 }
 
-void my_write(int fd, const void *buf, size_t count)
+void my_write(int fd, const char *buf, size_t count)
 {
 	int i, wrlen;
 
 		switch (argv[i][1]) {
 			case 'p' : nrml_prompt = argv[++i]; break;
 			case 'P' : scrl_prompt = argv[++i]; break;
+			case 'v' : printf("srw-"VERSION" © Evan Gates\n"); exit(1);
 			default  : usage();
 		}
 	}
 	set.c_lflag &= ~ECHO;
 
 	if (signal(SIGCHLD, sigchld) == SIG_ERR)
-		err("failed to install SIGCHLD handler");
+		err(1, "failed to install SIGCHLD handler");
 
 	if (forkpty(&mfd, NULL, &set, NULL) == 0) { //child
 		execvp(argv[i], &argv[i]);
-		err("failed execvp %s", argv[i]);
+		err(1, "failed execvp %s", argv[i]);
 	}
 
 	// read one character at a time;