Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2019 02:38:44 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348503 - head/usr.bin/grep
Message-ID:  <201906020238.x522ciVN005704@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}
 



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