diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-21 08:44:32 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-21 08:44:32 +0000 |
commit | de15bb931a66f99ffd1312ae5920347cdff4b21b (patch) | |
tree | cf5a77e7d76927e0d47e3dd43c04ae5614ae70ff | |
parent | cf24d29529bbf821a56b278a422e89aacc767193 (diff) | |
download | busybox-w32-1_7_5.tar.gz busybox-w32-1_7_5.tar.bz2 busybox-w32-1_7_5.zip |
apply single post-1.7.4 patch; bump version to 1.7.51_7_5
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | findutils/grep.c | 15 |
2 files changed, 12 insertions, 5 deletions
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 7 | 2 | PATCHLEVEL = 7 |
3 | SUBLEVEL = 4 | 3 | SUBLEVEL = 5 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
6 | 6 | ||
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) | |||
154 | 154 | ||
155 | while ((line = xmalloc_getline(file)) != NULL) { | 155 | while ((line = xmalloc_getline(file)) != NULL) { |
156 | llist_t *pattern_ptr = pattern_head; | 156 | llist_t *pattern_ptr = pattern_head; |
157 | grep_list_data_t * gl; | 157 | grep_list_data_t *gl = gl; /* for gcc */ |
158 | 158 | ||
159 | linenum++; | 159 | linenum++; |
160 | ret = 0; | 160 | ret = 0; |
161 | while (pattern_ptr) { | 161 | while (pattern_ptr) { |
162 | gl = (grep_list_data_t *)pattern_ptr->data; | 162 | gl = (grep_list_data_t *)pattern_ptr->data; |
163 | if (FGREP_FLAG) { | 163 | if (FGREP_FLAG) { |
164 | ret = strstr(line, gl->pattern) != NULL; | 164 | ret |= (strstr(line, gl->pattern) != NULL); |
165 | } else { | 165 | } else { |
166 | /* | 166 | /* |
167 | * test for a postitive-assertion match (regexec returns success (0) | 167 | * test for a postitive-assertion match (regexec returns success (0) |
@@ -255,8 +255,15 @@ static int grep_file(FILE *file) | |||
255 | print_n_lines_after = lines_after; | 255 | print_n_lines_after = lines_after; |
256 | #endif | 256 | #endif |
257 | if (option_mask32 & OPT_o) { | 257 | if (option_mask32 & OPT_o) { |
258 | line[regmatch.rm_eo] = '\0'; | 258 | if (FGREP_FLAG) { |
259 | print_line(line + regmatch.rm_so, linenum, ':'); | 259 | /* -Fo just prints the pattern |
260 | * (unless -v: -Fov doesnt print anything at all) */ | ||
261 | if (ret) | ||
262 | print_line(gl->pattern, linenum, ':'); | ||
263 | } else { | ||
264 | line[regmatch.rm_eo] = '\0'; | ||
265 | print_line(line + regmatch.rm_so, linenum, ':'); | ||
266 | } | ||
260 | } else { | 267 | } else { |
261 | print_line(line, linenum, ':'); | 268 | print_line(line, linenum, ':'); |
262 | } | 269 | } |