PERFORCE change 144196 for review
Gabor Kovesdan
gabor at FreeBSD.org
Fri Jun 27 14:53:30 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144196
Change 144196 by gabor at gabor_server on 2008/06/27 14:52:45
- Fix -w
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#46 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#46 (text+ko) ====
@@ -196,6 +196,8 @@
return (c);
}
+#define isword(x) (isalnum((unsigned char)(x)) || (x) == '_')
+
static int
procline(struct str *l, int nottext)
{
@@ -219,7 +221,8 @@
if (pmatch.rm_so != 0 || pmatch.rm_eo != l->len)
r = REG_NOMATCH;
if (r == 0 && wflag)
- if (pmatch.rm_so != 0 || !isspace(l->dat[pmatch.rm_so - 1]))
+ if ((pmatch.rm_so != 0 && isword((unsigned char)l->dat[pmatch.rm_so - 1]))
+ || (pmatch.rm_eo != l->len && isword((unsigned char)l->dat[pmatch.rm_eo])))
r = REG_NOMATCH;
if (r == t) {
if (m == 0)
More information about the p4-projects
mailing list