Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2008 15:19:43 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 144099 for review
Message-ID:  <200806251519.m5PFJhLa011334@repoman.freebsd.org>

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

Change 144099 by gabor@gabor_server on 2008/06/25 15:19:25

	- Reimplement -w
	- Fixes for --color

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/util.c#44 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/util.c#44 (text+ko) ====

@@ -220,6 +220,9 @@
 				if (r == 0 && xflag)
 					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]))
+						r = REG_NOMATCH;
 				if (r == t) {
 					if (m == 0)
 						c++;
@@ -336,11 +339,11 @@
 			if (!oflag)
 				fwrite(line->dat + a, matches[i].rm_so - a, 1, stdout);
 			if (color) 
-				fprintf(stdout, "\33[%sm", color);
+				fprintf(stdout, "\33[%sm\33[K", color);
 				fwrite(line->dat + matches[i].rm_so, 
 				matches[i].rm_eo - matches[i].rm_so, 1, stdout);
 			if (color) 
-				fprintf(stdout, "\33[00m");
+				fprintf(stdout, "\33[00m\33[K");
 			a = matches[i].rm_eo;
 			if (oflag)
 				putchar('\n');
@@ -354,5 +357,4 @@
 		fwrite(line->dat, line->len, 1, stdout);
 		putchar('\n');
 	}
-
 }



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