Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2008 13:25:48 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 144095 for review
Message-ID:  <200806251325.m5PDPmfF000213@repoman.freebsd.org>

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

Change 144095 by gabor@gabor_server on 2008/06/25 13:25:04

	- Change some comments about the GNU compat parts
	- Add a WITHOUT_GNU_COMPAT part, just in case somebody
	  wants to disable that.

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/Makefile#8 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#50 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/Makefile#8 (text+ko) ====

@@ -31,4 +31,8 @@
 CFLAGS+=	-DWITHOUT_NLS
 .endif
 
+.if defined(WITHOUT_GNU_COMPAT)
+CFLAGS+=	-DWITH_OUT_GNU_COMPAT
+.endif
+
 .include <bsd.prog.mk>

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

@@ -202,12 +202,15 @@
 static void
 add_pattern(char *pat, size_t len)
 {
+#ifndef WITHOUT_GNU_COMPAT
 	char	*ptr, *st;
 	int	 lbr, rbr;
 
-/* Workaround for our libc-regex library to match GNU behaviour.
-   Our library rejects '|' with empty subexpressions.  Just cut out
-   those parts, e.g. "(|a|b||c|)" will be "(a|b|c)" */
+/* Workaround for our libc-regex library for better GNU compatibility.
+   Our library rejects some non-standard regular expressions, for example
+   '|' cannot stand with empty subexpressions.  In these cases the
+   non-standard regex will be pre-edited,
+   e.g. "(|a|b||c|)" will be "(a|b|c)" */
 	st = pat;
 	while (((ptr = strstr(st, "|)"))) != NULL) {
 		if (strstr(st, "\\|)") != (ptr - 1))
@@ -281,10 +284,9 @@
 			errx(2, getstr(8));
 		}
 	}
-
-/* Work-around to allow * at the beginning of the regexp */
 	while (pat[0] == '*')
 		pat++;
+#endif
 
 	if (len == 0 || matchall) {
 		matchall = 1;



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