aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-03-21 08:44:32 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-03-21 08:44:32 +0000
commitde15bb931a66f99ffd1312ae5920347cdff4b21b (patch)
treecf5a77e7d76927e0d47e3dd43c04ae5614ae70ff
parentcf24d29529bbf821a56b278a422e89aacc767193 (diff)
downloadbusybox-1_7_stable.tar.gz
busybox-1_7_stable.tar.bz2
apply single post-1.7.4 patch; bump version to 1.7.51_7_51_7_stable
-rw-r--r--Makefile2
-rw-r--r--findutils/grep.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c1fe21b53..b1ec0d3c7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 7
-SUBLEVEL = 4
+SUBLEVEL = 5
EXTRAVERSION =
NAME = Unnamed
diff --git a/findutils/grep.c b/findutils/grep.c
index c45d0ed89..521b88e7f 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -154,14 +154,14 @@ static int grep_file(FILE *file)
while ((line = xmalloc_getline(file)) != NULL) {
llist_t *pattern_ptr = pattern_head;
- grep_list_data_t * gl;
+ grep_list_data_t *gl = gl; /* for gcc */
linenum++;
ret = 0;
while (pattern_ptr) {
gl = (grep_list_data_t *)pattern_ptr->data;
if (FGREP_FLAG) {
- ret = strstr(line, gl->pattern) != NULL;
+ ret |= (strstr(line, gl->pattern) != NULL);
} else {
/*
* test for a postitive-assertion match (regexec returns success (0)
@@ -255,8 +255,15 @@ static int grep_file(FILE *file)
print_n_lines_after = lines_after;
#endif
if (option_mask32 & OPT_o) {
- line[regmatch.rm_eo] = '\0';
- print_line(line + regmatch.rm_so, linenum, ':');
+ if (FGREP_FLAG) {
+ /* -Fo just prints the pattern
+ * (unless -v: -Fov doesnt print anything at all) */
+ if (ret)
+ print_line(gl->pattern, linenum, ':');
+ } else {
+ line[regmatch.rm_eo] = '\0';
+ print_line(line + regmatch.rm_so, linenum, ':');
+ }
} else {
print_line(line, linenum, ':');
}