summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-08-20 16:33:12 -0400
committerJune McEnroe <june@causal.agency>2021-08-20 16:33:12 -0400
commit6fc2271398fbbe271f06f9ba1e2997810a1ab776 (patch)
treeb5b07e7b09a4cfd2baee283d44707b918e9ee70e
parentExplicitly clear TLS secrets after handshake (diff)
downloadpounce-6fc2271398fbbe271f06f9ba1e2997810a1ab776.tar.gz
pounce-6fc2271398fbbe271f06f9ba1e2997810a1ab776.zip
Replace verbose colors with two types of arrows
While the colors were easy to identify in blocks, the meaning of
arrows is easier to remember, and survive logs being pasted for
debugging.
Diffstat (limited to '')
-rw-r--r--client.c6
-rw-r--r--pounce.115
-rw-r--r--server.c4
3 files changed, 11 insertions, 14 deletions
diff --git a/client.c b/client.c
index ebc40f4..938ab8b 100644
--- a/client.c
+++ b/client.c
@@ -86,7 +86,7 @@ void clientFree(struct Client *client) {
 }
 
 void clientSend(struct Client *client, const char *ptr, size_t len) {
-	if (verbose) fprintf(stderr, "\x1B[34m%.*s\x1B[m", (int)len, ptr);
+	if (verbose) fprintf(stderr, "<- %.*s", (int)len, ptr);
 	fcntl(client->sock, F_SETFL, 0);
 	while (len) {
 		ssize_t ret = tls_write(client->tls, ptr, len);
@@ -409,9 +409,7 @@ void clientRecv(struct Client *client) {
 	for (;;) {
 		lf = memchr(line, '\n', &client->buf[client->len] - line);
 		if (!lf) break;
-		if (verbose) {
-			fprintf(stderr, "\x1B[33m%.*s\x1B[m\n", (int)(lf - line), line);
-		}
+		if (verbose) fprintf(stderr, "-> %.*s\n", (int)(lf - line), line);
 		if (client->need || intercept(line, lf - line)) {
 			lf[0] = '\0';
 			if (lf - line && lf[-1] == '\r') lf[-1] = '\0';
diff --git a/pounce.1 b/pounce.1
index 14794cb..2082f72 100644
--- a/pounce.1
+++ b/pounce.1
@@ -1,4 +1,4 @@
-.Dd June 18, 2021
+.Dd August 20, 2021
 .Dt POUNCE 1
 .Os
 .
@@ -356,21 +356,20 @@ Set username to
 The default username is the same as the nickname.
 .
 .It Fl v | Cm verbose
-Write IRC messages to standard error
-in the following colors:
+Write IRC messages to standard error:
 .Pp
-.Bl -tag -width Ds -compact
-.It red
+.Bl -tag -width "<<" -compact
+.It <<
 from
 .Nm
 to the server
-.It green
+.It >>
 from the server to
 .Nm
-.It yellow
+.It ->
 from clients to
 .Nm
-.It blue
+.It <-
 from
 .Nm
 to clients
diff --git a/server.c b/server.c
index d970deb..aa17cde 100644
--- a/server.c
+++ b/server.c
@@ -163,7 +163,7 @@ void serverPrintCert(void) {
 }
 
 void serverSend(const char *ptr, size_t len) {
-	if (verbose) fprintf(stderr, "\x1B[31m%.*s\x1B[m", (int)len, ptr);
+	if (verbose) fprintf(stderr, "<< %.*s", (int)len, ptr);
 	while (len) {
 		ssize_t ret = tls_write(client, ptr, len);
 		if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue;
@@ -239,7 +239,7 @@ void serverRecv(void) {
 		crlf = memmem(line, &buf[len] - line, "\r\n", 2);
 		if (!crlf) break;
 		crlf[0] = '\0';
-		if (verbose) fprintf(stderr, "\x1B[32m%s\x1B[m\n", line);
+		if (verbose) fprintf(stderr, ">> %s\n", line);
 		const char *ping = line;
 		if (ping[0] == '@') {
 			ping += strcspn(ping, " ");