diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/grijp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/grijp.c b/src/grijp.c index a17e295..d94cba8 100644 --- a/src/grijp.c +++ b/src/grijp.c @@ -139,7 +139,7 @@ static void print_match(char *fname, char *line) { printf("%s:", fname); } - printf("%s", line); + printf("%s\n", line); } static int process(char *fname, bool isstdin) { @@ -157,6 +157,8 @@ static int process(char *fname, bool isstdin) { ssize_t nread = 0; while ((errno = 0, nread = getline(&line, &linecap, stream)) != -1) { + if (nread > 0 && line[nread-1] == '\n') line[--nread] = '\0'; + for (size_t i = 0; i < npat; i++) { bool matches = false; |