Annotation of lucent/sys/src/9/port/mkdevc, revision 1.1.1.1

1.1       root        1: #!/bin/rc
                      2: 
                      3: if(! ~ $#* 1){
                      4:        echo usage: mkdevc file >[1=2]
                      5:        exit 1
                      6: }
                      7: 
                      8: #
                      9: # The following programs are allowed to be placed in #/ as
                     10: # file systems for root
                     11: #
                     12: rootfilsys='kfs|dossrv|k9660srv'
                     13: 
                     14: cat <<'---'
                     15: #include       "u.h"
                     16: #include       "../port/lib.h"
                     17: #include       "mem.h"
                     18: #include       "dat.h"
                     19: #include       "fns.h"
                     20: #include       "../port/error.h"
                     21: 
                     22: #include       "devtab.h"
                     23: 
                     24: Dev    devtab[]={
                     25: ---
                     26: 
                     27: ../port/mkextract dev 0 $* | awk '{
                     28:        print " { "  $1 "reset, "\
                     29:        $1 "init, "\
                     30:        $1 "attach, "\
                     31:        $1 "clone, "\
                     32:        $1 "walk, "\
                     33:        $1 "stat, "\
                     34:        $1 "open, "\
                     35:        $1 "create,"
                     36:        print "   "\
                     37:        $1 "close, "\
                     38:        $1 "read, "\
                     39:        $1 "write, "\
                     40:        $1 "remove, "\
                     41:        $1 "wstat, },"
                     42:        }'
                     43: echo '};'
                     44: ../port/mkextract dev 0 $* | awk '
                     45:        BEGIN{
                     46:                printf "Rune *devchar=L\"" }
                     47:        {       printf "%s", $2 }
                     48:        END{    printf "\";\n"
                     49:         }
                     50:        '
                     51: 
                     52: ../port/mkextract stream 0 $* | awk '
                     53:        BEGIN{  print "extern Qinfo perminfo;" }
                     54:        {       print "extern Qinfo\t" $1 "info;" }
                     55:        '
                     56: ../port/mkextract link 0 $* | awk '
                     57:        {       print "extern void\t" $1 "link(void);" }
                     58:        '
                     59: ../port/mkextract misc 0 $* | sed -n 's/[      ]*(.*)\.root/\1/p' | awk '
                     60:        /^'$rootfilsys'$/       {       print "extern uchar\tfscode[];"
                     61:                                print "extern ulong\tfslen;"
                     62:                                next }
                     63:                        {       print "extern uchar\t" $1 "code[];"
                     64:                                print "extern ulong\t" $1 "len;" }
                     65:        '
                     66: ../port/mkextract stream 0 $* | awk '
                     67:        BEGIN{  print "void streaminit(void){\n\tnewqinfo(&perminfo);" }
                     68:        {       print "\tnewqinfo(&" $1 "info);" }
                     69:        '
                     70: ../port/mkextract link 0 $* | awk '
                     71:        { print "\t" $1 "link();" }
                     72:        '
                     73: ../port/mkextract misc 0 $* | sed -n 's/[      ]*(.*)\.root/\1/p' | awk '
                     74:        /^'$rootfilsys'$/       { print "\taddrootfile(\"fs\", fscode, fslen);"
                     75:                                  next }
                     76:                        { print "\taddrootfile(\"" $1 "\", " $1 "code, " $1 "len);" }
                     77:        '
                     78: echo '}'
                     79: 
                     80: ../port/mkextract port 0 $*
                     81: 
                     82: if(! grep conffile $* > /dev/null)echo 'char   *conffile = "'$1'";'
                     83: echo 'ulong    kerndate = KERNDATE;'

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.