From 29ac5231c262259e3f10b03c621165d86f19f17b Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Sun, 11 May 1997 02:21:59 +0000 Subject: [PATCH] hex () and kill awk --- src/etc/etc.pmax/MAKEDEV | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/etc/etc.pmax/MAKEDEV b/src/etc/etc.pmax/MAKEDEV index 2ba5b484..52fb0551 100644 --- a/src/etc/etc.pmax/MAKEDEV +++ b/src/etc/etc.pmax/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: MAKEDEV,v 1.12 1997/04/23 20:39:04 gvf Exp $ +# $OpenBSD: MAKEDEV,v 1.13 1997/05/11 02:21:59 deraadt Exp $ # @(#)MAKEDEV 8.1 (Berkeley) 6/9/93 # @@ -34,6 +34,20 @@ PATH=/sbin:/bin/:/usr/bin:/usr/sbin umask 77 + +hex () +{ + case $1 in + [0-9]) echo -n $1 ;; + 10) echo -n a;; + 11) echo -n b;; + 12) echo -n c;; + 13) echo -n d;; + 14) echo -n e;; + 15) echo -n f;; + esac +} + for i do case $i in @@ -60,9 +74,8 @@ std) mknod stdout c 7 1 ; chmod 666 stdout mknod stderr c 7 2 ; chmod 666 stderr mkdir fd > /dev/null 2>&1 - (cd fd && eval `echo "" | awk ' BEGIN { \ - for (i = 0; i < 64; i++) \ - printf("mknod %d c 7 %d;", i, i)}'`) + n=0 + (cd fd && while [ $n -lt 64 ]; do mknod $n c 7 $n; n="$(( $n + 1 ))"; done) chown -R root.wheel fd chmod 555 fd chmod 666 fd/* @@ -199,11 +212,15 @@ pty*) case $class in 0|1|2|3|4) umask 0 - eval `echo $offset $name | awk ' { b=$1; n=$2 } END { - for (i = 0; i < 16; i++) - printf("mknod tty%s%x c 4 %d;" \ - "mknod pty%s%x c 5 %d; ", \ - n, i, b+i, n, i, b+i); }'` + n=0 + while [ $n -lt 16 ] + do + nam=$name`hex $n` + rm -rf {tty,pty}$n + mknod tty$nam c 4 "$(( $offset + $n ))" + mknod pty$nam c 5 "$(( $offset + $n ))" + n="$(( $n + 1 ))" + done umask 77 if [ $class = 1 ]; then mv ttyqf ttyv0; mv ptyqf ptyv0