diff options
author | June McEnroe <june@causal.agency> | 2023-06-12 15:47:07 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2023-06-12 15:47:07 -0400 |
commit | 540485dd73b24eae578fb84f0039a2abdc25623b (patch) | |
tree | fe82a79b567c57697fe40150261685f5b1c9e12e | |
parent | Make copyrights and AUTHORS consistent (diff) | |
download | litterbox-540485dd73b24eae578fb84f0039a2abdc25623b.tar.gz litterbox-540485dd73b24eae578fb84f0039a2abdc25623b.zip |
Strip CR LF from input lines in unscoop
-rw-r--r-- | unscoop.c | 2 |
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) { |