Commits

Anonymous committed dfe417c

changes?

Comments (0)

Files changed (2)

 	if ((in_wd = inotify_add_watch(evq, argv[1], IN_MODIFY)) < 0)
 		err(1, "failed inotify_add_watch()");
 
+	warnx("Opening %s (if it's a fifo, waiting for other side to be opened)...", argv[1]);
+
 	if ((in = fopen(argv[1], "r")) == NULL)
 		err(1, "failed fopen()");
 
+	warnx("...OK");
+
 	if (stat(argv[2], &st) < 0 && errno == ENOENT && mkfifo(argv[2], 0700) < 0)
 		err(1, "failed to mkfifo %s\n", argv[2]);
 
 	while (fgets(buf, sizeof(buf), in))
 		fputs(buf, stdout);
 
-	fputs("NOTICE: waiting for other side to open out fifo...\n", stdout);
-	fflush(stdout);
+	warnx("Opening %s (if it's a fifo, waiting for other side to be opened)...", argv[2]);
 
 	if ((out = fopen(argv[2], "w")) == NULL)
 		err(1, "failed fopen()");
 
-	fputs("...OK\n", stdout);
-	fflush(stdout);
+	warnx("...OK");
+
+	printf("-------------------- new text starts here --------------------\n");
 
 	for (;;) {
 		FD_ZERO(&rd);
 
 void win(int wd)
 {
-	char in[1024], out[1024];
+	char path[PATH_MAX], out[PATH_MAX], in[PATH_MAX];
+	char *wincmd[] = {"urxvt", "-title", paths[wd], "-e", "srw", "cw", out, in, NULL};
 
 	if (wins[wd])
 		return;
 	sprintf(out, "%s/out", paths[wd]);
 	sprintf(in,  "%s/in",  paths[wd]);
 
-	printf("about to run urxvt -title %s -e srw cw %s %s\n", paths[wd], out, in);
+	printf("about to exec\n");
 
 	if ((wins[wd] = fork()) == 0) {
-		execlp("urxvt", "urxvt", "-title", paths[wd], "-e", "srw", "cw", out, in, NULL);
+		execvp(wincmd[0], wincmd);
 		err(1, "failed on execlp cw");
 	} else {
 		printf("child has pid %d\n", wins[wd]);
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 ProjectModifiedEvent.java.
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.