Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc As (briefly) discussed on current-users, change the way ...



details:   https://anonhg.NetBSD.org/src/rev/46c28b117101
branches:  trunk
changeset: 824523:46c28b117101
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Jun 08 03:42:37 2017 +0000

description:
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.

diffstat:

 etc/MAKEDEV.tmpl |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (51 lines):

diff -r 83cf76e803cc -r 46c28b117101 etc/MAKEDEV.tmpl
--- a/etc/MAKEDEV.tmpl  Thu Jun 08 03:39:18 2017 +0000
+++ b/etc/MAKEDEV.tmpl  Thu Jun 08 03:42:37 2017 +0000
@@ -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 @@
        # 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 @@
                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 @@
 
        # 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



Home | Main Index | Thread Index | Old Index