diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-05-26 09:46:41 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-05-26 09:46:41 +0000 |
commit | 42a12a57c23743ef1e05429cf41e54158cfa2bce (patch) | |
tree | 4790f4a882e957df6c40d887ba2fd0ab8c519c47 | |
parent | d0b302409653a210beccf4210a835ce6d57435c7 (diff) | |
download | busybox-w32-42a12a57c23743ef1e05429cf41e54158cfa2bce.tar.gz busybox-w32-42a12a57c23743ef1e05429cf41e54158cfa2bce.tar.bz2 busybox-w32-42a12a57c23743ef1e05429cf41e54158cfa2bce.zip |
Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic
git-svn-id: svn://busybox.net/trunk/busybox@8868 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | findutils/grep.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 3ba746373..6ece0ab12 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -20,8 +20,8 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | /* | 22 | /* |
23 | * Jun 2003 by Vladimir Oleynik <dzo@simtreas.ru> - | 23 | * Apr 2004 by Vladimir Oleynik <dzo@simtreas.ru> - |
24 | * correction "-e pattern1 -e -e pattern2" logic and more optimizations. | 24 | * correction "-e pattern1 -e pattern2" logic and more optimizations. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
@@ -135,11 +135,9 @@ static int grep_file(FILE *file) | |||
135 | */ | 135 | */ |
136 | regex_t regex; | 136 | regex_t regex; |
137 | xregcomp(®ex, pattern_ptr->data, reflags); | 137 | xregcomp(®ex, pattern_ptr->data, reflags); |
138 | ret = regexec(®ex, line, 0, NULL, 0) == 0; | 138 | ret |= regexec(®ex, line, 0, NULL, 0) == 0; |
139 | regfree(®ex); | 139 | regfree(®ex); |
140 | } | 140 | } |
141 | if (!ret) | ||
142 | break; | ||
143 | pattern_ptr = pattern_ptr->link; | 141 | pattern_ptr = pattern_ptr->link; |
144 | } /* while (pattern_ptr) */ | 142 | } /* while (pattern_ptr) */ |
145 | 143 | ||