Blame grep-empty-pattern.patch
|
Tim Waugh |
88797f |
--- grep-2.5.1a/src/grep.c.empty-pattern 2006-11-22 19:05:43.000000000 +0000
|
|
Tim Waugh |
88797f |
+++ grep-2.5.1a/src/grep.c 2006-11-22 19:22:04.000000000 +0000
|
|
Tim Waugh |
88797f |
@@ -1667,9 +1667,6 @@
|
|
Tim Waugh |
88797f |
out_invert ^= 1;
|
|
Tim Waugh |
88797f |
match_lines = match_words = 0;
|
|
Tim Waugh |
88797f |
}
|
|
Tim Waugh |
88797f |
- else
|
|
Tim Waugh |
88797f |
- /* Strip trailing newline. */
|
|
Tim Waugh |
88797f |
- --keycc;
|
|
Tim Waugh |
88797f |
}
|
|
Tim Waugh |
88797f |
else
|
|
Tim Waugh |
88797f |
if (optind < argc)
|
|
Tim Waugh |
88797f |
--- grep-2.5.1a/src/search.c.empty-pattern 2006-11-22 19:21:11.000000000 +0000
|
|
Tim Waugh |
88797f |
+++ grep-2.5.1a/src/search.c 2006-11-22 19:35:06.000000000 +0000
|
|
Tim Waugh |
88797f |
@@ -204,6 +204,10 @@
|
|
Tim Waugh |
88797f |
motif = sep;
|
|
Tim Waugh |
88797f |
} while (sep && total != 0);
|
|
Tim Waugh |
88797f |
|
|
Tim Waugh |
88797f |
+ /* Strip trailing newline. */
|
|
Tim Waugh |
88797f |
+ if (size && pattern[size - 1] == '\n')
|
|
Tim Waugh |
88797f |
+ size--;
|
|
Tim Waugh |
88797f |
+
|
|
Tim Waugh |
88797f |
/* In the match_words and match_lines cases, we use a different pattern
|
|
Tim Waugh |
88797f |
for the DFA matcher that will quickly throw out cases that won't work.
|
|
Tim Waugh |
88797f |
Then if DFA succeeds we do some hairy stuff using the regex matcher
|
|
Tim Waugh |
88797f |
@@ -288,6 +292,10 @@
|
|
Tim Waugh |
88797f |
motif = sep;
|
|
Tim Waugh |
88797f |
} while (sep && total != 0);
|
|
Tim Waugh |
88797f |
|
|
Tim Waugh |
88797f |
+ /* Strip trailing newline. */
|
|
Tim Waugh |
88797f |
+ if (size && pattern[size - 1] == '\n')
|
|
Tim Waugh |
88797f |
+ size--;
|
|
Tim Waugh |
88797f |
+
|
|
Tim Waugh |
88797f |
/* In the match_words and match_lines cases, we use a different pattern
|
|
Tim Waugh |
88797f |
for the DFA matcher that will quickly throw out cases that won't work.
|
|
Tim Waugh |
88797f |
Then if DFA succeeds we do some hairy stuff using the regex matcher
|