summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-01-14 20:08:45 -0500
committerJune McEnroe <june@causal.agency>2020-01-14 20:10:20 -0500
commit2ecafb0e4e31c7aa63e5f95fa24dbac10d5c2e8b (patch)
tree2d89c84f0988bce59d469c8437f3e905995e5d94
parentImplement IRC formatting to ANSI translation (diff)
downloadlitterbox-2ecafb0e4e31c7aa63e5f95fa24dbac10d5c2e8b.tar.gz
litterbox-2ecafb0e4e31c7aa63e5f95fa24dbac10d5c2e8b.zip
Ensure ansi resets formatting and null-terminates
fmemopen in text-mode only ensures the buffer is null-terminated if the
last write does not fill the buffer.
-rw-r--r--scoop.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/scoop.c b/scoop.c
index 241ef3e..006a416 100644
--- a/scoop.c
+++ b/scoop.c
@@ -123,8 +123,10 @@ static const char *ansi(const char *str) {
 			}
 		}
 	}
-
+	fprintf(out, "\33[m");
 	fclose(out);
+
+	buf[sizeof(buf) - 1] = '\0';
 	return buf;
 }
 
ht'> If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example because you have committed your changes) causes all of the CGit objects to be rebuilt. Avoid this by using EXTRA_CPPFLAGS to add the version for only those files that are affected and make them depend on VERSION. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping We already have a global cgit_version which is set from the #define'd CGIT_VERSION in cgit.c. Change ui-patch.c to use this so that we only need to rebuild cgit.o when the version changes. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping