|
|
1.1 root 1: #include "master.pri"
2: #include "rt.h"
3: #include "format.pri"
4: #include <CC/stdio.h>
5: #include <signal.h>
6: SRCFILE("main.c")
7:
8: void ErrExit(char *e)
9: {
10: fprintf(stderr, "%s\n", e);
11: exit(1);
12: }
13:
14: char *getenv(char*), *Getwd();
15: char *CD;
16: char *DEVKMEM = "/dev/kmem";
17: char *PADSTERM;
18: char *TAPTO;
19: char *UNIX = "/vmunix";
20: char *PATH;
21:
22: void PadsRemInit();
23: char *PadsTermInit(char*);
24:
25: void LoadTerm(char **av)
26: {
27: if (av[0] && !strcmp(av[0],"-R")) {
28: PadsRemInit();
29: return;
30: }
31: if (av[0] && !strcmp(av[0],"-r") && av[1])
32: ErrExit(PadsTermInit(av[1]));
33: if( PadsInit(PADSTERM) )
34: ErrExit("cannot load terminal");
35: }
36:
37: void mainbatch(char **av)
38: {
39: char *core = "core", *aout = "a.out";
40: if( *av ) core = *av++;
41: if( *av ) aout = *av++;
42: new BatchMaster(core, aout);
43: exit(0);
44: }
45:
46: void mainpi(char **av)
47: {
48: if(av[0] && !strcmp(av[0],"-t") ) {
49: mainbatch(av+1);
50: av += 2;
51: }
52: LoadTerm(av);
53: extern char *TapTo;
54: TapTo = TAPTO;
55: NewHelp();
56: NewWd();
57: new HostMaster();
58: PadsServe();
59: }
60:
61: void mainrtpi(char **av)
62: {
63: LoadTerm(av);
64: extern char *TapTo;
65: TapTo = TAPTO;
66: NewHelp();
67: NewWd();
68: new RtConnections;
69: PadsServe();
70: }
71:
72: void main(int, char **av)
73: {
74: char *e;
75: if( e = getenv("PADSTERM") ) PADSTERM = e;
76: if( e = getenv("UNIX") ) UNIX = e;
77: if( e = getenv("DEVKMEM") ) DEVKMEM = e;
78: if( e = getenv("PATH") ) PATH = e;
79: CD = sf( "builtin cd %s;", Getwd() );
80: ::signal(SIGCHLD, SIG_IGN);
81:
82: char *base = basename(*av++);
83: if( !strcmp(base,"rtpi") )
84: mainrtpi(av);
85: else
86: mainpi(av);
87: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.