PERFORCE change 144100 for review

Gabor Kovesdan gabor at FreeBSD.org
Wed Jun 25 15:40:04 UTC 2008


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

Change 144100 by gabor at gabor_server on 2008/06/25 15:39:53

	- Restore compatibility of status codes

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#51 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#45 edit

Differences ...

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

@@ -607,12 +607,13 @@
 		hflag = 1;
 
 	if (argc == 0)
-		exit(!procfile(NULL));
+		exit(!procfile("-"));
 
 	if (dirbehave == DIR_RECURSE)
 		c = grep_tree(argv);
-	else
-		c+= procfile(*argv);
+	else 
+		for (c = 0; argc--; ++argv)
+			c+= procfile(*argv);
 
 #ifndef WITHOUT_NLS
 	catclose(catalog);

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

@@ -114,16 +114,14 @@
 	if (mflag && (mcount <= 0))
 		return (0);
 
-	if (fn == NULL || (strcmp(fn, "-") == 0)) {
+	if (strcmp(fn, "-") == 0) {
 		if (label != NULL)
 			fn = label;
 		else
 			fn = getstr(1);
 		f = grep_stdin_open();
 	} else {
-		if (stat(fn, &sb))
-			err(2, NULL);
-		else {
+		if (!stat(fn, &sb)) {
 			s = sb.st_mode & S_IFMT;
 			if (s == S_IFDIR && dirbehave == DIR_SKIP)
 				return (0);


More information about the p4-projects mailing list