Commits

Anonymous committed b051045

make sure server dirs exist in chat.sh, fix some alignment in cw_color.sh, switch to script instead of config.h

  • Participants
  • Parent commits bb619a2

Comments (0)

Files changed (3)

 	echo "starting $serv"
 	echo "find log in $PREFIX/$serv/log"
 	echo "commands $commands"
+	[ -d "$PREFIX/$serv" ] || mkdir "$PREFIX/$serv"
 
 	{
 		echo

extras/cw_color.sh

 			str  = substr(line, 1, cols);
 			line = substr(line, cols + 1);
 		} else {
-			str = sprintf("%*s | %s", marg - 4, "", substr(line, 1, cols - marg + 1));
+			if (act == 1)
+				str = sprintf("%*s %s%s", marg - 1, "", act_fmt, substr(line, 1, cols - marg + 1));
+			else if (srv == 1)
+				str = sprintf("%*s%s!  %s", marg - 4, "", srv_fmt, substr(line, 1, cols - marg + 1));
+			else
+				str = sprintf("%*s | %s", marg - 4, "", substr(line, 1, cols - marg + 1));
 			line = substr(line, cols - marg + 2);
 		}
 
 #include <sys/inotify.h>
 #include <sys/wait.h>
 
-#include "config.h" // for win_cmd()
-
 // fairly arbitray values...feel free to change
 #define PATH_MAX    256
 #define MAX_OPENFD  4
 void win(struct watch *w)
 {
 	int fd = 0;
-	char out[PATH_MAX], in[PATH_MAX], path[PATH_MAX], channel[32], n[32];
+	char out[PATH_MAX], in[PATH_MAX];
+	char *cmd[] = { "pcw_win.sh", w->path, out, in, nick, NULL };
 
 	if (w->pid)
 		return;
 		return;
 
 	close(fd);
-	strcpy(path, w->path); // stupid basename messing with my strings
-	strncpy(channel, basename(path), sizeof(channel));
-	strcpy(path, w->path); // stupid basename messing with my strings
-	strncpy(n, nick, sizeof(n));
 
-	if ((w->pid = fork()) == 0)
-		win_cmd(path, channel, out, in, n); // from config.h
+	if ((w->pid = fork()) == 0) {
+		execvp(cmd[0], cmd);
+		err(1, "failed on execvp %s", cmd[0]);
+	}
 }
 
 int main(int argc, char **argv)