svn commit: r348503 - head/usr.bin/grep

Kyle Evans kevans at FreeBSD.org
Sun Jun 2 02:38:45 UTC 2019


Author: kevans
Date: Sun Jun  2 02:38:44 2019
New Revision: 348503
URL: https://svnweb.freebsd.org/changeset/base/348503

Log:
  grep: Move lone 'r'grep case into the adjacent switch
  
  This 'r' case should have belonged to the switch in the first place, but
  I had somehow missed the switch when initially adding the rgrep link. The
  zgrep script later came along and faithfully left this case standing alone,
  so we will now go ahead and join it.
  
  Nearby comment also adjusted a tad bit for wording and style.
  
  Reported by:	Daniel Ebdrup
  MFC after:	3 days

Modified:
  head/usr.bin/grep/grep.c

Modified: head/usr.bin/grep/grep.c
==============================================================================
--- head/usr.bin/grep/grep.c	Sun Jun  2 01:00:17 2019	(r348502)
+++ head/usr.bin/grep/grep.c	Sun Jun  2 02:38:44 2019	(r348503)
@@ -343,20 +343,22 @@ main(int argc, char *argv[])
 
 	setlocale(LC_ALL, "");
 
-	/* Check what is the program name of the binary.  In this
-	   way we can have all the funcionalities in one binary
-	   without the need of scripting and using ugly hacks. */
+	/*
+	 * Check how we've bene invoked to determine the behavior we should
+	 * exhibit. In this way we can have all the functionalities in one
+	 * binary without the need of scripting and using ugly hacks.
+	 */
 	pn = getprogname();
-	if (pn[0] == 'r') {
-		dirbehave = DIR_RECURSE;
-		Hflag = true;
-	}
 	switch (pn[0]) {
 	case 'e':
 		grepbehave = GREP_EXTENDED;
 		break;
 	case 'f':
 		grepbehave = GREP_FIXED;
+		break;
+	case 'r':
+		dirbehave = DIR_RECURSE;
+		Hflag = true;
 		break;
 	}
 


More information about the svn-src-all mailing list