summaryrefslogtreecommitdiff
path: root/etc/MAKEDEV.mi
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-10-06 06:43:20 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-10-06 06:43:20 +0000
commitaaf447c6703e4106894ec906a8962831391bc769 (patch)
tree2e16e36390c6b004c56ece3addec83ccf2edc5a8 /etc/MAKEDEV.mi
parent65c4205b299c9f25669fee2e37fae88dede57b82 (diff)
Greatly speedup MAKEDEV by using arrays instead of very long strings
that get copied around a lot. Needs sh(1) max array index bump I committed earlier. ok todd@ deraadt@
Diffstat (limited to 'etc/MAKEDEV.mi')
-rw-r--r--etc/MAKEDEV.mi61
1 files changed, 24 insertions, 37 deletions
diff --git a/etc/MAKEDEV.mi b/etc/MAKEDEV.mi
index 982564c6deb..e971c769666 100644
--- a/etc/MAKEDEV.mi
+++ b/etc/MAKEDEV.mi
@@ -1,7 +1,7 @@
define(COMM,`#')dnl
include(MAKEDEV.sub)dnl
dnl
-vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.76 2005/10/04 18:33:52 otto Exp $-})dnl
+vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.77 2005/10/06 06:43:19 otto Exp $-})dnl
dnl
divert(1)dnl
{-#-}
@@ -169,45 +169,34 @@ dodisk2()
}
# M name b/c major minor [mode] [group]
-RMlist="rm -f"
-MKlist=":"
+RMlist[0]="rm -f"
mkl() {
dnl
-dnl uncomment if multi mknod happens
-dnl
-ifelse(1, 0,
-[ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
- mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
- modes="$modes {-$-}1"
- },
-dnl
dnl non multi mknod
dnl
- [ "${mklist[{-$-}1]}" ] && {
- mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
- } || {
- mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
- modes="$modes {-$-}1"
- })
+ mklist[{-$-}{#mklist[*]}]=";mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
}
M() {
- RMlist="$RMlist {-$-}1"
+ RMlist[{-$-}{#RMlist[*]}]={-$-}1
mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
G={-$-}{6:-wheel}
[ "{-$-}7" ] && {
- MKlist="$MKlist;chown {-$-}7:{-$-}G {-$-}1"
+ MKlist[{-$-}{#MKlist[*]}]=";chown {-$-}7:{-$-}G {-$-}1"
} || {
case $G in
- wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;_lkm)g=61;;
+ wheel)
+ [ {-$-}{#whlist[*]} = 0 ] && whlist[0]=";chgrp wheel"
+ whlist[{-$-}{#whlist[*]}]="$1"
+ ;;
+ operator)
+ [ {-$-}{#oplist[*]} = 0 ] && oplist[0]=";chgrp operator"
+ oplist[{-$-}{#oplist[*]}]="$1"
+ ;;
+ *)
+ MKlist[{-$-}{#MKlist[*]}]=";chgrp $G $1";
esac
- [ "${grplist[$g]}" ] && {
- grplist[$g]="${grplist[$g]} {-$-}1"
- } || {
- groups="$groups $g"
- grplist[$g]="chgrp $G {-$-}1"
- }
}
return 0
}
@@ -226,18 +215,16 @@ esac
done
}
_recurse "$@"
-list="$RMlist"
-for mode in $modes; do
- list="$list;${mklist[$mode]}"
-done
-for group in $groups; do
- list="$list;${grplist[$group]}"
-done
-list="$list;$MKlist"
-if [ "$eo" = "echo" ]; then
- $eo "$list"
+{
+echo -n ${RMlist[*]}
+echo -n ${mklist[*]}
+echo -n ${MKlist[*]}
+echo -n ${whlist[*]}
+echo ${oplist[*]}
+} | if [ "$eo" = "echo" ]; then
+ cat
else
- echo "$list" | sh
+ sh
fi
divert(3)dnl
dnl