diff --git a/etc/MAKEDEV.tmpl b/etc/MAKEDEV.tmpl index 3fef93eb5cad..c74c0d265c41 100644 --- a/etc/MAKEDEV.tmpl +++ b/etc/MAKEDEV.tmpl @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.25 2004/06/08 19:03:14 christos Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.26 2004/06/19 05:31:50 christos Exp $ # # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. @@ -165,7 +165,7 @@ # # Pseudo terminals: # ptm pty multiplexor device. -# pty* set of 62 master and slave pseudo terminals +# pty* set of 16 master and slave pseudo terminals # opty first 16 ptys, to save inodes on install media # ipty first 2 ptys, for install media use only # @@ -420,7 +420,7 @@ case $i in all) makedev all_md - makedev std fd ptm pty0 + makedev std fd ptm pty0 pty1 pty2 pty3 makedev ccd0 ccd1 ccd2 ccd3 makedev cgd0 cgd1 cgd2 cgd3 makedev fss0 fss1 fss2 fss3 @@ -760,30 +760,49 @@ opty) pty*) class=${i#pty} - set -- p q r s t u v w x y z P Q R S T - if [ "$class" -ge $# ]; then - warn "$i: pty unit must be between 0 and 15" + d1="p q r s t u v w x y z P Q R S T" + if [ "$class" -ge 64 ] + then + warn "$i: pty unit must be between 0 and 63" continue + elif [ "$class" -lt 16 ] + then + offset=0 + mult=0 + d2="0 1 2 3 4 5 6 7 8 9 a b c d e f" + else + class=$(($class - 16)) + offset=256 + mult=2 + d2="g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" fi - shift $class - name=$1 - if [ "$name" = v ]; then + start=$(($class * 16)) + set -- $d2 + nt=$# + s1=$(($start / $nt)) + set -- $d1 + shift $s1 + t1=$1 + if [ "$t1" = v ]; then warn "$i: pty unit conflicts with console ttyv0 device" continue fi - jn=0 - unit=$(($class * 16)) - set -- - 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - while - shift - j=$1 - [ -n "$j" ] + s2=$(($start % $nt - $s1 * $mult)) + set -- $d2 + shift $s2 + t2=$1 + unit=$(($start + $offset - $s1 * $mult)) + end=$(($unit + 16)) + while [ "$unit" -lt "$end" ] do - if [ $j = g ]; then - unit=$(($unit + $class * 30 + 256 - 16)) + mkdev tty$t1$t2 c %pts_chr% $unit 666 + mkdev pty$t1$t2 c %ptc_chr% $unit 666 + shift + t2=$1 + if [ -z "$t2" ] + then + break fi - mkdev tty$name$j c %pts_chr% $unit 666 - mkdev pty$name$j c %ptc_chr% $unit 666 unit=$(($unit + 1)) done ;;