Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jun 2008 19:52:44 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 143665 for review
Message-ID:  <200806171952.m5HJqinG095952@repoman.freebsd.org>

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

Change 143665 by gabor@gabor_server on 2008/06/17 19:52:15

	- Pass REG_EXTENDED to regexec if -E is given
	- GNU compatibility: allow * at the beginning of a subexpression

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#23 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#28 edit

Differences ...

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

@@ -199,6 +199,16 @@
 	while ((ptr = strstr(pat, "||")) != NULL)
 		strlcpy(&(ptr[1]), &(ptr[2]), strlen(pat) - strlen(ptr) - 1);
 
+/* Work-around to allow * at the beginning of a subexpression */
+	while (pat[0] == '*')
+		pat++;
+	while ((ptr = strstr(pat, "(*")) != NULL)
+		strlcpy(&(ptr[1]), &(ptr[2]), strlen(pat) - strlen(ptr) - 1);
+	while ((ptr = strstr(pat, "|*")) != NULL)
+		strlcpy(&(ptr[1]), &(ptr[2]), strlen(pat) - strlen(ptr) - 1);
+
+	printf("PAT: %s\n", pat);
+
 	if (!xflag && (len == 0 || matchall)) {
 		matchall = 1;
 		return;
@@ -357,6 +367,7 @@
 		case 'E':
 			Fflag = Gflag = 0;
 			Eflag++;
+			eflags |= REG_EXTENDED;
 			break;
 		case 'e':
 			add_patterns(optarg);

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




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