Anonymous avatar Anonymous committed 9a5fe8d

cwd and cw seem to work, cwr needs to be rewritten

Comments (0)

Files changed (2)

 void win(int wd)
-	char in[PATH_MAX], out[PATH_MAX];
+	char cmd[1024];
 	if (wins[wd])
-	strcpy(in,  paths[wd]);
-	strcpy(out, paths[wd]);
-	strcat(in , "/in" );
-	strcat(out, "/out");
+	sprintf(cmd, "cw %s/out %s/in", paths[wd], paths[wd]);
-	printf("about to run urxvt -title %s -e cw %s %s\n", paths[wd], out, in);
+	printf("about to run urxvt -title %s -e cwr %s\n", paths[wd], cmd);
 	if ((wins[wd] = fork()) == 0) {
-		execlp("urxvt", "urxvt", "-title", paths[wd], "-e", "rlwrap", "cw", out, in, NULL);
+		execlp("urxvt", "urxvt", "-title", paths[wd], "-e", "cwr", cmd, NULL);
 		err(1, "failed on execlp cw");
 	} else {
 		printf("child has pid %d\n", wins[wd]);
 			switch (buf[i]) {
 				case '\n' :
+					if (i == 0) {
+						i = -1;
+						break;
+					}
 					for (j = 0; j < i; j++)
 						printf("%s %s", tput_cub, tput_cub);
 					fputs(buf, pipe);
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.