[git commit master] grep: fix -Fi
Denys Vlasenko
vda.linux at googlemail.com
Fri Apr 30 07:32:10 UTC 2010
commit: http://git.busybox.net/busybox/commit/?id=0a2c793bd61540629d5686adb5afd2ada19d624f
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
grep_file 1151 1169 +18
Signed-off-by: Ian Wienand <ianw at vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
findutils/grep.c | 5 ++++-
testsuite/grep.tests | 2 ++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/findutils/grep.c b/findutils/grep.c
index 40caef4..0f1c11a 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -254,7 +254,10 @@ static int grep_file(FILE *file)
while (pattern_ptr) {
gl = (grep_list_data_t *)pattern_ptr->data;
if (FGREP_FLAG) {
- found |= (strstr(line, gl->pattern) != NULL);
+ found |= (((option_mask32 & OPT_i)
+ ? strcasestr(line, gl->pattern)
+ : strstr(line, gl->pattern)
+ ) != NULL);
} else {
if (!(gl->flg_mem_alocated_compiled & COMPILED)) {
gl->flg_mem_alocated_compiled |= COMPILED;
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index 8692307..d4bf80d 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 \$?" \
"one\ntwo\n0\n" "one\ntwo\n" ""
testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \
"one\ntwo\n0\n" "one\ntwo\n" ""
+testing "grep -F handles -i" "grep -F -i foo input ; echo \$?" \
+ "FOO\n0\n" "FOO\n" ""
# -f file/-
testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \
--
1.6.3.3
More information about the busybox-cvs
mailing list