Commit | Line | Data |
---|---|---|
663a0e37 | 1 | /* $Header: perl.h,v 3.0.1.4 89/12/21 20:07:35 lwall Locked $ |
a687059c LW |
2 | * |
3 | * Copyright (c) 1989, Larry Wall | |
4 | * | |
5 | * You may distribute under the terms of the GNU General Public License | |
6 | * as specified in the README file that comes with the perl 3.0 kit. | |
8d063cd8 LW |
7 | * |
8 | * $Log: perl.h,v $ | |
663a0e37 LW |
9 | * Revision 3.0.1.4 89/12/21 20:07:35 lwall |
10 | * patch7: arranged for certain registers to be restored after longjmp() | |
11 | * patch7: Configure now compiles a test program to figure out time.h fiasco | |
12 | * patch7: Configure now detects DG/UX thingies like [sg]etpgrp2 and utime.h | |
13 | * patch7: memcpy() and memset() return void in __STDC__ | |
14 | * patch7: errno may now be a macro with an lvalue | |
15 | * patch7: ANSI strerror() is now supported | |
16 | * patch7: Xenix support for sys/ndir.h, cross compilation | |
17 | * | |
ffed7fef LW |
18 | * Revision 3.0.1.3 89/11/17 15:28:57 lwall |
19 | * patch5: byteorder now is a hex value | |
20 | * patch5: Configure now looks for <time.h> including <sys/time.h> | |
21 | * | |
ae986130 LW |
22 | * Revision 3.0.1.2 89/11/11 04:39:38 lwall |
23 | * patch2: Configure may now set -DDEBUGGING | |
24 | * patch2: netinet/in.h needed sys/types.h some places | |
25 | * patch2: more <sys/time.h> and <time.h> wrangling | |
26 | * patch2: yydebug moved to where type doesn't matter | |
27 | * | |
03a14243 LW |
28 | * Revision 3.0.1.1 89/10/26 23:17:08 lwall |
29 | * patch1: vfork now conditionally defined based on VFORK | |
30 | * patch1: DEC risc machines have a buggy memcmp | |
31 | * patch1: perl.h now includes <netinet/in.h> if it exists | |
32 | * | |
a687059c LW |
33 | * Revision 3.0 89/10/18 15:21:21 lwall |
34 | * 3.0 baseline | |
8d063cd8 LW |
35 | * |
36 | */ | |
37 | ||
663a0e37 LW |
38 | #ifdef __STDC__ |
39 | #define VOLATILE volatile | |
40 | #define VREG | |
41 | #else | |
42 | #define VOLATILE | |
43 | #define VREG register | |
44 | #endif | |
45 | ||
8d063cd8 LW |
46 | #define VOIDUSED 1 |
47 | #include "config.h" | |
48 | ||
a687059c LW |
49 | #ifdef IAMSUID |
50 | # ifndef TAINT | |
51 | # define TAINT | |
52 | # endif | |
53 | #endif | |
54 | ||
03a14243 LW |
55 | #ifndef VFORK |
56 | # define vfork fork | |
57 | #endif | |
58 | ||
663a0e37 LW |
59 | #ifdef GETPGRP2 |
60 | # ifndef GETPGRP | |
61 | # define GETPGRP | |
62 | # endif | |
63 | # define getpgrp getpgrp2 | |
64 | #endif | |
65 | ||
66 | #ifdef SETPGRP2 | |
67 | # ifndef SETPGRP | |
68 | # define SETPGRP | |
69 | # endif | |
70 | # define setpgrp setpgrp2 | |
71 | #endif | |
72 | ||
ffed7fef | 73 | #if defined(MEMCMP) && defined(mips) && BYTEORDER == 0x1234 |
03a14243 LW |
74 | #undef MEMCMP |
75 | #endif | |
76 | ||
378cc40b | 77 | #ifdef MEMCPY |
663a0e37 LW |
78 | #ifndef memcpy |
79 | #ifdef __STDC__ | |
80 | extern void *memcpy(), *memset(); | |
81 | #else | |
378cc40b | 82 | extern char *memcpy(), *memset(); |
663a0e37 LW |
83 | #endif |
84 | #endif | |
a687059c LW |
85 | #define bcopy(s1,s2,l) memcpy(s2,s1,l) |
86 | #define bzero(s,l) memset(s,0,l) | |
87 | #endif | |
88 | #ifndef BCMP /* prefer bcmp slightly 'cuz it doesn't order */ | |
89 | #define bcmp(s1,s2,l) memcmp(s1,s2,l) | |
8d063cd8 LW |
90 | #endif |
91 | ||
92 | #include <stdio.h> | |
93 | #include <ctype.h> | |
94 | #include <setjmp.h> | |
378cc40b LW |
95 | #include <sys/param.h> /* if this needs types.h we're still wrong */ |
96 | ||
97 | #ifndef _TYPES_ /* If types.h defines this it's easy. */ | |
98 | #ifndef major /* Does everyone's types.h define this? */ | |
8d063cd8 | 99 | #include <sys/types.h> |
378cc40b LW |
100 | #endif |
101 | #endif | |
102 | ||
ae986130 LW |
103 | #ifdef I_NETINET_IN |
104 | #include <netinet/in.h> | |
105 | #endif | |
106 | ||
8d063cd8 | 107 | #include <sys/stat.h> |
135863df | 108 | |
663a0e37 LW |
109 | #ifdef I_TIME |
110 | # include <time.h> | |
ffed7fef | 111 | #endif |
663a0e37 LW |
112 | |
113 | #ifdef I_SYSTIME | |
114 | # ifdef SYSTIMEKERNEL | |
115 | # define KERNEL | |
116 | # endif | |
117 | # include <sys/time.h> | |
118 | # ifdef SYSTIMEKERNEL | |
119 | # undef KERNEL | |
120 | # endif | |
a687059c | 121 | #endif |
135863df | 122 | |
8d063cd8 LW |
123 | #include <sys/times.h> |
124 | ||
663a0e37 LW |
125 | #if defined(STRERROR) && (!defined(MKDIR) || !defined(RMDIR)) |
126 | #undef STRERROR | |
127 | #endif | |
128 | ||
129 | #include <errno.h> | |
130 | #ifndef errno | |
131 | extern int errno; /* ANSI allows errno to be an lvalue expr */ | |
132 | #endif | |
133 | ||
134 | #ifdef STRERROR | |
135 | char *strerror(); | |
136 | #else | |
137 | extern int sys_nerr; | |
138 | extern char *sys_errlist[]; | |
139 | #define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e]) | |
140 | #endif | |
141 | ||
a687059c LW |
142 | #ifdef I_SYSIOCTL |
143 | #ifndef _IOCTL_ | |
144 | #include <sys/ioctl.h> | |
145 | #endif | |
146 | #endif | |
147 | ||
148 | #if defined(mc300) || defined(mc500) || defined(mc700) /* MASSCOMP */ | |
149 | #ifdef SOCKETPAIR | |
150 | #undef SOCKETPAIR | |
151 | #endif | |
152 | #ifdef NDBM | |
153 | #undef NDBM | |
154 | #endif | |
155 | #endif | |
156 | ||
157 | #ifdef NDBM | |
158 | #include <ndbm.h> | |
159 | #define SOME_DBM | |
ae986130 LW |
160 | #ifdef ODBM |
161 | #undef ODBM | |
162 | #endif | |
a687059c LW |
163 | #else |
164 | #ifdef ODBM | |
165 | #ifdef NULL | |
166 | #undef NULL /* suppress redefinition message */ | |
167 | #endif | |
168 | #include <dbm.h> | |
169 | #ifdef NULL | |
170 | #undef NULL | |
171 | #endif | |
172 | #define NULL 0 /* silly thing is, we don't even use this */ | |
173 | #define SOME_DBM | |
174 | #define dbm_fetch(db,dkey) fetch(dkey) | |
175 | #define dbm_delete(db,dkey) delete(dkey) | |
176 | #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent) | |
177 | #define dbm_close(db) dbmclose() | |
178 | #define dbm_firstkey(db) firstkey() | |
179 | #endif /* ODBM */ | |
180 | #endif /* NDBM */ | |
181 | #ifdef SOME_DBM | |
182 | EXT char *dbmkey; | |
183 | EXT int dbmlen; | |
184 | #endif | |
185 | ||
186 | #if INTSIZE == 2 | |
187 | #define htoni htons | |
188 | #define ntohi ntohs | |
189 | #else | |
190 | #define htoni htonl | |
191 | #define ntohi ntohl | |
192 | #endif | |
193 | ||
663a0e37 LW |
194 | #if defined(I_DIRENT) && !defined(xenix) |
195 | # include <dirent.h> | |
196 | # define DIRENT dirent | |
ae986130 | 197 | #else |
663a0e37 LW |
198 | # ifdef I_SYSDIR |
199 | # ifdef hp9000s500 | |
200 | # include <ndir.h> /* may be wrong in the future */ | |
201 | # else | |
202 | # include <sys/dir.h> | |
203 | # endif | |
204 | # define DIRENT direct | |
205 | # else | |
206 | # ifdef I_SYSNDIR | |
207 | # include <sys/ndir.h> | |
208 | # define DIRENT direct | |
209 | # endif | |
210 | # endif | |
a687059c LW |
211 | #endif |
212 | ||
8d063cd8 LW |
213 | typedef struct arg ARG; |
214 | typedef struct cmd CMD; | |
215 | typedef struct formcmd FCMD; | |
216 | typedef struct scanpat SPAT; | |
8d063cd8 | 217 | typedef struct stio STIO; |
378cc40b | 218 | typedef struct sub SUBR; |
8d063cd8 LW |
219 | typedef struct string STR; |
220 | typedef struct atbl ARRAY; | |
221 | typedef struct htbl HASH; | |
378cc40b | 222 | typedef struct regexp REGEXP; |
a687059c LW |
223 | typedef struct stabptrs STBP; |
224 | typedef struct stab STAB; | |
8d063cd8 | 225 | |
378cc40b LW |
226 | #include "handy.h" |
227 | #include "regexp.h" | |
8d063cd8 | 228 | #include "str.h" |
378cc40b | 229 | #include "util.h" |
8d063cd8 LW |
230 | #include "form.h" |
231 | #include "stab.h" | |
232 | #include "spat.h" | |
233 | #include "arg.h" | |
234 | #include "cmd.h" | |
235 | #include "array.h" | |
236 | #include "hash.h" | |
237 | ||
a687059c LW |
238 | #if defined(iAPX286) || defined(M_I286) || defined(I80286) |
239 | # define I286 | |
240 | #endif | |
241 | ||
242 | #ifndef __STDC__ | |
135863df AB |
243 | #ifdef CHARSPRINTF |
244 | char *sprintf(); | |
245 | #else | |
246 | int sprintf(); | |
247 | #endif | |
a687059c | 248 | #endif |
135863df | 249 | |
8d063cd8 LW |
250 | EXT char *Yes INIT("1"); |
251 | EXT char *No INIT(""); | |
252 | ||
a687059c LW |
253 | /* "gimme" values */ |
254 | ||
255 | /* Note: cmd.c assumes that it can use && to produce one of these values! */ | |
256 | #define G_SCALAR 0 | |
257 | #define G_ARRAY 1 | |
258 | ||
259 | #ifdef CRIPPLED_CC | |
260 | int str_true(); | |
261 | #else /* !CRIPPLED_CC */ | |
262 | #define str_true(str) (Str = (str), \ | |
263 | (Str->str_pok ? \ | |
264 | ((*Str->str_ptr > '0' || \ | |
265 | Str->str_cur > 1 || \ | |
266 | (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \ | |
267 | : \ | |
268 | (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) )) | |
269 | #endif /* CRIPPLED_CC */ | |
8d063cd8 | 270 | |
135863df | 271 | #ifdef DEBUGGING |
a687059c LW |
272 | #define str_peek(str) (Str = (str), \ |
273 | (Str->str_pok ? \ | |
274 | Str->str_ptr : \ | |
275 | (Str->str_nok ? \ | |
276 | (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \ | |
277 | (char*)tokenbuf) : \ | |
278 | "" ))) | |
135863df AB |
279 | #endif |
280 | ||
a687059c LW |
281 | #ifdef CRIPPLED_CC |
282 | char *str_get(); | |
283 | #else | |
284 | #ifdef TAINT | |
285 | #define str_get(str) (Str = (str), tainted |= Str->str_tainted, \ | |
286 | (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) | |
287 | #else | |
8d063cd8 | 288 | #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) |
a687059c LW |
289 | #endif /* TAINT */ |
290 | #endif /* CRIPPLED_CC */ | |
291 | ||
292 | #ifdef CRIPPLED_CC | |
293 | double str_gnum(); | |
294 | #else /* !CRIPPLED_CC */ | |
295 | #ifdef TAINT | |
296 | #define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \ | |
297 | (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) | |
298 | #else /* !TAINT */ | |
299 | #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) | |
300 | #endif /* TAINT*/ | |
301 | #endif /* CRIPPLED_CC */ | |
8d063cd8 LW |
302 | EXT STR *Str; |
303 | ||
304 | #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len) | |
305 | ||
a687059c LW |
306 | #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len) |
307 | ||
308 | #ifndef BYTEORDER | |
ffed7fef | 309 | #define BYTEORDER 0x1234 |
a687059c LW |
310 | #endif |
311 | ||
ae986130 LW |
312 | #if defined(htonl) && !defined(HTONL) |
313 | #define HTONL | |
314 | #endif | |
315 | #if defined(htons) && !defined(HTONS) | |
316 | #define HTONS | |
317 | #endif | |
318 | #if defined(ntohl) && !defined(NTOHL) | |
319 | #define NTOHL | |
320 | #endif | |
321 | #if defined(ntohs) && !defined(NTOHS) | |
322 | #define NTOHS | |
323 | #endif | |
a687059c | 324 | #ifndef HTONL |
ffed7fef | 325 | #if (BYTEORDER != 0x4321) && (BYTEORDER != 0x87654321) |
a687059c LW |
326 | #define HTONS |
327 | #define HTONL | |
328 | #define NTOHS | |
329 | #define NTOHL | |
330 | #define MYSWAP | |
331 | #define htons my_swap | |
332 | #define htonl my_htonl | |
333 | #define ntohs my_swap | |
334 | #define ntohl my_ntohl | |
335 | #endif | |
336 | #else | |
ffed7fef | 337 | #if (BYTEORDER == 0x4321) || (BYTEORDER == 0x87654321) |
a687059c LW |
338 | #undef HTONS |
339 | #undef HTONL | |
340 | #undef NTOHS | |
341 | #undef NTOHL | |
342 | #endif | |
343 | #endif | |
344 | ||
8d063cd8 LW |
345 | CMD *add_label(); |
346 | CMD *block_head(); | |
347 | CMD *append_line(); | |
348 | CMD *make_acmd(); | |
349 | CMD *make_ccmd(); | |
a687059c | 350 | CMD *make_icmd(); |
8d063cd8 LW |
351 | CMD *invert(); |
352 | CMD *addcond(); | |
353 | CMD *addloop(); | |
354 | CMD *wopt(); | |
378cc40b | 355 | CMD *over(); |
8d063cd8 | 356 | |
8d063cd8 | 357 | STAB *stabent(); |
378cc40b | 358 | STAB *genstab(); |
8d063cd8 | 359 | |
378cc40b | 360 | ARG *stab2arg(); |
8d063cd8 LW |
361 | ARG *op_new(); |
362 | ARG *make_op(); | |
8d063cd8 LW |
363 | ARG *make_match(); |
364 | ARG *make_split(); | |
a687059c | 365 | ARG *rcatmaybe(); |
378cc40b | 366 | ARG *listish(); |
a687059c | 367 | ARG *maybelistish(); |
378cc40b | 368 | ARG *localize(); |
a687059c LW |
369 | ARG *fixeval(); |
370 | ARG *jmaybe(); | |
378cc40b | 371 | ARG *l(); |
a687059c | 372 | ARG *fixl(); |
378cc40b LW |
373 | ARG *mod_match(); |
374 | ARG *make_list(); | |
375 | ARG *cmd_to_arg(); | |
376 | ARG *addflags(); | |
377 | ARG *hide_ary(); | |
378 | ARG *cval_to_arg(); | |
8d063cd8 | 379 | |
8d063cd8 LW |
380 | STR *str_new(); |
381 | STR *stab_str(); | |
a687059c LW |
382 | |
383 | int do_each(); | |
384 | int do_subr(); | |
385 | int do_match(); | |
386 | int do_unpack(); | |
387 | int eval(); /* this evaluates expressions */ | |
388 | int do_eval(); /* this evaluates eval operator */ | |
389 | int do_assign(); | |
378cc40b LW |
390 | |
391 | SUBR *make_sub(); | |
8d063cd8 LW |
392 | |
393 | FCMD *load_format(); | |
394 | ||
395 | char *scanpat(); | |
396 | char *scansubst(); | |
397 | char *scantrans(); | |
398 | char *scanstr(); | |
399 | char *scanreg(); | |
8d063cd8 LW |
400 | char *str_append_till(); |
401 | char *str_gets(); | |
a687059c | 402 | char *str_grow(); |
8d063cd8 | 403 | |
8d063cd8 LW |
404 | bool do_open(); |
405 | bool do_close(); | |
406 | bool do_print(); | |
378cc40b LW |
407 | bool do_aprint(); |
408 | bool do_exec(); | |
409 | bool do_aexec(); | |
8d063cd8 LW |
410 | |
411 | int do_subst(); | |
378cc40b LW |
412 | int cando(); |
413 | int ingroup(); | |
8d063cd8 | 414 | |
378cc40b LW |
415 | void str_replace(); |
416 | void str_inc(); | |
417 | void str_dec(); | |
8d063cd8 | 418 | void str_free(); |
a687059c | 419 | void stab_clear(); |
378cc40b | 420 | void do_join(); |
378cc40b | 421 | void do_sprintf(); |
a687059c LW |
422 | void do_accept(); |
423 | void do_vecset(); | |
424 | void savelist(); | |
425 | void saveitem(); | |
426 | void saveint(); | |
427 | void savelong(); | |
428 | void savesptr(); | |
429 | void savehptr(); | |
430 | void restorelist(); | |
431 | HASH *savehash(); | |
432 | ARRAY *saveary(); | |
378cc40b LW |
433 | |
434 | EXT line_t line INIT(0); | |
a687059c LW |
435 | EXT line_t subline INIT(0); |
436 | EXT STR *subname INIT(Nullstr); | |
8d063cd8 LW |
437 | EXT int arybase INIT(0); |
438 | ||
439 | struct outrec { | |
378cc40b LW |
440 | line_t o_lines; |
441 | char *o_str; | |
442 | int o_len; | |
8d063cd8 LW |
443 | }; |
444 | ||
445 | EXT struct outrec outrec; | |
446 | EXT struct outrec toprec; | |
447 | ||
a687059c | 448 | EXT STAB *stdinstab INIT(Nullstab); |
8d063cd8 LW |
449 | EXT STAB *last_in_stab INIT(Nullstab); |
450 | EXT STAB *defstab INIT(Nullstab); | |
451 | EXT STAB *argvstab INIT(Nullstab); | |
452 | EXT STAB *envstab INIT(Nullstab); | |
453 | EXT STAB *sigstab INIT(Nullstab); | |
454 | EXT STAB *defoutstab INIT(Nullstab); | |
455 | EXT STAB *curoutstab INIT(Nullstab); | |
456 | EXT STAB *argvoutstab INIT(Nullstab); | |
378cc40b | 457 | EXT STAB *incstab INIT(Nullstab); |
a687059c LW |
458 | EXT STAB *leftstab INIT(Nullstab); |
459 | EXT STAB *amperstab INIT(Nullstab); | |
460 | EXT STAB *rightstab INIT(Nullstab); | |
461 | EXT STAB *DBstab INIT(Nullstab); | |
462 | EXT STAB *DBsub INIT(Nullstab); | |
463 | ||
464 | EXT HASH *defstash; /* main symbol table */ | |
465 | EXT HASH *curstash; /* symbol table for current package */ | |
466 | EXT HASH *debstash; /* symbol table for perldb package */ | |
467 | ||
468 | EXT STR *curstname; /* name of current package */ | |
8d063cd8 LW |
469 | |
470 | EXT STR *freestrroot INIT(Nullstr); | |
378cc40b | 471 | EXT STR *lastretstr INIT(Nullstr); |
a687059c LW |
472 | EXT STR *DBsingle INIT(Nullstr); |
473 | ||
474 | EXT int lastspbase; | |
475 | EXT int lastsize; | |
8d063cd8 | 476 | |
378cc40b LW |
477 | EXT char *filename; |
478 | EXT char *origfilename; | |
8d063cd8 LW |
479 | EXT FILE *rsfp; |
480 | EXT char buf[1024]; | |
a687059c LW |
481 | EXT char *bufptr; |
482 | EXT char *oldbufptr; | |
483 | EXT char *oldoldbufptr; | |
484 | EXT char *bufend; | |
8d063cd8 LW |
485 | |
486 | EXT STR *linestr INIT(Nullstr); | |
487 | ||
488 | EXT char record_separator INIT('\n'); | |
a687059c | 489 | EXT int rslen INIT(1); |
8d063cd8 | 490 | EXT char *ofs INIT(Nullch); |
a687059c | 491 | EXT int ofslen INIT(0); |
8d063cd8 | 492 | EXT char *ors INIT(Nullch); |
a687059c | 493 | EXT int orslen INIT(0); |
8d063cd8 LW |
494 | EXT char *ofmt INIT(Nullch); |
495 | EXT char *inplace INIT(Nullch); | |
a687059c | 496 | EXT char *nointrp INIT(""); |
8d063cd8 | 497 | |
378cc40b LW |
498 | EXT bool preprocess INIT(FALSE); |
499 | EXT bool minus_n INIT(FALSE); | |
500 | EXT bool minus_p INIT(FALSE); | |
501 | EXT bool minus_a INIT(FALSE); | |
502 | EXT bool doswitches INIT(FALSE); | |
503 | EXT bool dowarn INIT(FALSE); | |
504 | EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/ | |
505 | EXT bool sawampersand INIT(FALSE); /* must save all match strings */ | |
506 | EXT bool sawstudy INIT(FALSE); /* do fbminstr on all strings */ | |
a687059c LW |
507 | EXT bool sawi INIT(FALSE); /* study must assume case insensitive */ |
508 | EXT bool sawvec INIT(FALSE); | |
509 | ||
ae986130 LW |
510 | #ifdef CSH |
511 | char *cshname INIT(CSH); | |
512 | int cshlen INIT(0); | |
513 | #endif /* CSH */ | |
a687059c LW |
514 | |
515 | #ifdef TAINT | |
516 | EXT bool tainted INIT(FALSE); /* using variables controlled by $< */ | |
517 | #endif | |
378cc40b LW |
518 | |
519 | #define TMPPATH "/tmp/perl-eXXXXXX" | |
520 | EXT char *e_tmpname; | |
521 | EXT FILE *e_fp INIT(Nullfp); | |
522 | ||
8d063cd8 | 523 | EXT char tokenbuf[256]; |
a687059c LW |
524 | EXT int expectterm INIT(TRUE); /* how to interpret ambiguous tokens */ |
525 | EXT int in_eval INIT(FALSE); /* trap fatal errors? */ | |
526 | EXT int multiline INIT(0); /* $*--do strings hold >1 line? */ | |
527 | EXT int forkprocess; /* so do_open |- can return proc# */ | |
528 | EXT int do_undump INIT(0); /* -u or dump seen? */ | |
529 | EXT int error_count INIT(0); /* how many errors so far, max 10 */ | |
530 | EXT int multi_start INIT(0); /* 1st line of multi-line string */ | |
531 | EXT int multi_end INIT(0); /* last line of multi-line string */ | |
532 | EXT int multi_open INIT(0); /* delimiter of said string */ | |
533 | EXT int multi_close INIT(0); /* delimiter of said string */ | |
8d063cd8 LW |
534 | |
535 | FILE *popen(); | |
536 | /* char *str_get(); */ | |
537 | STR *interp(); | |
538 | void free_arg(); | |
539 | STIO *stio_new(); | |
540 | ||
541 | EXT struct stat statbuf; | |
a687059c LW |
542 | EXT struct stat statcache; |
543 | STAB *statstab INIT(Nullstab); | |
544 | STR *statname; | |
8d063cd8 | 545 | EXT struct tms timesbuf; |
378cc40b LW |
546 | EXT int uid; |
547 | EXT int euid; | |
a687059c LW |
548 | EXT int gid; |
549 | EXT int egid; | |
378cc40b LW |
550 | UIDTYPE getuid(); |
551 | UIDTYPE geteuid(); | |
552 | GIDTYPE getgid(); | |
553 | GIDTYPE getegid(); | |
554 | EXT int unsafe; | |
8d063cd8 LW |
555 | |
556 | #ifdef DEBUGGING | |
557 | EXT int debug INIT(0); | |
558 | EXT int dlevel INIT(0); | |
a687059c LW |
559 | EXT int dlmax INIT(128); |
560 | EXT char *debname; | |
561 | EXT char *debdelim; | |
d96024cf | 562 | #define YYDEBUG 1 |
8d063cd8 | 563 | #endif |
a687059c | 564 | EXT int perldb INIT(0); |
8d063cd8 | 565 | |
378cc40b LW |
566 | EXT line_t cmdline INIT(NOLINE); |
567 | ||
a687059c | 568 | EXT STR str_undef; |
8d063cd8 LW |
569 | EXT STR str_no; |
570 | EXT STR str_yes; | |
571 | ||
572 | /* runtime control stuff */ | |
573 | ||
574 | EXT struct loop { | |
a687059c LW |
575 | char *loop_label; /* what the loop was called, if anything */ |
576 | int loop_sp; /* stack pointer to copy stuff down to */ | |
8d063cd8 | 577 | jmp_buf loop_env; |
a687059c | 578 | } *loop_stack; |
8d063cd8 LW |
579 | |
580 | EXT int loop_ptr INIT(-1); | |
a687059c | 581 | EXT int loop_max INIT(128); |
8d063cd8 LW |
582 | |
583 | EXT jmp_buf top_env; | |
a559c259 | 584 | EXT jmp_buf eval_env; |
8d063cd8 LW |
585 | |
586 | EXT char *goto_targ INIT(Nullch); /* cmd_exec gets strange when set */ | |
587 | ||
a687059c LW |
588 | EXT ARRAY *stack; /* THE STACK */ |
589 | ||
378cc40b LW |
590 | EXT ARRAY *savestack; /* to save non-local values on */ |
591 | ||
592 | EXT ARRAY *tosave; /* strings to save on recursive subroutine */ | |
593 | ||
a687059c LW |
594 | EXT ARRAY *lineary; /* lines of script for debugger */ |
595 | ||
596 | EXT ARRAY *pidstatary; /* keep pids and statuses by fd for mypopen */ | |
597 | ||
8d063cd8 | 598 | double atof(); |
a687059c | 599 | long time(); |
8d063cd8 | 600 | struct tm *gmtime(), *localtime(); |
378cc40b LW |
601 | char *mktemp(); |
602 | char *index(), *rindex(); | |
603 | char *strcpy(), *strcat(); | |
8d063cd8 | 604 | |
8d063cd8 | 605 | #ifdef EUNICE |
378cc40b LW |
606 | #define UNLINK unlnk |
607 | int unlnk(); | |
8d063cd8 LW |
608 | #else |
609 | #define UNLINK unlink | |
610 | #endif | |
a687059c LW |
611 | |
612 | #ifndef SETREUID | |
613 | #ifdef SETRESUID | |
614 | #define setreuid(r,e) setresuid(r,e,-1) | |
615 | #define SETREUID | |
616 | #endif | |
617 | #endif | |
618 | #ifndef SETREGID | |
619 | #ifdef SETRESGID | |
620 | #define setregid(r,e) setresgid(r,e,-1) | |
621 | #define SETREGID | |
622 | #endif | |
623 | #endif |