summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--client.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/client.c b/client.c
index 4f315c8..30174e9 100644
--- a/client.c
+++ b/client.c
@@ -358,21 +358,22 @@ void clientRecv(struct Client *client) {
 	}
 	client->len += read;
 
-	char *crlf;
+	char *lf;
 	char *line = client->buf;
 	for (;;) {
-		crlf = memmem(line, &client->buf[client->len] - line, "\r\n", 2);
-		if (!crlf) break;
+		lf = memchr(line, '\n', &client->buf[client->len] - line);
+		if (!lf) break;
 		if (verbose) {
-			fprintf(stderr, "\x1B[33m%.*s\x1B[m\n", (int)(crlf - line), line);
+			fprintf(stderr, "\x1B[33m%.*s\x1B[m\n", (int)(lf - line), line);
 		}
-		if (client->need || intercept(line, crlf - line)) {
-			crlf[0] = '\0';
+		if (client->need || intercept(line, lf - line)) {
+			lf[0] = '\0';
+			if (lf - line && lf[-1] == '\r') lf[-1] = '\0';
 			clientParse(client, line);
 		} else {
-			serverSend(line, crlf + 2 - line);
+			serverSend(line, lf + 1 - line);
 		}
-		line = crlf + 2;
+		line = lf + 1;
 	}
 	client->len -= line - client->buf;
 	memmove(client->buf, line, client->len);
tle='2021-09-08 23:32:51 -0400'>2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe