Use shell arithmetic instead of awk. (avoid awk in miniroot).

This commit is contained in:
ragge 1998-12-08 21:43:06 +00:00
parent f7373c1eba
commit 2a5432c589

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: MAKEDEV,v 1.21 1998/11/21 23:41:55 oster Exp $
# $NetBSD: MAKEDEV,v 1.22 1998/12/08 21:43:06 ragge Exp $
#
# @(#)MAKEDEV 8.1 (Berkeley) 6/9/93
#
@ -302,9 +302,12 @@ dz*)
unit=${i#dz};
case $unit in
[0-7])
eval `echo $unit | awk ' { u = $1 } END {
for (i = 0; i < 8; i++)
printf("mknod tty%02d c 1 %d; ",u*8+i,u*8+i); }'`
i=0
while [ $i -lt 8 ]; do
no=$(($unit * 8 + $i))
`printf "mknod tty%02d c 1 %d\n" $no $no`
i=$(($i + 1))
done
;;
*)
echo bad unit for dz in: $i
@ -348,24 +351,19 @@ dhu*|dh*|dmf*|dmz*|vt*)
*) echo bad unit for $name in: $i ;;
esac;;
esac
eval `echo $ch $unit $major $count |
awk ' { ch = $1; u = $4 * $2; m = $3; cnt = $4 } END {
for (i = 0; i < cnt; i++)
if (i < 10)
printf("mknod tty%s%x c %d %d; ",ch,i,m,u+i);
else
printf("mknod tty%s%c c %d %d; ",ch,87+i,m,u+i); }'`
i=0
while [ $i -lt $count ]; do
`printf "mknod tty%s%x c %d %d\n" \
$ch $i $major $(($unit * $count + $i))`
i=$(($i + 1))
done
;;
dl*)
unit=${i#dl}
major=66
eval `echo $unit $major |
awk '{unit = $1; major = $2} END {
if (unit < 10)
printf("mknod ttyJ%x c %d %d", unit, major, unit);
else
printf("mknod ttyJ%c c %d %d", 87+unit, major, unit); }'`
`printf "mknod ttyJ%x c %d %d\n" $unit $major $unit`
;;
lp*|va*|vp*)
@ -439,11 +437,11 @@ np*)
esac
case $class in
0|1|2)
eval `echo $offset | awk ' { b=$1 } END {
for (i = 0; i < 4; i++)
printf("mknod np%02d c 39 %d;", \
b+i, b+i); }'`
;;
i=0
while [ $i -lt 4 ]; do
`printf "mknod np%02d c 39 %d\n" $(($offset + $i)) $(($offset + $i))`
i=$(($i + 1))
done
esac
;;