Subject: Re: passing options through MAKEDEV to MAKEDEV.local
To: None <tech-userlevel@netbsd.org>
From: David Young <dyoung@pobox.com>
List: tech-userlevel
Date: 08/31/2006 22:20:35
--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Aug 31, 2006 at 10:19:49PM -0500, David Young wrote:
> Here is a trivial patch that passes options such as -s through MAKEDEV to
> MAKEDEV.local.  Barring objections, I will commit this soon.  I'm curious,
> is there a better way to pass the options through?

Oops.  Here is the patch.

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="MAKEDEV.tmpl.patch"

Index: MAKEDEV.tmpl
===================================================================
RCS file: /cvsroot/src/etc/MAKEDEV.tmpl,v
retrieving revision 1.60
diff -u -p -u -p -r1.60 MAKEDEV.tmpl
--- MAKEDEV.tmpl	13 Aug 2006 18:53:31 -0000	1.60
+++ MAKEDEV.tmpl	1 Sep 2006 03:13:54 -0000
@@ -336,6 +336,7 @@ hexprint()
 	esac
 }
 
+opts=
 do_force=false
 do_specfile=false
 while getopts fm:s ch; do
@@ -346,6 +347,12 @@ while getopts fm:s ch; do
 	*)	usage ;;
 	esac
 done
+i=1
+for opt; do
+	[ $i -gt $((${OPTIND} - 1)) ] && break
+	opts="$opts $opt"
+	i=$(($i + 1))
+done
 shift $((${OPTIND} - 1))
 [ $# -gt 0 ] || usage
 
@@ -1603,7 +1614,7 @@ midevend)
 local)
 	if [ -f "$0.local" ]; then
 		umask 0
-		sh $0.local all
+		sh $0.local $opts all
 		umask 077
 	fi
 	;;

--envbJBWh7q8WU6mo--