Anonymous avatar Anonymous committed 2a1b78c

cleanup and add -v flag

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;
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
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.