1: #
2: /*
3: * UNIX shell
4: */
5:
6:
7: #define BYTESPERWORD (sizeof(char *))
8:
9: TYPE char CHAR;
10: TYPE char BOOL;
11: TYPE int UFD;
12: TYPE int INT;
13: TYPE float REAL;
14: TYPE char *ADDRESS;
15: TYPE long int L_INT;
16: TYPE int VOID;
17: TYPE unsigned POS;
18: TYPE char *STRING;
19: TYPE char MSG[];
20: TYPE int PIPE[];
21: TYPE char *STKPTR;
22: TYPE char *BYTPTR;
23:
24: STRUCT stat STATBUF; /* defined in /usr/sys/stat.h */
25: STRUCT blk *BLKPTR;
26: STRUCT fileblk FILEBLK;
27: STRUCT filehdr FILEHDR;
28: STRUCT fileblk *FILE;
29: STRUCT trenod *TREPTR;
30: STRUCT forknod *FORKPTR;
31: STRUCT comnod *COMPTR;
32: STRUCT swnod *SWPTR;
33: STRUCT regnod *REGPTR;
34: STRUCT parnod *PARPTR;
35: STRUCT ifnod *IFPTR;
36: STRUCT whnod *WHPTR;
37: STRUCT fornod *FORPTR;
38: STRUCT lstnod *LSTPTR;
39: STRUCT argnod *ARGPTR;
40: STRUCT dolnod *DOLPTR;
41: STRUCT ionod *IOPTR;
42: STRUCT namnod NAMNOD;
43: STRUCT namnod *NAMPTR;
44: STRUCT sysnod SYSNOD;
45: STRUCT sysnod *SYSPTR;
46: STRUCT sysnod SYSTAB[];
47: #define NIL ((char*)0)
48:
49:
50: /* the following nonsense is required
51: * because casts turn an Lvalue
52: * into an Rvalue so two cheats
53: * are necessary, one for each context.
54: */
55: union { int _cheat;};
56: #define Lcheat(a) ((a)._cheat)
57: #define Rcheat(a) ((int)(a))
58:
59:
60: /* address puns for storage allocation */
61: UNION {
62: FORKPTR _forkptr;
63: COMPTR _comptr;
64: PARPTR _parptr;
65: IFPTR _ifptr;
66: WHPTR _whptr;
67: FORPTR _forptr;
68: LSTPTR _lstptr;
69: BLKPTR _blkptr;
70: NAMPTR _namptr;
71: BYTPTR _bytptr;
72: } address;
73:
74:
75: /* for functions that do not return values */
76: struct void {INT vvvvvvvv;};
77:
78:
79: /* heap storage */
80: struct blk {
81: BLKPTR word;
82: };
83:
84: #define BUFSIZ 64
85: struct fileblk {
86: UFD fdes;
87: POS flin;
88: BOOL feof;
89: CHAR fsiz;
90: STRING fnxt;
91: STRING fend;
92: STRING *feval;
93: FILE fstak;
94: CHAR fbuf[BUFSIZ];
95: };
96:
97: /* for files not used with file descriptors */
98: struct filehdr {
99: UFD fdes;
100: POS flin;
101: BOOL feof;
102: CHAR fsiz;
103: STRING fnxt;
104: STRING fend;
105: STRING *feval;
106: FILE fstak;
107: CHAR _fbuf[1];
108: };
109:
110: struct sysnod {
111: STRING sysnam;
112: INT sysval;
113: };
114:
115: /* this node is a proforma for those that follow */
116: struct trenod {
117: INT tretyp;
118: IOPTR treio;
119: };
120:
121: /* dummy for access only */
122: struct argnod {
123: ARGPTR argnxt;
124: CHAR argval[1];
125: };
126:
127: struct dolnod {
128: DOLPTR dolnxt;
129: INT doluse;
130: CHAR dolarg[1];
131: };
132:
133: struct forknod {
134: INT forktyp;
135: IOPTR forkio;
136: TREPTR forktre;
137: };
138:
139: struct comnod {
140: INT comtyp;
141: IOPTR comio;
142: ARGPTR comarg;
143: ARGPTR comset;
144: };
145:
146: struct ifnod {
147: INT iftyp;
148: TREPTR iftre;
149: TREPTR thtre;
150: TREPTR eltre;
151: };
152:
153: struct whnod {
154: INT whtyp;
155: TREPTR whtre;
156: TREPTR dotre;
157: };
158:
159: struct fornod {
160: INT fortyp;
161: TREPTR fortre;
162: STRING fornam;
163: COMPTR forlst;
164: };
165:
166: struct swnod {
167: INT swtyp;
168: STRING swarg;
169: REGPTR swlst;
170: };
171:
172: struct regnod {
173: ARGPTR regptr;
174: TREPTR regcom;
175: REGPTR regnxt;
176: };
177:
178: struct parnod {
179: INT partyp;
180: TREPTR partre;
181: };
182:
183: struct lstnod {
184: INT lsttyp;
185: TREPTR lstlef;
186: TREPTR lstrit;
187: };
188:
189: struct ionod {
190: INT iofile;
191: STRING ioname;
192: IOPTR ionxt;
193: IOPTR iolst;
194: };
195:
196: #define FORKTYPE (sizeof(struct forknod))
197: #define COMTYPE (sizeof(struct comnod))
198: #define IFTYPE (sizeof(struct ifnod))
199: #define WHTYPE (sizeof(struct whnod))
200: #define FORTYPE (sizeof(struct fornod))
201: #define SWTYPE (sizeof(struct swnod))
202: #define REGTYPE (sizeof(struct regnod))
203: #define PARTYPE (sizeof(struct parnod))
204: #define LSTTYPE (sizeof(struct lstnod))
205: #define IOTYPE (sizeof(struct ionod))
Defined variables
BOOL
defined in line
10; used 20 times
CHAR
defined in line
9; used 44 times
- in line 89-94(2),
102-107(2),
124,
130
- in /usr/src/cmd/sh/args.c line
15-17(2)
- in /usr/src/cmd/sh/cmd.c line
319
- in /usr/src/cmd/sh/defs.h line
191,
247
- in /usr/src/cmd/sh/expand.c line
106,
118
- in /usr/src/cmd/sh/io.c line
111-112(2)
- in /usr/src/cmd/sh/macro.c line
13-21(4),
30-33(2),
50-52(2),
66,
155,
172,
212
- in /usr/src/cmd/sh/main.c line
20
- in /usr/src/cmd/sh/name.c line
32,
118,
204
- in /usr/src/cmd/sh/print.c line
12,
43,
86-88(2)
- in /usr/src/cmd/sh/service.c line
256-257(2)
- in /usr/src/cmd/sh/string.c line
24-27(2)
- in /usr/src/cmd/sh/word.c line
19-20(2),
71-73(2),
87
INT
defined in line
12; used 123 times
- in line 76,
112-117(2),
129-134(2),
140,
147,
154,
160,
167,
179-184(2),
190
- in /usr/src/cmd/sh/args.c line
20,
27-29(2),
73
- in /usr/src/cmd/sh/blok.c line
32,
91-94(2)
- in /usr/src/cmd/sh/cmd.c line
32,
43,
66-67(2),
119,
151,
215,
279,
317,
367
- in /usr/src/cmd/sh/defs.h line
119-124(2),
151-154(3),
193-198(2),
217,
252-255(3)
- in /usr/src/cmd/sh/error.c line
48
- in /usr/src/cmd/sh/expand.c line
30-33(2),
117,
128,
163
- in /usr/src/cmd/sh/fault.c line
20-22(2),
49,
59,
68,
83,
95,
103
- in /usr/src/cmd/sh/io.c line
60,
70,
79,
91,
113
- in /usr/src/cmd/sh/macro.c line
60-63(2),
186,
210-214(2)
- in /usr/src/cmd/sh/main.c line
31-34(2),
97,
170
- in /usr/src/cmd/sh/name.c line
50,
65,
113,
119,
155,
178,
292
- in /usr/src/cmd/sh/print.c line
53,
66,
73,
87
- in /usr/src/cmd/sh/service.c line
17,
35,
83,
170-175(3),
183-185(2),
198-211(8),
275,
300-301(2),
323-327(2),
340-345(3)
- in /usr/src/cmd/sh/stak.c line
19-22(2)
- in /usr/src/cmd/sh/string.c line
23,
37,
48
- in /usr/src/cmd/sh/word.c line
21,
88,
119
- in /usr/src/cmd/sh/xec.c line
13,
24,
33-34(2),
45,
70,
109,
122,
173,
307,
361
L_INT
defined in line
15; used 3 times
MSG
defined in line
19; used 97 times
PIPE
defined in line
20;
never used
POS
defined in line
17; used 9 times
REAL
defined in line
13; used 1 times
STKPTR
defined in line
21; used 16 times
STRING
defined in line
18; used 141 times
- in line 90-92(3),
103-105(3),
111,
162,
168,
191
- in /usr/src/cmd/sh/args.c line
12,
28-34(5),
69-72(2),
86,
101-106(6)
- in /usr/src/cmd/sh/defs.h line
83-84(2),
92-102(8),
108,
125,
173-177(5),
192,
199,
242-246(2)
- in /usr/src/cmd/sh/error.c line
32,
42,
67
- in /usr/src/cmd/sh/expand.c line
31-36(3),
75,
115,
160-162(2),
185
- in /usr/src/cmd/sh/fault.c line
13,
69,
96
- in /usr/src/cmd/sh/io.c line
27,
68,
89
- in /usr/src/cmd/sh/macro.c line
18,
65-67(2),
148-149(2),
180
- in /usr/src/cmd/sh/main.c line
32
- in /usr/src/cmd/sh/msg.c line
89
- in /usr/src/cmd/sh/name.c line
29-33(2),
53,
64-67(2),
88-89(2),
96,
105,
114,
154,
160-163(3),
174,
202,
238,
248-251(2),
286,
300,
310-312(2)
- in /usr/src/cmd/sh/print.c line
33-35(2),
84
- in /usr/src/cmd/sh/service.c line
18,
34,
68-71(3),
84,
93-98(4),
109-116(5),
127-131(4),
253-255(2),
266-278(5),
298,
311-314(2),
341-343(2)
- in /usr/src/cmd/sh/stak.c line
50
- in /usr/src/cmd/sh/string.c line
16-17(2),
25,
38,
49-51(2)
- in /usr/src/cmd/sh/xec.c line
35,
44,
335,
382-387(2),
409
UFD
defined in line
11; used 7 times
VOID
defined in line
16; used 47 times
- in /usr/src/cmd/sh/args.c line
68
- in /usr/src/cmd/sh/blok.c line
52,
77
- in /usr/src/cmd/sh/cmd.c line
14-15(2),
21-23(3),
308,
358,
365,
373,
391
- in /usr/src/cmd/sh/defs.h line
82,
88-89(2),
98-107(8),
240
- in /usr/src/cmd/sh/expand.c line
27,
159
- in /usr/src/cmd/sh/fault.c line
19
- in /usr/src/cmd/sh/main.c line
25,
93
- in /usr/src/cmd/sh/name.c line
63,
225,
235,
259,
270,
284,
294,
302
- in /usr/src/cmd/sh/print.c line
32,
42
- in /usr/src/cmd/sh/service.c line
13,
31,
112,
182,
197,
297
- in /usr/src/cmd/sh/stak.c line
58
Defined struct's
blk
defined in line
80;
never used
Defined macros
NIL
defined in line
47; used 11 times
Rcheat
defined in line
57; used 11 times
Usage of this include