PERFORCE change 144095 for review
Gabor Kovesdan
gabor at FreeBSD.org
Wed Jun 25 13:25:49 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144095
Change 144095 by gabor at 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;
More information about the p4-projects
mailing list