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