PERFORCE change 145708 for review

Gabor Kovesdan gabor at FreeBSD.org
Wed Jul 23 11:35:26 UTC 2008


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

Change 145708 by gabor at gabor_server on 2008/07/23 11:35:14

	- Return 0 on empty regex, empty input

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/util.c#69 edit

Differences ...

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

@@ -179,8 +179,12 @@
 		initqueue();
 	for (c = 0;  c == 0 || !(lflag || qflag); ) {
 		ln.off += ln.len + 1;
-		if ((ln.dat = grep_fgetln(f, &ln.len)) == NULL)
-			break;
+		if ((ln.dat = grep_fgetln(f, &ln.len)) == NULL) {
+			if (ln.line_no == 0 && matchall)
+				exit(0);
+			else
+				break;
+		}
 		if (ln.len > 0 && ln.dat[ln.len - 1] == '\n')
 			--ln.len;
 		ln.line_no++;


More information about the p4-projects mailing list