-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.h
286 lines (251 loc) · 4.46 KB
/
defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/*
* UNIX shell
*/
/* error exits from various parts of shell */
#define ERROR 1
#define SYNBAD 2
#define SIGFAIL 3
#define SIGFLG 0200
/* command tree */
#define FPRS 020
#define FINT 040
#define FAMP 0100
#define FPIN 0400
#define FPOU 01000
#define FPCL 02000
#define FCMD 04000
#define COMMSK 017
#define TCOM 0
#define TPAR 1
#define TFIL 2
#define TLST 3
#define TIF 4
#define TWH 5
#define TUN 6
#define TSW 7
#define TAND 8
#define TORF 9
#define TFORK 10
#define TFOR 11
/* execute table */
#define SYSSET 1
#define SYSCD 2
#define SYSEXEC 3
#define SYSLOGIN 4
#define SYSTRAP 5
#define SYSEXIT 6
#define SYSSHFT 7
#define SYSWAIT 8
#define SYSCONT 9
#define SYSBREAK 10
#define SYSEVAL 11
#define SYSDOT 12
#define SYSRDONLY 13
#define SYSTIMES 14
#define SYSXPORT 15
#define SYSNULL 16
#define SYSREAD 17
#define SYSTST 18
#define SYSUMASK 19
/* used for input and output of shell */
#define INIO 10
#define OTIO 11
/*io nodes*/
#define USERIO 10
#define IOUFD 15
#define IODOC 16
#define IOPUT 32
#define IOAPP 64
#define IOMOV 128
#define IORDW 256
#define INPIPE 0
#define OTPIPE 1
/* arg list terminator */
#define ENDARGS 0
#include "mac.h"
#include "mode.h"
#include "name.h"
/* result type declarations */
#define alloc malloc
ADDRESS alloc();
VOID addblok();
STRING make();
STRING movstr();
TREPTR cmd();
TREPTR makefork();
NAMPTR lookup();
VOID setname();
VOID setargs();
DOLPTR useargs();
REAL expr();
STRING catpath();
STRING getpath();
STRING *scan();
STRING mactrim();
STRING macro();
STRING execs();
VOID await();
VOID post();
STRING copyto();
VOID exname();
STRING staknam();
VOID printnam();
VOID printflg();
VOID prs();
VOID prc();
VOID getenv();
STRING *setenv();
#define attrib(n,f) (n->namflg |= f)
#define round(a,b) (((int)((ADR(a)+b)-1))&~((b)-1))
#define closepipe(x) (close(x[INPIPE]), close(x[OTPIPE]))
#define eq(a,b) (cf(a,b)==0)
#define max(a,b) ((a)>(b)?(a):(b))
#define assert(x) ;
/* temp files and io */
UFD output;
INT ioset;
IOPTR iotemp; /* files to be deleted sometime */
IOPTR iopend; /* documents waiting to be read at NL */
/* substitution */
INT dolc;
STRING *dolv;
DOLPTR argfor;
ARGPTR gchain;
/* stack */
#define BLK(x) ((BLKPTR)(x))
#define BYT(x) ((BYTPTR)(x))
#define STK(x) ((STKPTR)(x))
#define ADR(x) ((char*)(x))
/* stak stuff */
#include "stak.h"
/* string constants */
MSG atline;
MSG readmsg;
MSG colon;
MSG minus;
MSG nullstr;
MSG sptbnl;
MSG unexpected;
MSG endoffile;
MSG synmsg;
/* name tree and words */
SYSTAB reserved;
INT wdval;
INT wdnum;
ARGPTR wdarg;
INT wdset;
BOOL reserv;
/* prompting */
MSG stdprompt;
MSG supprompt;
MSG profile;
/* built in names */
NAMNOD fngnod;
NAMNOD ifsnod;
NAMNOD homenod;
NAMNOD mailnod;
NAMNOD pathnod;
NAMNOD ps1nod;
NAMNOD ps2nod;
/* special names */
MSG flagadr;
STRING cmdadr;
STRING exitadr;
STRING dolladr;
STRING pcsadr;
STRING pidadr;
MSG defpath;
/* names always present */
MSG mailname;
MSG homename;
MSG pathname;
MSG fngname;
MSG ifsname;
MSG ps1name;
MSG ps2name;
/* transput */
CHAR tmpout[];
STRING tmpnam;
INT serial;
#define TMPNAM 7
FILE standin;
#define input (standin->fdes)
#define eof (standin->feof)
INT peekc;
STRING comdiv;
MSG devnull;
/* flags */
#define noexec 01
#define intflg 02
#define prompt 04
#define setflg 010
#define errflg 020
#define ttyflg 040
#define forked 0100
#define oneflg 0200
#define rshflg 0400
#define waiting 01000
#define stdflg 02000
#define execpr 04000
#define readpr 010000
#define keyflg 020000
INT flags;
/* error exits from various parts of shell */
#include <setjmp.h>
jmp_buf subshell;
jmp_buf errshell;
/* fault handling */
#include "brkincr.h"
POS brkincr;
#define MINTRAP 0
#define MAXTRAP 17
#define INTR 2
#define QUIT 3
#define MEMF 11
#define ALARM 14
#define KILL 15
#define TRAPSET 2
#define SIGSET 4
#define SIGMOD 8
VOID fault();
BOOL trapnote;
STRING trapcom[];
BOOL trapflg[];
/* name tree and words */
STRING *environ;
CHAR numbuf[];
MSG export;
MSG readonly;
/* execflgs */
INT exitval;
BOOL execbrk;
INT loopcnt;
INT breakcnt;
/* messages */
MSG mailmsg;
MSG coredump;
MSG badopt;
MSG badparam;
MSG badsub;
MSG nospace;
MSG notfound;
MSG badtrap;
MSG baddir;
MSG badshift;
MSG illegal;
MSG restricted;
MSG execpmsg;
MSG notid;
MSG wtfailed;
MSG badcreate;
MSG piperr;
MSG badopen;
MSG badnum;
MSG arglist;
MSG txtbsy;
MSG toobig;
MSG badexec;
MSG notfound;
MSG badfile;
address end[];
#include "ctype.h"