about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-06-12 15:47:07 -0400
committerJune McEnroe <june@causal.agency>2023-06-12 15:47:07 -0400
commit540485dd73b24eae578fb84f0039a2abdc25623b (patch)
treefe82a79b567c57697fe40150261685f5b1c9e12e
parentMake copyrights and AUTHORS consistent (diff)
downloadlitterbox-540485dd73b24eae578fb84f0039a2abdc25623b.tar.gz
litterbox-540485dd73b24eae578fb84f0039a2abdc25623b.zip
Strip CR LF from input lines in unscoop
Diffstat (limited to '')
-rw-r--r--unscoop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/unscoop.c b/unscoop.c
index acfc33b..a290831 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -533,6 +533,8 @@ int main(int argc, char *argv[]) {
 		}
 
 		for (ssize_t len; 0 < (len = getline(&line, &cap, file));) {
+			if (len >= 1 && line[len-1] == '\n') line[len-1] = '\0';
+			if (len >= 2 && line[len-2] == '\r') line[len-2] = '\0';
 			matchLine(format, regex, line);
 			sizeRead += len;
 			if (100 * sizeRead / sizeTotal != sizePercent) {