Module Name:    src
Committed By:   kre
Date:           Thu Jun  8 03:42:37 UTC 2017

Modified Files:
        src/etc: MAKEDEV.tmpl

Log Message:
As (briefly) discussed on current-users, change the way that MAKEDEV checks
for more than one of the  -m -p -s -t args (and checks whether any were given
to pick one if not) to be more shell friendly.

Note that while the method here is the same as was discussed on the list,
the actual implementation is free of the typos, and just pure lunacy that
was in the code that was shown there.

Also note these changes are intended to be completely internal, there
should be no visible impact upon the way that MAKEDEV works.

ok:christos.   Thanks to pgoyette for the code review.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.183 src/etc/MAKEDEV.tmpl:1.184
--- src/etc/MAKEDEV.tmpl:1.183	Thu Sep  8 15:00:08 2016
+++ src/etc/MAKEDEV.tmpl	Thu Jun  8 03:42:37 2017
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.183 2016/09/08 15:00:08 nonaka Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.184 2017/06/08 03:42:37 kre Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -567,7 +567,9 @@ setup()
 	# mknod is just very slow, because the shell has to fork for
 	# each device node.
 	#
-	if ! ( $do_mtree || $do_pax || $do_mknod || $do_specfile ); then
+
+	case ",${do_mtree},,${do_pax},,${do_mknod},,${do_specfile}," in
+	( ,false,,false,,false,,false, )
 		if check_mtree "${TOOL_MTREE}"; then
 			do_mtree=true
 		elif check_pax "${TOOL_PAX}"; then
@@ -575,16 +577,10 @@ setup()
 		else
 			do_mknod=true
 		fi
-	fi
-
-	# Now we need exactly one node-creation method.
-	case $(( $($do_mtree && echo 1 || echo 0) + \
-		$($do_pax && echo 1 || echo 0) + \
-		$($do_mknod && echo 1 || echo 0) + \
-		$($do_specfile && echo 1 || echo 0) ))
-	in
-	1)	: OK ;;
-	*)	die "-m, -p, -s, and -t options are mutually exclusive" ;;
+		;;
+	( *,true,*,true,* )
+		die "-m, -p, -s, and -t options are mutually exclusive"
+		;;
 	esac
 
 	# If we are using mknod, then decide what options to pass it.
@@ -599,7 +595,7 @@ setup()
 
 	# do_mtree or do_pax internally implies do_specfile.
 	# This happens after checking for mutually-exclusive options.
-	if ($do_mtree || $do_pax) && ! $do_specfile; then
+	if $do_mtree || $do_pax && ! $do_specfile; then
 		do_specfile=true
 		opts="${opts} -s"
 	fi

Reply via email to