summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/grep.c b/grep.c
index 320655b..fec8d09 100644
--- a/grep.c
+++ b/grep.c
@@ -69,8 +69,7 @@ static void grep_file(FILE *file)
int nmatches = 0;
while ((line = get_line_from_file(file)) != NULL) {
- if (line[strlen(line)-1] == '\n')
- line[strlen(line)-1] = '\0';
+ chomp(line);
linenum++;
ret = regexec(&regex, line, 0, NULL, 0);
if (ret == 0 && !invert_search) { /* match */