From owner-p4-projects@FreeBSD.ORG Wed Jun 25 13:25:49 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D622E1065671; Wed, 25 Jun 2008 13:25:48 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 970F9106566B for ; Wed, 25 Jun 2008 13:25:48 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8CC508FC14 for ; Wed, 25 Jun 2008 13:25:48 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m5PDPmsp000215 for ; Wed, 25 Jun 2008 13:25:48 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m5PDPmfF000213 for perforce@freebsd.org; Wed, 25 Jun 2008 13:25:48 GMT (envelope-from gabor@freebsd.org) Date: Wed, 25 Jun 2008 13:25:48 GMT Message-Id: <200806251325.m5PDPmfF000213@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@freebsd.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Cc: Subject: PERFORCE change 144095 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2008 13:25:49 -0000 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 ==== //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;