Replace hexprint with a version that is much faster for values > 15.

Since I managed to commit my alternate scheme for zeropad, delete
the commented out lines and replace the only other use.
I've not deleted the function itself though.
This commit is contained in:
dsl 2007-03-09 19:16:47 +00:00
parent 814e248430
commit b1c0dd5ffc
2 changed files with 12 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: MAKEDEV.tmpl,v 1.80 2007/03/09 13:57:54 dsl Exp $
# $NetBSD: MAKEDEV.tmpl,v 1.81 2007/03/09 19:16:47 dsl Exp $
#
# Copyright (c) 2003,2007 The NetBSD Foundation, Inc.
# All rights reserved.
@ -340,16 +340,14 @@ zeropad()
#
hexprint()
{
case $1 in
[0-9]) echo $1 ;;
10) echo a ;;
11) echo b ;;
12) echo c ;;
13) echo d ;;
14) echo e ;;
15) echo f ;;
*) echo $(hexprint $(($1 / 16)))$(hexprint $(($1 % 16))) ;;
esac
val="$(($1 + 0))"
hex=
set -- 0 1 2 3 4 5 6 7 8 9 a b c d e f
while [ "$val" -gt 0 ]; do
eval hex=\$$(($val % 16 + 1))\$hex
val="$(($val / 16))"
done
echo "${hex:-0}"
}
setup()
@ -791,7 +789,6 @@ ttyCY*)
eminor=$(($minor + $off))
while [ $minor -lt $eminor ]
do
# nminor=$(zeropad 3 $minor)
nminor=000$minor
nminor=${nminor#${nminor%???}}
mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
@ -807,7 +804,6 @@ ttyCZ*)
eminor=$(($minor + $off))
while [ $minor -lt $eminor ]
do
# nminor=$(zeropad 4 $minor)
nminor=0000$minor
nminor=${nminor#${nminor%????}}
mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
@ -830,7 +826,6 @@ tty[0-9]|tty0[0-9])
tty0*|tty1*|tty[0-9])
unit=${i#tty}
# ounit=$(zeropad 2 $unit)
ounit=00$unit
ounit=${ounit#${ounit%??}}
mkdev tty$ounit c %com_chr% $(($unit + $dialin )) "" "" $u_uucp

View File

@ -1,4 +1,4 @@
# $NetBSD: MAKEDEV.conf,v 1.10 2007/01/15 23:35:12 hubertf Exp $
# $NetBSD: MAKEDEV.conf,v 1.11 2007/03/09 19:16:48 dsl Exp $
all_md)
makedev mt0 mt1 ts0 ts1 st0 st1 uk0 ss0 cd0 vt0
@ -96,7 +96,8 @@ dz*)
while [ $i -lt 8 ]
do
oi=$(($unit * 8 + $i))
zoi=$(zeropad 2 $oi)
zoi=00$oi
zoi=${zoi#${zoi%??}}
mkdev tty$zoi c 1 $oi
i=$(($i + 1))
done