Annotation of researchv9/jtools/src/pi/v9main.c, revision 1.1

1.1     ! root        1: #include "master.pri"
        !             2: #include "format.pri"
        !             3: #include <CC/stdio.h>
        !             4: SRCFILE("main.c")
        !             5: 
        !             6: void ErrExit(char *e)
        !             7: {
        !             8:        fprintf(stderr, "%s\n", e);
        !             9:        exit(1);
        !            10: }
        !            11: 
        !            12: char *getenv(char*), *Getwd();
        !            13: char *CD;
        !            14: char *DEVKMEM = "/dev/kmemr";
        !            15: char *PADSTERM;
        !            16: char *TAPTO;
        !            17: char *UNIX = "";
        !            18: 
        !            19: void PadsRemInit();
        !            20: char *PadsTermInit(char*);
        !            21: 
        !            22: void LoadTerm(char **av)
        !            23: {
        !            24:        if (av[0] && !strcmp(av[0],"-R")) {
        !            25:                PadsRemInit();
        !            26:                return;
        !            27:        }
        !            28:        if (av[0] && !strcmp(av[0],"-r") && av[1])
        !            29:                ErrExit(PadsTermInit(av[1]));
        !            30:        if( PadsInit(PADSTERM) )
        !            31:                ErrExit("cannot load terminal");
        !            32: }
        !            33: 
        !            34: void mainbatch(char **av)
        !            35: {
        !            36:        char *core = "core", *aout = "a.out";
        !            37:        if( *av ) core = *av++;
        !            38:        if( *av ) aout = *av++;
        !            39:        new BatchMaster(core, aout);
        !            40:        exit(0);
        !            41: }
        !            42: 
        !            43: void mainpi(char **av)
        !            44: {
        !            45:        if(av[0] && !strcmp(av[0],"-t") ) {
        !            46:                mainbatch(av+1);
        !            47:                av += 2;
        !            48:        }
        !            49:        LoadTerm(av);
        !            50:        extern char *TapTo;
        !            51:        TapTo = TAPTO;
        !            52:        NewHelp();
        !            53:        NewWd();
        !            54:        new HostMaster();
        !            55:        PadsServe();
        !            56: }
        !            57: 
        !            58: void main(int, char **av)
        !            59: {
        !            60:        char *e;
        !            61:        if( e = getenv("PADSTERM") ) PADSTERM = e;
        !            62:        if( e = getenv("UNIX") ) UNIX = e;
        !            63:        if( e = getenv("DEVKMEM") ) DEVKMEM = e;
        !            64:        CD = sf( "builtin cd %s;", Getwd() );
        !            65: 
        !            66:        av++;
        !            67:        mainpi(av);
        !            68: }

unix.superglobalmegacorp.com

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