[BACK]Return to MAKEDEV.mi CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/MAKEDEV.mi, Revision 1.78

1.72      miod        1: define(COMM,`#')dnl
1.1       todd        2: include(MAKEDEV.sub)dnl
                      3: dnl
1.78    ! todd        4: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.77 2005/10/06 06:43:19 otto Exp $-})dnl
1.1       todd        5: dnl
                      6: divert(1)dnl
                      7: {-#-}
1.71      todd        8: {-#-} Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
1.1       todd        9: {-#-}
1.60      todd       10: {-#-} Permission to use, copy, modify, and distribute this software for any
                     11: {-#-} purpose with or without fee is hereby granted, provided that the above
                     12: {-#-} copyright notice and this permission notice appear in all copies.
1.1       todd       13: {-#-}
1.60      todd       14: {-#-} THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     15: {-#-} WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     16: {-#-} MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     17: {-#-} ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     18: {-#-} WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     19: {-#-} ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     20: {-#-} OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       todd       21: {-#-}
1.72      miod       22: define(quote,{-"$1" -})dnl
                     23: include(MAKEDEV.common)dnl
1.1       todd       24: dnl
1.72      miod       25: __devtitle(make, {-Device "make" file.  Valid arguments-})dnl
                     26: __devitem({-all-}, {-all-}, {-makes all known devices{-,-} including local devices.
1.1       todd       27: {-#-}          Tries to make the ``standard'' number of each type.-})dnl
1.72      miod       28: __devitem(std,{-std-},Standard devices)dnl
                     29: __devitem(local,local,Configuration specific devices)dnl
1.18      todd       30: dnl
1.1       todd       31: dnl _std
                     32: dnl
                     33: dnl $1: tty
                     34: dnl $2: memstuff
                     35: dnl $3: ksyms
                     36: dnl $4: drum
                     37: dnl $5: klog
                     38: dnl
1.72      miod       39: define({-_std-},{-dnl
1.1       todd       40: std)
                     41:        M console       c 0 0 600
                     42:        M tty           c $1 0
                     43:        M mem           c $2 0 640 kmem
                     44:        M kmem          c $2 1 640 kmem
                     45:        M null          c $2 2
                     46:        M zero          c $2 12
                     47:        M stdin         c major_fdesc_c 0
                     48:        M stdout        c major_fdesc_c 1
                     49:        M stderr        c major_fdesc_c 2
                     50:        M ksyms         c $3 0 640 kmem
                     51:        M drum          c $4 0 640 kmem
                     52:        M klog          c $5 0 600-})dnl
                     53: dnl
                     54: divert(1)dnl
1.72      miod       55: define(__mddivert,7)dnl
1.78    ! todd       56: include(MAKEDEV.md)dnl
1.1       todd       57: dnl
                     58: dnl
                     59: divert(0)dnl
                     60: #!/bin/sh -
                     61: #
                     62: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
                     63: # generated from:
                     64: #
                     65: show_vers()dnl <-- now that all files are included, show versions
                     66: #
                     67: dnl
                     68: divert(2)dnl
                     69: PATH=/sbin:/usr/sbin:/bin:/usr/bin
                     70: T=$0
                     71:
                     72: # set this to echo for Echo-Only debugging
                     73: [ "$eo" ] || eo=
                     74:
                     75: hex()
                     76: {
                     77:        case ${--}1 in
1.26      deraadt    78:        [0-9]) echo -n {-$-}1;;
                     79:        10) echo -n a;;
                     80:        11) echo -n b;;
                     81:        12) echo -n c;;
                     82:        13) echo -n d;;
                     83:        14) echo -n e;;
                     84:        15) echo -n f;;
1.1       todd       85:        esac
1.65      todd       86: }
                     87:
                     88: alph2d()
                     89: {
1.73      david      90:        local t="$1"
1.65      todd       91:        local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                     92:        local sub=${p%${t}*}
                     93:        echo ${#sub}
1.1       todd       94: }
1.26      deraadt    95:
1.62      todd       96: h2d()
1.1       todd       97: {
1.62      todd       98:        local s="$1"
                     99:        local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
                    100:
                    101:        echo $(($(_h2d $f)*16+ $(_h2d $n) ))
                    102: }
                    103:
                    104: _h2d()
                    105: {
                    106:        case $1 in
                    107:        [0-9]) echo -n $1;;
                    108:        a) echo -n 10;;
                    109:        b) echo -n 11;;
                    110:        c) echo -n 12;;
                    111:        d) echo -n 13;;
                    112:        e) echo -n 14;;
                    113:        f) echo -n 15;;
1.1       todd      114:        esac
                    115: }
1.26      deraadt   116:
1.1       todd      117: unt()
                    118: {
                    119:        # XXX pdksh can't seem to deal with locally scoped variables
                    120:        # in ${foo#$bar} expansions
                    121:        arg="{-$-}1"
                    122:        tmp="${arg#[a-zA-Z]*}"
                    123:        tmp="${tmp%*[a-zA-Z]}"
                    124:        while [ "$tmp" != "$arg" ]
                    125:        do
                    126:                arg=$tmp
                    127:                tmp="${arg#[a-zA-Z]*}"
                    128:                tmp="${tmp%*[a-zA-Z]}"
                    129:        done
                    130:        echo $arg
                    131: }
                    132: dnl
1.29      todd      133: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5       todd      134: dnl   arg: 1    2    3      4      5    6    7
1.1       todd      135: dnl
1.26      deraadt   136:
1.1       todd      137: dodisk()
                    138: {
1.27      todd      139:        [ "$DEBUG" ] && set -x
1.29      todd      140:        n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.13      todd      141:        [ 0$7 -ne 8 ] && l="i j k l m n o p"
                    142:        for d in a b c d e f g h $l
1.1       todd      143:        do
1.76      otto      144:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n, $count) 640 operator
1.75      otto      145:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n, $count) 640 operator
1.1       todd      146:                let count=count+1
                    147:        done
                    148: }
                    149: dnl
1.29      todd      150: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1       todd      151: dnl
                    152: dnl 1. name    - prefix name of the device
                    153: dnl 2. unit    - beginning unit number for block devices
                    154: dnl 3. blkmaj  - block device major number
                    155: dnl 4. chrmaj  - character device major number
                    156: dnl 5. unit    - beginning unit number for character devices
                    157: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1.5       todd      158: dnl 7. step    - optional, defaults to 16, number of partitions per device
1.1       todd      159: dnl
1.26      deraadt   160:
1.1       todd      161: dodisk2()
                    162: {
1.29      todd      163:        n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1       todd      164:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
                    165:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29      todd      166:        n=Add($n, 2)
1.1       todd      167:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
                    168:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
                    169: }
                    170:
                    171: # M name b/c major minor [mode] [group]
1.77      otto      172: RMlist[0]="rm -f"
1.26      deraadt   173:
1.1       todd      174: mkl() {
                    175: dnl
                    176: dnl non multi mknod
                    177: dnl
1.77      otto      178:        mklist[{-$-}{#mklist[*]}]=";mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
1.1       todd      179: }
1.26      deraadt   180:
1.1       todd      181: M() {
1.77      otto      182:        RMlist[{-$-}{#RMlist[*]}]={-$-}1
1.1       todd      183:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
                    184:        G={-$-}{6:-wheel}
                    185:        [ "{-$-}7" ] && {
1.77      otto      186:                MKlist[{-$-}{#MKlist[*]}]=";chown {-$-}7:{-$-}G {-$-}1"
1.1       todd      187:        } || {
                    188:                case $G in
1.77      otto      189:                wheel)
                    190:                        [ {-$-}{#whlist[*]} = 0 ] && whlist[0]=";chgrp wheel"
                    191:                        whlist[{-$-}{#whlist[*]}]="$1"
                    192:                ;;
                    193:                operator)
                    194:                        [ {-$-}{#oplist[*]} = 0 ] && oplist[0]=";chgrp operator"
                    195:                        oplist[{-$-}{#oplist[*]}]="$1"
                    196:                ;;
                    197:                *)
                    198:                        MKlist[{-$-}{#MKlist[*]}]=";chgrp $G $1";
1.1       todd      199:                esac
                    200:        }
                    201:        return 0
                    202: }
                    203: divert(7)dnl
                    204: dnl
                    205: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
                    206: dnl on the following line:
                    207:
                    208: show_devs()dnl
                    209: dnl
                    210: divert(9)dnl
                    211: *)
                    212:        echo $i: unknown device
                    213:        ;;
                    214: esac
                    215: done
                    216: }
                    217: _recurse "$@"
1.77      otto      218: {
                    219: echo -n ${RMlist[*]}
                    220: echo -n ${mklist[*]}
                    221: echo -n ${MKlist[*]}
                    222: echo -n ${whlist[*]}
                    223: echo ${oplist[*]}
                    224: } | if [ "$eo" = "echo" ]; then
                    225:         cat
1.1       todd      226: else
1.77      otto      227:        sh
1.1       todd      228: fi
1.41      todd      229: divert(3)dnl
1.1       todd      230: dnl
1.26      deraadt   231:
1.1       todd      232: R() {
1.23      todd      233: [ "$DEBUG" ] && set -x
1.1       todd      234: for i in "$@"
                    235: do
                    236: U=`unt $i`
                    237: [ "$U" ] || U=0
                    238:
                    239: case $i in
                    240: dnl