Robert Lowry avatar Robert Lowry committed ca0f075

more pcw refactoring, still completely broken

Comments (0)

Files changed (1)

 
 void spawn_win(watch_t *w)
 {
-	
+	char out[PATH_MAX], in[PATH_MAX], path[PATH_MAX], channel[32];
+	//char *cmd[] = CMD;
+
+	strcpy(path,w->path);
+	snprintf(channel,sizeof(channel),basename(path));
+	snprintf(out,sizeof(out),"%s/out",w->path);
+	snprintf(in,sizeof(in),"%s/in",w->path);
 }
 
 #ifdef HAVE_INOTIFY
 }
 #endif
 
+/*
 int find(int *haystack, int needle, int len)
 {
 	int i;
 
 	return -1;
 }
+*/
 
 void sigchld(int unused) {
 	pid_t pid;
-	int wd;
+	//int wd;
+	watch_t *w;
 
 	while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
-		if ((wd = find(wins, pid, MAX_WATCH)) > -1)
-			wins[wd] = 0;
+		//if ((wd = find(wins, pid, MAX_WATCH)) > -1)
+		//	wins[wd] = 0;
+		for (w = watch; w; w = watch->next) {
+			if (w->pid == pid) {
+				w->pid = 0;
+			}
+		}
 	}
 }
 
 	char buf[4096];
 	int len;
 	struct inotify_event *cur;
-	watch *w;
+	watch_t *w;
 
 	if ((evq = inotify_init()) < 0)
 		err(1, "failed on inotify_init()");
 	if (signal(SIGCHLD, sigchld) == SIG_ERR)
 		err(1, "failed installing SIGCHLD handler");
 
+	run_inotify(argv[1]);
+
 	return 0;
 }
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.