Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2008 15:40:03 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 144100 for review
Message-ID:  <200806251540.m5PFe3tD013079@repoman.freebsd.org>

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

Change 144100 by gabor@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);



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