Avoid unnecessary calls to expr(1) by using standard shell arithmetic

expansion instead.

MFC after:	1 week
This commit is contained in:
sheldonh 2001-11-20 17:56:34 +00:00
parent 5c66b3e7ce
commit 6f870e52d3

View File

@ -422,21 +422,21 @@ wt*)
u=`expr $i : '..\(.*\)'`
if [ -z "${u}" ]; then u=0; fi
# default density, 512b blocks
mknod rwt${u} c 10 `expr 0 + $u` root:operator
mknod nrwt${u} c 10 `expr 4 + $u` root:operator
mknod rwt${u} c 10 $(( 0 + $u)) root:operator
mknod nrwt${u} c 10 $(( 4 + $u)) root:operator
# default density, 1024b blocks
# mknod rWt${u} c 10 `expr 64 + $u` root:operator
# mknod nrWt${u} c 10 `expr 68 + $u` root:operator
mknod rwt${u}b c 10 `expr 16 + $u` root:operator # 60 megabytes
mknod nrwt${u}b c 10 `expr 20 + $u` root:operator
mknod rwt${u}c c 10 `expr 24 + $u` root:operator # 120 megabytes
mknod nrwt${u}c c 10 `expr 28 + $u` root:operator
mknod rwt${u}d c 10 `expr 32 + $u` root:operator # 150 megabytes
mknod nrwt${u}d c 10 `expr 36 + $u` root:operator
# mknod rwt${u}e c 10 `expr 40 + $u` root:operator # 300 megabytes?
# mknod nrwt${u}e c 10 `expr 44 + $u` root:operator
# mknod rwt${u}f c 10 `expr 48 + $u` root:operator # 600 megabytes?
# mknod nrwt${u}f c 10 `expr 52 + $u` root:operator
# mknod rWt${u} c 10 $((64 + $u)) root:operator
# mknod nrWt${u} c 10 $((68 + $u)) root:operator
mknod rwt${u}b c 10 $((16 + $u)) root:operator # 60 megabytes
mknod nrwt${u}b c 10 $((20 + $u)) root:operator
mknod rwt${u}c c 10 $((24 + $u)) root:operator # 120 megabytes
mknod nrwt${u}c c 10 $((28 + $u)) root:operator
mknod rwt${u}d c 10 $((32 + $u)) root:operator # 150 megabytes
mknod nrwt${u}d c 10 $((36 + $u)) root:operator
# mknod rwt${u}e c 10 $((40 + $u)) root:operator # 300 megabytes?
# mknod nrwt${u}e c 10 $((44 + $u)) root:operator
# mknod rwt${u}f c 10 $((48 + $u)) root:operator # 600 megabytes?
# mknod nrwt${u}f c 10 $((52 + $u)) root:operator
umask 77
;;
@ -525,7 +525,7 @@ fd*)
name=fd; chr=9
case $unit in
0|1|2|3)
mknod ${name}${unit} c $chr `expr $unit '*' 64` root:operator
mknod ${name}${unit} c $chr $(($unit * 64)) root:operator
ln -f ${name}${unit} r${name}${unit}
# Fake BSD partitions
for i in a b c d e f g h
@ -535,13 +535,13 @@ fd*)
done
# User-readable and programmer-readable name sets
mknod ${name}${unit}.1720 c $chr `expr $unit '*' 64 + 1` \
mknod ${name}${unit}.1720 c $chr $(($unit * 64 + 1)) \
root:operator
ln -f ${name}${unit}.1720 r${name}${unit}.1720
# ln -f ${name}${unit}.1720 ${name}${unit}135hs21
# ln -f r${name}${unit}.1720 r${name}${unit}135hs21
mknod ${name}${unit}.1480 c $chr `expr $unit '*' 64 + 2` \
mknod ${name}${unit}.1480 c $chr $(($unit * 64 + 2)) \
root:operator
ln -f ${name}${unit}.1480 r${name}${unit}.1480
# ln -f ${name}${unit}.1480 ${name}${unit}135hs18
@ -549,7 +549,7 @@ fd*)
# ln -f ${name}${unit}.1480 ${name}${unit}96hs18
# ln -f r${name}${unit}.1480 r${name}${unit}96hs18
mknod ${name}${unit}.1440 c $chr `expr $unit '*' 64 + 3` \
mknod ${name}${unit}.1440 c $chr $(($unit * 64 + 3)) \
root:operator
ln -f ${name}${unit}.1440 r${name}${unit}.1440
# ln -f ${name}${unit}.1440 ${name}${unit}135
@ -559,7 +559,7 @@ fd*)
# ln -f ${name}${unit}.1440 ${name}${unit}96ds18
# ln -f r${name}${unit}.1440 r${name}${unit}96ds18
mknod ${name}${unit}.1200 c $chr `expr $unit '*' 64 + 4` \
mknod ${name}${unit}.1200 c $chr $(($unit * 64 + 4)) \
root:operator
ln -f ${name}${unit}.1200 r${name}${unit}.1200
# ln -f ${name}${unit}.1200 ${name}${unit}96
@ -569,7 +569,7 @@ fd*)
# ln -f ${name}${unit}.1200 ${name}${unit}135ds15
# ln -f r${name}${unit}.1200 r${name}${unit}135ds15
mknod ${name}${unit}.820 c $chr `expr $unit '*' 64 + 5` \
mknod ${name}${unit}.820 c $chr $(($unit * 64 + 5)) \
root:operator
ln -f ${name}${unit}.820 r${name}${unit}.820
# ln -f ${name}${unit}.820 ${name}${unit}96hs10
@ -577,7 +577,7 @@ fd*)
# ln -f ${name}${unit}.820 ${name}${unit}135hs10
# ln -f r${name}${unit}.820 r${name}${unit}135hs10
mknod ${name}${unit}.800 c $chr `expr $unit '*' 64 + 6` \
mknod ${name}${unit}.800 c $chr $(($unit * 64 + 6)) \
root:operator
ln -f ${name}${unit}.800 r${name}${unit}.800
# ln -f ${name}${unit}.800 ${name}${unit}96ds10
@ -585,7 +585,7 @@ fd*)
# ln -f ${name}${unit}.800 ${name}${unit}135ds10
# ln -f r${name}${unit}.800 r${name}${unit}135ds10
mknod ${name}${unit}.720 c $chr `expr $unit '*' 64 + 7` \
mknod ${name}${unit}.720 c $chr $(($unit * 64 + 7)) \
root:operator
ln -f ${name}${unit}.720 r${name}${unit}.720
# ln -f ${name}${unit}.720 ${name}${unit}96ds9
@ -593,7 +593,7 @@ fd*)
# ln -f ${name}${unit}.720 ${name}${unit}135ds9
# ln -f r${name}${unit}.720 r${name}${unit}135ds9
mknod ${name}${unit}.360 c $chr `expr $unit '*' 64 + 8` \
mknod ${name}${unit}.360 c $chr $(($unit * 64 + 8)) \
root:operator
ln -f ${name}${unit}.360 r${name}${unit}.360
# ln -f ${name}${unit}.360 ${name}${unit}48
@ -601,7 +601,7 @@ fd*)
# ln -f ${name}${unit}.360 ${name}${unit}48ds9
# ln -f r${name}${unit}.360 r${name}${unit}48ds9
mknod ${name}${unit}.640 c $chr `expr $unit '*' 64 + 9` \
mknod ${name}${unit}.640 c $chr $(($unit * 64 + 9)) \
root:operator
ln -f ${name}${unit}.640 r${name}${unit}.640
# ln -f ${name}${unit}.640 ${name}${unit}96ds8
@ -609,7 +609,7 @@ fd*)
# ln -f ${name}${unit}.640 ${name}${unit}135ds8
# ln -f r${name}${unit}.640 r${name}${unit}135ds8
mknod ${name}${unit}.1232 c $chr `expr $unit '*' 64 + 10` \
mknod ${name}${unit}.1232 c $chr $(($unit * 64 + 10)) \
root:operator
ln -f ${name}${unit}.1232 r${name}${unit}.1232
# ln -f ${name}${unit}.1232 ${name}${unit}96ds8
@ -703,7 +703,7 @@ pt[0-9]*)
if [ -z "${unit}" ]; then
unit=0
fi
unit=`expr $unit + 1 - 1`
unit=$(($unit + 1 - 1))
mknod ${name}${unit} c $chr `unit2minor $unit`
;;
@ -715,7 +715,7 @@ ses[0-9]*)
if [ -z "${unit}" ]; then
unit=0
fi
unit=`expr $unit + 1 - 1`
unit=$(($unit + 1 - 1))
mknod ${name}${unit} c $chr `unit2minor $unit`
;;
# SCSI target mode sample driver
@ -726,7 +726,7 @@ targ[0-9]*)
if [ -z "${unit}" ]; then
unit=0
fi
unit=`expr $unit + 1 - 1`
unit=$(($unit + 1 - 1))
mknod ${name}${unit} c $chr `unit2minor $unit`
mknod ${name}.ctl c $chr 0xffff00ff
;;
@ -859,9 +859,9 @@ ast*)
chr=119
case $unit in
0|1|2|3)
mknod rast${unit} c $chr `expr $unit '*' 8 + 0` root:operator
mknod rast${unit} c $chr $(($unit * 8 + 0)) root:operator
chmod 640 rast${unit}
mknod nrast${unit} c $chr `expr $unit '*' 8 + 1` root:operator
mknod nrast${unit} c $chr $(($unit * 8 + 1)) root:operator
chmod 640 nrast${unit}
;;
*)
@ -938,17 +938,17 @@ matcd*)
esac
case $unit in
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
mknod ${name}${unit}a c $chr `expr $unit '*' 8 + 0` \
mknod ${name}${unit}a c $chr $(($unit * 8 + 0)) \
root:operator
mknod ${name}${unit}c c $chr `expr $unit '*' 8 + 2` \
mknod ${name}${unit}c c $chr $(($unit * 8 + 2)) \
root:operator
ln -f ${name}${unit}a r${name}${unit}a
ln -f ${name}${unit}c r${name}${unit}c
chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
mknod ${name}${unit}la c $chr `expr $unit '*' 8 + 128` \
mknod ${name}${unit}la c $chr $(($unit * 8 + 128)) \
root:operator
mknod ${name}${unit}lc c $chr `expr $unit '*' 8 + 130` \
mknod ${name}${unit}lc c $chr $(($unit * 8 + 130)) \
root:operator
ln -f ${name}${unit}la r${name}${unit}la
ln -f ${name}${unit}lc r${name}${unit}lc
@ -967,8 +967,8 @@ wcd*)
chr=69
case $unit in
0|1|2|3|4|5|6|7)
mknod wcd${unit}a c $chr `expr $unit '*' 8 + 0` root:operator
mknod wcd${unit}c c $chr `expr $unit '*' 8 + 2` root:operator
mknod wcd${unit}a c $chr $(($unit * 8 + 0)) root:operator
mknod wcd${unit}c c $chr $(($unit * 8 + 2)) root:operator
ln -f wcd${unit}a rwcd${unit}a
ln -f wcd${unit}c rwcd${unit}c
chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
@ -986,7 +986,7 @@ wst*)
chr=90
case $unit in
0|1|2|3)
mknod rwst${unit} c $chr `expr $unit '*' 8 + 0` root:operator
mknod rwst${unit} c $chr $(($unit * 8 + 0)) root:operator
chmod 640 rwst${unit}
;;
esac
@ -1048,7 +1048,7 @@ ulpt*)
unit=`expr $i : 'ulpt\(.*\)'`
minor=`unit2minor $unit`
mknod ulpt$unit c 113 $minor
minor=`unit2minor \`expr $unit + 64\``
minor=`unit2minor $(($unit + 64))`
mknod unlpt$unit c 113 $minor # and the 'no prime' version
;;
@ -1107,7 +1107,7 @@ umodem*)
lpt*)
unit=`expr $i : 'lpt\(.*\)'`
mknod lpt$unit c 16 `unit2minor $unit`
mknod lpctl$unit c 16 `unit2minor \`expr $unit + 128\``
mknod lpctl$unit c 16 `unit2minor $(($unit + 128))`
;;
# Use this to create virtual consoles for syscons, pcvt or codrv
@ -1154,9 +1154,9 @@ cuaa?|cua?)
umask 7
unit=`expr $i : 'cua.*\(.\)$'`
m=`ttyminor $unit`
mknod cuaa$unit c 28 `expr $m + 128` uucp:dialer
mknod cuaia$unit c 28 `expr $m + 32 + 128` uucp:dialer
mknod cuala$unit c 28 `expr $m + 64 + 128` uucp:dialer
mknod cuaa$unit c 28 $(($m + 128)) uucp:dialer
mknod cuaia$unit c 28 $(($m + 32 + 128)) uucp:dialer
mknod cuala$unit c 28 $(($m + 64 + 128)) uucp:dialer
umask 77
;;
@ -1164,8 +1164,8 @@ tty0?|ttyd?|tty?)
unit=`expr $i : 'tty.*\(.\)$'`
m=`ttyminor $unit`
mknod ttyd$unit c 28 $m
mknod ttyid$unit c 28 `expr $m + 32`
mknod ttyld$unit c 28 `expr $m + 64`
mknod ttyid$unit c 28 $(($m + 32))
mknod ttyld$unit c 28 $(($m + 64))
;;
cuac?)
@ -1177,11 +1177,11 @@ cuac?)
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor`
minor=$(($card * 65536 + $minor))
name=$card$unit
mknod cuac$name c $major `expr $minor + 128` uucp:dialer
mknod cuaic$name c $major `expr $minor + 32 + 128` uucp:dialer
mknod cualc$name c $major `expr $minor + 64 + 128` uucp:dialer
mknod cuac$name c $major $(($minor + 128)) uucp:dialer
mknod cuaic$name c $major $(($minor + 32 + 128)) uucp:dialer
mknod cualc$name c $major $(($minor + 64 + 128)) uucp:dialer
done
umask 77
;;
@ -1194,11 +1194,11 @@ ttyc?)
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor`
minor=$(($card * 65536 + $minor))
name=$card$unit
mknod ttyc$name c $major $minor
mknod ttyic$name c $major `expr $minor + 32`
mknod ttylc$name c $major `expr $minor + 64`
mknod ttyic$name c $major $(($minor + 32))
mknod ttylc$name c $major $(($minor + 64))
done
;;
@ -1208,7 +1208,7 @@ cuam?)
umask 7
unit=`expr $i : 'cua.*\(.\)$'`
m=`ttyminor $unit`
mknod cuam$unit c 63 `expr $m + 128` uucp:dialer
mknod cuam$unit c 63 $(($m + 128)) uucp:dialer
umask 77
;;
@ -1229,8 +1229,8 @@ ttyA*)
minor=$(expr $port - 1)
name=$(zeropad 2 $port)
mknod ttyA$name c $major $minor
mknod ttyiA$name c $major `expr $minor + 65536`
mknod ttylA$name c $major `expr $minor + 131072`
mknod ttyiA$name c $major $(($minor + 65536))
mknod ttylA$name c $major $(($minor + 131072))
port=$(($port + 1))
done
# For the user-mode control program, 'sicontrol'
@ -1245,10 +1245,10 @@ cuaA*)
while [ $port -le $units ]; do
minor=$(expr $port - 1)
name=$(zeropad 2 $port)
mknod cuaA$name c $major `expr $minor + 128` uucp:dialer
mknod cuaiA$name c $major `expr $minor + 128 + 65536` \
mknod cuaA$name c $major $(($minor + 128)) uucp:dialer
mknod cuaiA$name c $major $(($minor + 128 + 65536)) \
uucp:dialer
mknod cualA$name c $major `expr $minor + 128 + 131072` \
mknod cualA$name c $major $(($minor + 128 + 131072)) \
uucp:dialer
port=$(($port + 1))
done
@ -1278,11 +1278,11 @@ ttyD?)
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor`
minor=$(($card * 65536 + $minor))
name=$card$unit
mknod ttyD$name c $major $minor
mknod ttyiD$name c $major `expr $minor + 32`
mknod ttylD$name c $major `expr $minor + 64`
mknod ttyiD$name c $major $(($minor + 32))
mknod ttylD$name c $major $(($minor + 64))
done
# Also create devices for the digi driver
@ -1290,11 +1290,11 @@ ttyD?)
major=162
card=`expr $i : 'tty.*\(.\)$'`
rm -f digi$card.ctl
mknod digi$card.ctl c $major $(($card \* 65536 + 8388608)) uucp:dialer
mknod digi$card.ctl c $major $(($card * 65536 + 8388608)) uucp:dialer
unit=0
while [ $unit -lt 16 ]
do
base=`expr $card \* 65536 + $unit`
base=$(($card * 65536 + $unit))
name=$card.$unit
rm -f tty*D$name
mknod ttyD$name c $major $base
@ -1313,22 +1313,22 @@ cuaD?)
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor`
minor=$(($card * 65536 + $minor))
name=$card$unit
mknod cuaD$name c $major `expr $minor + 128` uucp:dialer
mknod cuaiD$name c $major `expr $minor + 32 + 128` uucp:dialer
mknod cualD$name c $major `expr $minor + 64 + 128` uucp:dialer
mknod cuaD$name c $major $(($minor + 128)) uucp:dialer
mknod cuaiD$name c $major $(($minor + 32 + 128)) uucp:dialer
mknod cualD$name c $major $(($minor + 64 + 128)) uucp:dialer
done
# Also create devices for the digi driver
major=162
card=`expr $i : 'cua.*\(.\)$'`
rm -f digi$card.ctl
mknod digi$card.ctl c $major $(($card \* 65536 + 8388608)) uucp:dialer
mknod digi$card.ctl c $major $(($card * 65536 + 8388608)) uucp:dialer
unit=0
while [ $unit -lt 16 ]
do
base=`expr $card \* 65536 + $unit`
base=$(($card * 65536 + $unit))
name=$card.$unit
rm -f cua*D$name
mknod cuaD$name c $major $(($base + 4194304)) uucp:dialer
@ -1349,18 +1349,18 @@ ttyM*)
for unit in $modulelist
do
moduleminor=`ttyminor $unit`
moduleminor=`expr $moduleminor % 10 \* 16`
moduleminor=$(($moduleminor % 10 * 16))
modulename=$unit
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor + $moduleminor`
minor=$(($card * 65536 + $minor + $moduleminor))
name=$card$modulename$unit
rm -f tty*M$name
mknod ttyM$name c $major $minor
mknod ttyiM$name c $major `expr $minor + 64`
mknod ttylM$name c $major `expr $minor + 128`
mknod ttyiM$name c $major $(($minor + 64))
mknod ttylM$name c $major $(($minor + 128))
done
done
;;
@ -1374,20 +1374,20 @@ cuaM?)
for unit in $modulelist
do
moduleminor=`ttyminor $unit`
moduleminor=`expr $moduleminor % 10 \* 16`
moduleminor=$(($moduleminor % 10 * 16))
modulename=$unit
for unit in $portlist
do
minor=`ttyminor $unit`
minor=`expr $card \* 65536 + $minor + $moduleminor`
minor=$(($card * 65536 + $minor + $moduleminor))
name=$card$modulename$unit
rm -f cua*M$name
mknod cuaM$name c $major `expr $minor + 262144` \
mknod cuaM$name c $major $(($minor + 262144)) \
uucp:dialer
mknod cuaiM$name c $major `expr $minor + 64 + 262144` \
mknod cuaiM$name c $major $(($minor + 64 + 262144)) \
uucp:dialer
mknod cualM$name c $major `expr $minor + 128 + 262144` \
mknod cualM$name c $major $(($minor + 128 + 262144)) \
uucp:dialer
done
done
@ -1480,14 +1480,14 @@ mse*)
unit=`expr $i : 'mse\(.*\)'`
chr=27
# non-blocking for X11
mknod mse$unit c $chr `unit2minor \`expr $unit '*' 2 + 1\``
mknod mse$unit c $chr `unit2minor $(($unit * 2 + 1))`
;;
psm*)
unit=`expr $i : 'psm\(.*\)'`
chr=21
# non-blocking for X11
mknod psm$unit c $chr `unit2minor \`expr $unit '*' 2 + 1\``
mknod psm$unit c $chr `unit2minor $(($unit * 2 + 1))`
;;
mouse*)
@ -1534,16 +1534,16 @@ snd*)
ln -fs music$unit music
ln -fs pss$unit pss
mknod mixer$unit c $chr `unit2minor \`expr $unit '*' 16 + 0\``
mknod sequencer$unit c $chr `unit2minor \`expr $unit '*' 16 + 1\``
mknod midi$unit c $chr `unit2minor \`expr $unit '*' 16 + 2\``
mknod dsp$unit c $chr `unit2minor \`expr $unit '*' 16 + 3\``
mknod audio$unit c $chr `unit2minor \`expr $unit '*' 16 + 4\``
mknod dspW$unit c $chr `unit2minor \`expr $unit '*' 16 + 5\``
mknod mixer$unit c $chr `unit2minor $(($unit * 16 + 0))`
mknod sequencer$unit c $chr `unit2minor $(($unit * 16 + 1))`
mknod midi$unit c $chr `unit2minor $(($unit * 16 + 2))`
mknod dsp$unit c $chr `unit2minor $(($unit * 16 + 3))`
mknod audio$unit c $chr `unit2minor $(($unit * 16 + 4))`
mknod dspW$unit c $chr `unit2minor $(($unit * 16 + 5))`
mknod sndstat c $chr 6
# minor number 7 is unused
mknod music$unit c $chr `unit2minor \`expr $unit '*' 16 + 8\``
mknod pss$unit c $chr `unit2minor \`expr $unit '*' 16 + 9\``
mknod music$unit c $chr `unit2minor $(($unit * 16 + 8))`
mknod pss$unit c $chr `unit2minor $(($unit * 16 + 9))`
# minor number 10 is unused
mknod midistat c $chr 11
# minor numbers 12-15 are unused
@ -1594,8 +1594,8 @@ ttyx?|ttyy?|ttyz?)
*c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
esac
case $i in
ttyy?) unit=`expr $unit \+ 16`;;
ttyz?) unit=`expr $unit \+ 32`;;
ttyy?) unit=$(($unit \+ 16));;
ttyz?) unit=$(($unit \+ 32));;
esac
mknod $i c 42 $unit
;;
@ -1630,8 +1630,8 @@ meteor?)
bktr?)
unit=`expr $i : 'bktr\(.*\)'`
mknod bktr$unit c 92 `unit2minor $unit`
mknod tuner$unit c 92 `unit2minor $((16 + $unit ))`
mknod vbi$unit c 92 `unit2minor $((32 + $unit ))`
mknod tuner$unit c 92 `unit2minor $((16 + $unit))`
mknod vbi$unit c 92 `unit2minor $((32 + $unit))`
chmod 444 bktr$unit tuner$unit vbi$unit
;;
@ -1697,12 +1697,12 @@ labpc*)
fi
case $unit in
0|1|2|3|4|5|6|7)
mknod $name$unit c 66 `expr $offset + $unit `
mknod $name$unit c 66 $(($offset + $unit))
;;
all)
for i in $all
do
mknod $name$i c 66 `expr $offset + $i `
mknod $name$i c 66 $(($offset + $i))
done
;;
*)
@ -1746,7 +1746,7 @@ i4brbch*)
i4bteld*)
offset=64
unit=`expr $i : 'i4bteld\(.*\)'`
mknod i4bteld$unit c 56 `unit2minor \`expr $offset + $unit\``
mknod i4bteld$unit c 56 `unit2minor $(($offset + $unit))`
;;
i4btel*)