PERFORCE change 144099 for review

Gabor Kovesdan gabor at FreeBSD.org
Wed Jun 25 15:19:43 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=144099

Change 144099 by gabor at 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');
 	}
-
 }


More information about the p4-projects mailing list