diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-25 21:36:01 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-25 21:36:01 +0000 |
commit | 87fcaaa7c3c1c0c0dd898f12de2d379baafb0ed1 (patch) | |
tree | c73dc31f440b3c08e0564898d8c004b236de23a8 /usr.bin/grep/grep.h | |
parent | 6451aa97207663c0fae475e74fed893c6d313f45 (diff) |
Previously, in -w mode, for each match on a line grep would check
to see if the match was on a word boundary. However, this missed
lines where the first match was not on a word boundary but a
subsequent match was. Problem originally spotted by miod@
We fix this by using the [[:<:]] and [[:>:]] character classes for
the slow path and by checking the word boundaries in grep_search()
for the fast path instead of doing the checks after running
regexec() or grep_search().
With this change, grep passes the new regress tests 15 and 16.
problem originally spotted by espie@.
Diffstat (limited to 'usr.bin/grep/grep.h')
-rw-r--r-- | usr.bin/grep/grep.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h index 1d886d57c20..43842ba56d5 100644 --- a/usr.bin/grep/grep.h +++ b/usr.bin/grep/grep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.h,v 1.9 2004/01/19 16:12:04 otto Exp $ */ +/* $OpenBSD: grep.h,v 1.10 2004/01/25 21:36:00 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -55,6 +55,7 @@ typedef struct { /* flags */ int bol; int eol; + int wmatch; int reversedSearch; } fastgrep_t; @@ -83,7 +84,6 @@ int procfile(char *fn); int grep_tree(char **argv); void *grep_malloc(size_t size); void *grep_realloc(void *ptr, size_t size); -unsigned char *grep_strdup(const char *); void printline(str_t *line, int sep); int fastcomp(fastgrep_t *, const char *); |