Browse Source

hex () and kill awk

OPENBSD_2_1
deraadt 27 years ago
parent
commit
29ac5231c2
1 changed files with 26 additions and 9 deletions
  1. +26
    -9
      src/etc/etc.pmax/MAKEDEV

+ 26
- 9
src/etc/etc.pmax/MAKEDEV View File

@ -1,6 +1,6 @@
#!/bin/sh - #!/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 # @(#)MAKEDEV 8.1 (Berkeley) 6/9/93
# #
@ -34,6 +34,20 @@
PATH=/sbin:/bin/:/usr/bin:/usr/sbin PATH=/sbin:/bin/:/usr/bin:/usr/sbin
umask 77 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 for i
do do
case $i in case $i in
@ -60,9 +74,8 @@ std)
mknod stdout c 7 1 ; chmod 666 stdout mknod stdout c 7 1 ; chmod 666 stdout
mknod stderr c 7 2 ; chmod 666 stderr mknod stderr c 7 2 ; chmod 666 stderr
mkdir fd > /dev/null 2>&1 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 chown -R root.wheel fd
chmod 555 fd chmod 555 fd
chmod 666 fd/* chmod 666 fd/*
@ -199,11 +212,15 @@ pty*)
case $class in case $class in
0|1|2|3|4) 0|1|2|3|4)
umask 0 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 umask 77
if [ $class = 1 ]; then if [ $class = 1 ]; then
mv ttyqf ttyv0; mv ptyqf ptyv0 mv ttyqf ttyv0; mv ptyqf ptyv0


Loading…
Cancel
Save