aboutsummaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/grep.c b/grep.c
index c3affb6ca..b95803bbb 100644
--- a/grep.c
+++ b/grep.c
@@ -334,9 +334,15 @@ static int fixmatch(const char *pattern, char *line, char *eol,
{
char *hit;
- if (ignore_case)
- hit = strcasestr(line, pattern);
- else
+ if (ignore_case) {
+ char *s = line;
+ do {
+ hit = strcasestr(s, pattern);
+ if (hit)
+ break;
+ s += strlen(s) + 1;
+ } while (s < eol);
+ } else
hit = memmem(line, eol - line, pattern, strlen(pattern));
if (!hit) {