Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jun 2008 14:53:29 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 144196 for review
Message-ID:  <200806271453.m5RErT1l038112@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144196

Change 144196 by gabor@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806271453.m5RErT1l038112>