PERFORCE change 143665 for review

Gabor Kovesdan gabor at FreeBSD.org
Tue Jun 17 19:52:45 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=143665

Change 143665 by gabor at 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) ====



More information about the p4-projects mailing list