summaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-09 17:21:26 +0000
committerDenis Vlasenko2008-11-09 17:21:26 +0000
commit84641942e5366b2e09367ba4f4376c99f15ecc8e (patch)
treeeff2511dcc6cb647e0bf898903f86c94b85466ad /findutils
parentbacaff6e5474d6c5f080ce4cd2a55e8ff1ba5c94 (diff)
downloadbusybox-1_12_2.zip
busybox-1_12_2.tar.gz
apply post-1.12.1 patches, bump version to 1.12.21_12_2
Diffstat (limited to 'findutils')
-rw-r--r--findutils/grep.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/findutils/grep.c b/findutils/grep.c
index 9d38ef9..73e74f4 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -363,12 +363,22 @@ static int grep_file(FILE *file)
* (unless -v: -Fov doesnt print anything at all) */
if (found)
print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
- } else {
+ } else while (1) {
+ char old = line[gl->matched_range.rm_eo];
line[gl->matched_range.rm_eo] = '\0';
print_line(line + gl->matched_range.rm_so,
gl->matched_range.rm_eo - gl->matched_range.rm_so,
linenum, ':');
- }
+ line[gl->matched_range.rm_eo] = old;
+#if !ENABLE_EXTRA_COMPAT
+ break;
+#else
+ if (re_search(&gl->compiled_regex, line, line_len,
+ gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo,
+ &gl->matched_range) < 0)
+ break;
+#endif
+ }
} else {
print_line(line, line_len, linenum, ':');
}