diff options
author | Ian Wienand <ianw@vmware.com> | 2010-04-30 09:32:10 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-30 09:32:10 +0200 |
commit | 0a2c793bd61540629d5686adb5afd2ada19d624f (patch) | |
tree | a40bb43c93cb08dddbe91363d3ae3a8ac63603f3 | |
parent | d2844fcb6862c080177aaf314cc98d03e65b05ac (diff) | |
download | busybox-w32-0a2c793bd61540629d5686adb5afd2ada19d624f.tar.gz busybox-w32-0a2c793bd61540629d5686adb5afd2ada19d624f.tar.bz2 busybox-w32-0a2c793bd61540629d5686adb5afd2ada19d624f.zip |
grep: fix -Fi
function old new delta
grep_file 1151 1169 +18
Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | findutils/grep.c | 5 | ||||
-rwxr-xr-x | testsuite/grep.tests | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 40caef423..0f1c11abb 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -254,7 +254,10 @@ static int grep_file(FILE *file) | |||
254 | while (pattern_ptr) { | 254 | while (pattern_ptr) { |
255 | gl = (grep_list_data_t *)pattern_ptr->data; | 255 | gl = (grep_list_data_t *)pattern_ptr->data; |
256 | if (FGREP_FLAG) { | 256 | if (FGREP_FLAG) { |
257 | found |= (strstr(line, gl->pattern) != NULL); | 257 | found |= (((option_mask32 & OPT_i) |
258 | ? strcasestr(line, gl->pattern) | ||
259 | : strstr(line, gl->pattern) | ||
260 | ) != NULL); | ||
258 | } else { | 261 | } else { |
259 | if (!(gl->flg_mem_alocated_compiled & COMPILED)) { | 262 | if (!(gl->flg_mem_alocated_compiled & COMPILED)) { |
260 | gl->flg_mem_alocated_compiled |= COMPILED; | 263 | gl->flg_mem_alocated_compiled |= COMPILED; |
diff --git a/testsuite/grep.tests b/testsuite/grep.tests index 8692307dd..d4bf80d83 100755 --- a/testsuite/grep.tests +++ b/testsuite/grep.tests | |||
@@ -75,6 +75,8 @@ testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \ | |||
75 | "one\ntwo\n0\n" "one\ntwo\n" "" | 75 | "one\ntwo\n0\n" "one\ntwo\n" "" |
76 | testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \ | 76 | testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \ |
77 | "one\ntwo\n0\n" "one\ntwo\n" "" | 77 | "one\ntwo\n0\n" "one\ntwo\n" "" |
78 | testing "grep -F handles -i" "grep -F -i foo input ; echo \$?" \ | ||
79 | "FOO\n0\n" "FOO\n" "" | ||
78 | 80 | ||
79 | # -f file/- | 81 | # -f file/- |
80 | testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \ | 82 | testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \ |