Commits

Anonymous committed 6223b09

make copies of path and nick to pass to function in config.h because I can't figure out how to make const work correctly and we don't want people screwing with them
change cw_color to omit date, color time and server messages blue, and do ctcp actions a little better

Comments (0)

Files changed (2)

extras/cw_color.sh

 	shift 2
 done
 
+# in order, do
+# change notice continuation lines: remove the 11 characters the date would take, color the rest of the line blue
+# change normal continuation lines: remove the 11 characters the date would take
+# change notice lines: remove date, color blue
+# change CTCP ACTION lines: remove date, color time blue, color nick cyan, use * instead of MARGIN, repeat nick cyan
+# change normal lines: remove date, color time blue, colur nick cyan
+# change lines that are as of yet unmatched: remove date, color time blue
+# color nick red found anywhere
+
 cw "$IN" "$OUT" "$MARGIN" |
 	sed \
-		-e "s/^ *!/${magenta}& ${reset}/" \
-		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *-\?!-\?\)/${yellow}\1 ${green}\2${reset}${magenta}\3${reset}/" \
-		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *<\?\)\( *[^ $MARGIN]* \?\)\([$MARGIN]\) ACTION/${yellow}\1 ${green}\2${reset}\3${cyan}\4${reset}*/" \
-		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *<\?\)\( *[^ $MARGIN]* \?\)\([$MARGIN]\)/${yellow}\1 ${green}\2${reset}\3${cyan}\4${reset}\5/" \
-		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)/${yellow}\1 ${green}\2${reset}/" \
+		-e "s/^ \{11\}\( *!.*\)$/${blue}\1${reset}/" \
+		-e "s/^ \{11\}\( *[$MARGIN]\)/\1/" \
+		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *-\?!-\?.*\)$/${blue}\2\3${reset}/" \
+		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\) ACTION/${blue}\2${reset}\3${cyan}\4 ${reset}* ${cyan}\4${reset}/" \
+		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\)/${blue}\2${reset}\3${cyan}\4${reset}\5/" \
+		-e "s/^\([-0-9]\{10,10\}\) \([:0-9]\{5,5\}\)/${blue}\2${reset}/" \
 		-e "s/$NICK/\a${red}&${reset}/g" 
 
 # vim: set ts=4 sw=4 noexpandtab:
 void win(struct watch *w)
 {
 	int fd = 0;
-	char out[PATH_MAX], in[PATH_MAX], path[PATH_MAX], channel[32];
+	char out[PATH_MAX], in[PATH_MAX], path[PATH_MAX], channel[32], n[32];
 
 	if (w->pid)
 		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(w->path, channel, out, in, nick); // from config.h
+		win_cmd(path, channel, out, in, n); // from config.h
 }
 
 int main(int argc, char **argv)