Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2015 22:37:34 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287389 - head/usr.sbin/sysrc
Message-ID:  <201509012237.t81MbYNW044111@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Tue Sep  1 22:37:33 2015
New Revision: 287389
URL: https://svnweb.freebsd.org/changeset/base/287389

Log:
  Simplify long-option processing
  
  MFC after:	3 days
  X-MFC-to:	stable/10

Modified:
  head/usr.sbin/sysrc/sysrc

Modified: head/usr.sbin/sysrc/sysrc
==============================================================================
--- head/usr.sbin/sysrc/sysrc	Tue Sep  1 22:35:53 2015	(r287388)
+++ head/usr.sbin/sysrc/sysrc	Tue Sep  1 22:37:33 2015	(r287389)
@@ -231,20 +231,16 @@ escape()
 #
 # Check for `--help' and `--version' command-line option
 #
-( # Operate in sub-shell to protect $@ in parent
-	while [ $# -gt 0 ]; do
-		case "$1" in
-		--help) help ;;
-		--version) # see GLOBALS
-			echo "$SYSRC_VERSION"
-			exit 1 ;;
-		-[fRj]) # These flags take an argument
-			shift 1 ;;
-		esac
-		shift 1
-	done
-	exit 0
-) || die
+for arg in "$@"; do
+	case "$arg" in
+	--) break ;;
+	--help) help ;; # NOTREACHED
+	--version) # see GLOBALS
+		echo "$SYSRC_VERSION"
+		exit $FAILURE ;;
+	esac
+done
+unset arg
 
 #
 # Process command-line flags



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