Module Name:    src
Committed By:   kre
Date:           Sat Sep 22 03:29:51 UTC 2018

Modified Files:
        src/sys/arch/sparc/stand/binstall: binstall.sh

Log Message:
Convert from getopt to getopts    (script is slightly smaller as a
result, but not enough to save a block ... but if /usr/bin/getopt is
not used elsewhere, and it should not be, it will no longer be required.)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/stand/binstall/binstall.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc/stand/binstall/binstall.sh
diff -u src/sys/arch/sparc/stand/binstall/binstall.sh:1.17 src/sys/arch/sparc/stand/binstall/binstall.sh:1.18
--- src/sys/arch/sparc/stand/binstall/binstall.sh:1.17	Sun Sep 16 14:26:04 2018
+++ src/sys/arch/sparc/stand/binstall/binstall.sh	Sat Sep 22 03:29:51 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: binstall.sh,v 1.17 2018/09/16 14:26:04 kre Exp $
+#	$NetBSD: binstall.sh,v 1.18 2018/09/22 03:29:51 kre Exp $
 #
 
 vecho () {
@@ -53,27 +53,22 @@ VERBOSE=
 : ${OFWBOOTBLK:=ofwboot}
 [ "$( sysctl -n machdep.cpu_arch )" = 9 ] && ULTRASPARC=true || ULTRASPARC=false
 
-### XXX this should be converted to use getopts
-set -- $(getopt "b:hf:i:m:tUuv" "$@" )
-if [ $? -gt 0 ]; then
-	Usage
-fi
-
-for a
+while getopts b:hf:i:m:tUuv a
 do
-	case "$1" in
-	-h) Help; shift ;;
-	-u) ULTRASPARC=true; shift ;;
-	-U) ULTRASPARC=false; shift ;;
-	-b) BOOTPROG=$2; OFWBOOTBLK=$2; shift 2 ;;
-	-f) DEV=$2; shift 2 ;;
-	-m) MDEC=$2; shift 2 ;;
-	-i) INSTALLBOOT=$2; shift 2 ;;
-	-t) TEST=1; VERBOSE=-v; shift ;;
-	-v) VERBOSE=-v; shift ;;
-	--) shift; break ;;
+	case "$a" in
+	h) Help;;
+	u) ULTRASPARC=true;;
+	U) ULTRASPARC=false;;
+	b) BOOTPROG=$OPTARG; OFWBOOTBLK=$OPTARG;;
+	f) DEV=$OPTARG;;
+	m) MDEC=$OPTARG;;
+	i) INSTALLBOOT=$OPTARG;;
+	t) TEST=1; VERBOSE=-v;;
+	v) VERBOSE=-v;;
+	\?) Usage;;
 	esac
 done
+shift $(( $OPTIND - 1 ))
 
 if [ "$( sysctl -n kern.securelevel )" -gt 0 ] && ! [ -f "$DEV" ]; then
 	Secure

Reply via email to