Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2008 19:12:16 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 143833 for review
Message-ID:  <200806201912.m5KJCGff066968@repoman.freebsd.org>

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

Change 143833 by gabor@gabor_server on 2008/06/20 19:11:20

	- GNU compatibility: better --color codes

Affected files ...

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

Differences ...

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

@@ -244,13 +244,13 @@
 				strlcpy(matched, &(l->dat[pmatch.rm_so]), pmatch.rm_eo - pmatch.rm_so + 1);
 				strlcpy(end, &(l->dat[pmatch.rm_eo]), strlen(l->dat) - pmatch.rm_eo + 1);
 
-				asprintf(&tmp, "%s\33[%sm\33[K%s\33[00m\33[K%s", begin, color, matched, end);
+				asprintf(&tmp, "%s\33[%sm\33[K%s\33[m\33[K%s", begin, color, matched, end);
 
 				free(begin);
 				free(matched);
 				free(end);
 
-				l->len += strlen(color) + 14;
+				l->len += strlen(color) + 12;
 				l->dat = tmp;
 			}
 			if (r == 0 && oflag && !nottext) {
@@ -261,7 +261,7 @@
 				strlcpy(matched, &(l->dat[pmatch.rm_so]), pmatch.rm_eo - pmatch.rm_so + 1);
 
 				if (color != NULL)
-					asprintf(&tmp, "\33[%sm%s\33[00m", color, matched);
+					asprintf(&tmp, "\33[%sm%s\33[m", color, matched);
 				else
 					tmp = matched;
 



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