This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 4.0 patch 6: patch #4, continued
[perl5.git] / perl.h
CommitLineData
35c8bce7 1/* $RCSfile: perl.h,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:49:51 $
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 $
35c8bce7
LW
9 * Revision 4.0.1.1 91/04/11 17:49:51 lwall
10 * patch1: hopefully straightened out some of the Xenix mess
11 *
fe14fcc3
LW
12 * Revision 4.0 91/03/20 01:37:56 lwall
13 * 4.0 baseline.
8d063cd8
LW
14 *
15 */
16
35c8bce7 17#define VOIDWANT 1
ac58e20f
LW
18#include "config.h"
19
0f85fab0 20#ifdef MSDOS
fe14fcc3 21/* This stuff now in the MS-DOS config.h file. */
0f85fab0
LW
22#else /* !MSDOS */
23
24/*
25 * The following symbols are defined if your operating system supports
26 * functions by that name. All Unixes I know of support them, thus they
27 * are not checked by the configuration script, but are directly defined
28 * here.
29 */
fe14fcc3
LW
30#define HAS_ALARM
31#define HAS_CHOWN
32#define HAS_CHROOT
33#define HAS_FORK
34#define HAS_GETLOGIN
35#define HAS_GETPPID
36#define HAS_KILL
37#define HAS_LINK
38#define HAS_PIPE
39#define HAS_WAIT
40#define HAS_UMASK
0f85fab0
LW
41/*
42 * The following symbols are defined if your operating system supports
43 * password and group functions in general. All Unix systems do.
44 */
fe14fcc3
LW
45#define HAS_GROUP
46#define HAS_PASSWD
0f85fab0
LW
47
48#endif /* !MSDOS */
49
ac58e20f 50#if defined(HASVOLATILE) || defined(__STDC__)
663a0e37 51#define VOLATILE volatile
663a0e37
LW
52#else
53#define VOLATILE
663a0e37
LW
54#endif
55
a687059c
LW
56#ifdef IAMSUID
57# ifndef TAINT
58# define TAINT
59# endif
60#endif
61
fe14fcc3 62#ifndef HAS_VFORK
03a14243
LW
63# define vfork fork
64#endif
65
fe14fcc3
LW
66#ifdef HAS_GETPGRP2
67# ifndef HAS_GETPGRP
68# define HAS_GETPGRP
663a0e37
LW
69# endif
70# define getpgrp getpgrp2
71#endif
72
fe14fcc3
LW
73#ifdef HAS_SETPGRP2
74# ifndef HAS_SETPGRP
75# define HAS_SETPGRP
663a0e37
LW
76# endif
77# define setpgrp setpgrp2
78#endif
79
fe14fcc3
LW
80#include <stdio.h>
81#include <ctype.h>
82#include <setjmp.h>
83#ifndef MSDOS
84#include <sys/param.h> /* if this needs types.h we're still wrong */
03a14243 85#endif
fe14fcc3
LW
86#ifdef __STDC__
87/* Use all the "standard" definitions */
88#include <stdlib.h>
89#include <string.h>
90#endif /* __STDC__ */
03a14243 91
fe14fcc3
LW
92#if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234
93#undef HAS_MEMCMP
663a0e37 94#endif
fe14fcc3
LW
95
96#ifdef HAS_MEMCPY
97
98# ifndef __STDC__
99# ifndef memcpy
100extern char * memcpy(), *memset();
450a55e4 101extern int memcmp();
fe14fcc3
LW
102# endif /* ndef memcpy */
103# endif /* ndef __STDC__ */
104
a687059c
LW
105#define bcopy(s1,s2,l) memcpy(s2,s1,l)
106#define bzero(s,l) memset(s,0,l)
fe14fcc3 107#endif /* HAS_MEMCPY */
8d063cd8 108
fe14fcc3
LW
109#ifndef HAS_BCMP /* prefer bcmp slightly 'cuz it doesn't order */
110#define bcmp(s1,s2,l) memcmp(s1,s2,l)
d9d8d8de 111#endif
378cc40b
LW
112
113#ifndef _TYPES_ /* If types.h defines this it's easy. */
114#ifndef major /* Does everyone's types.h define this? */
8d063cd8 115#include <sys/types.h>
378cc40b
LW
116#endif
117#endif
118
ae986130
LW
119#ifdef I_NETINET_IN
120#include <netinet/in.h>
121#endif
122
8d063cd8 123#include <sys/stat.h>
135863df 124
663a0e37
LW
125#ifdef I_TIME
126# include <time.h>
ffed7fef 127#endif
663a0e37 128
fe14fcc3 129#ifdef I_SYS_TIME
663a0e37
LW
130# ifdef SYSTIMEKERNEL
131# define KERNEL
132# endif
133# include <sys/time.h>
134# ifdef SYSTIMEKERNEL
135# undef KERNEL
136# endif
a687059c 137#endif
135863df 138
d9d8d8de 139#ifndef MSDOS
8d063cd8 140#include <sys/times.h>
d9d8d8de 141#endif
8d063cd8 142
fe14fcc3
LW
143#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
144#undef HAS_STRERROR
663a0e37
LW
145#endif
146
147#include <errno.h>
d9d8d8de 148#ifndef MSDOS
663a0e37
LW
149#ifndef errno
150extern int errno; /* ANSI allows errno to be an lvalue expr */
151#endif
d9d8d8de 152#endif
663a0e37 153
35c8bce7 154#ifndef strerror
fe14fcc3 155#ifdef HAS_STRERROR
663a0e37
LW
156char *strerror();
157#else
158extern int sys_nerr;
159extern char *sys_errlist[];
160#define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
161#endif
35c8bce7 162#endif
663a0e37 163
a687059c
LW
164#ifdef I_SYSIOCTL
165#ifndef _IOCTL_
166#include <sys/ioctl.h>
167#endif
168#endif
169
170#if defined(mc300) || defined(mc500) || defined(mc700) /* MASSCOMP */
fe14fcc3
LW
171#ifdef HAS_SOCKETPAIR
172#undef HAS_SOCKETPAIR
a687059c 173#endif
fe14fcc3
LW
174#ifdef HAS_NDBM
175#undef HAS_NDBM
a687059c
LW
176#endif
177#endif
178
fe14fcc3
LW
179#ifdef HAS_GDBM
180#ifdef I_GDBM
181#include <gdbm.h>
182#endif
183#define SOME_DBM
184#ifdef HAS_NDBM
185#undef HAS_NDBM
186#endif
187#ifdef HAS_ODBM
188#undef HAS_ODBM
189#endif
190#else
191#ifdef HAS_NDBM
a687059c
LW
192#include <ndbm.h>
193#define SOME_DBM
fe14fcc3
LW
194#ifdef HAS_ODBM
195#undef HAS_ODBM
ae986130 196#endif
a687059c 197#else
fe14fcc3 198#ifdef HAS_ODBM
a687059c
LW
199#ifdef NULL
200#undef NULL /* suppress redefinition message */
201#endif
202#include <dbm.h>
203#ifdef NULL
204#undef NULL
205#endif
206#define NULL 0 /* silly thing is, we don't even use this */
207#define SOME_DBM
208#define dbm_fetch(db,dkey) fetch(dkey)
209#define dbm_delete(db,dkey) delete(dkey)
210#define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
211#define dbm_close(db) dbmclose()
212#define dbm_firstkey(db) firstkey()
fe14fcc3
LW
213#endif /* HAS_ODBM */
214#endif /* HAS_NDBM */
215#endif /* HAS_GDBM */
a687059c
LW
216#ifdef SOME_DBM
217EXT char *dbmkey;
218EXT int dbmlen;
219#endif
220
221#if INTSIZE == 2
222#define htoni htons
223#define ntohi ntohs
224#else
225#define htoni htonl
226#define ntohi ntohl
227#endif
228
35c8bce7 229#if defined(I_DIRENT)
663a0e37
LW
230# include <dirent.h>
231# define DIRENT dirent
ae986130 232#else
fe14fcc3 233# ifdef I_SYS_NDIR
79a0689e 234# include <sys/ndir.h>
663a0e37
LW
235# define DIRENT direct
236# else
fe14fcc3 237# ifdef I_SYS_DIR
79a0689e
LW
238# ifdef hp9000s500
239# include <ndir.h> /* may be wrong in the future */
240# else
241# include <sys/dir.h>
242# endif
663a0e37
LW
243# define DIRENT direct
244# endif
245# endif
a687059c
LW
246#endif
247
c623bd54
LW
248/*
249 * The following gobbledygook brought to you on behalf of __STDC__.
250 * (I could just use #ifndef __STDC__, but this is more bulletproof
251 * in the face of half-implementations.)
252 */
253
254#ifndef S_IFMT
255# ifdef _S_IFMT
256# define S_IFMT _S_IFMT
257# else
258# define S_IFMT 0170000
259# endif
260#endif
261
262#ifndef S_ISDIR
263# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
264#endif
265
266#ifndef S_ISCHR
267# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
268#endif
269
270#ifndef S_ISBLK
fe14fcc3
LW
271# ifdef S_IFBLK
272# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
273# else
274# define S_ISBLK(m) (0)
275# endif
c623bd54
LW
276#endif
277
278#ifndef S_ISREG
279# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
280#endif
281
282#ifndef S_ISFIFO
fe14fcc3
LW
283# ifdef S_IFIFO
284# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
285# else
286# define S_ISFIFO(m) (0)
287# endif
c623bd54
LW
288#endif
289
290#ifndef S_ISLNK
291# ifdef _S_ISLNK
292# define S_ISLNK(m) _S_ISLNK(m)
293# else
294# ifdef _S_IFLNK
295# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
296# else
297# ifdef S_IFLNK
298# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
299# else
300# define S_ISLNK(m) (0)
301# endif
302# endif
303# endif
304#endif
305
306#ifndef S_ISSOCK
307# ifdef _S_ISSOCK
308# define S_ISSOCK(m) _S_ISSOCK(m)
309# else
310# ifdef _S_IFSOCK
311# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
312# else
313# ifdef S_IFSOCK
314# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
315# else
316# define S_ISSOCK(m) (0)
317# endif
318# endif
319# endif
320#endif
321
322#ifndef S_IRUSR
323# ifdef S_IREAD
324# define S_IRUSR S_IREAD
325# define S_IWUSR S_IWRITE
326# define S_IXUSR S_IEXEC
327# else
328# define S_IRUSR 0400
329# define S_IWUSR 0200
330# define S_IXUSR 0100
331# endif
332# define S_IRGRP (S_IRUSR>>3)
333# define S_IWGRP (S_IWUSR>>3)
334# define S_IXGRP (S_IXUSR>>3)
335# define S_IROTH (S_IRUSR>>6)
336# define S_IWOTH (S_IWUSR>>6)
337# define S_IXOTH (S_IXUSR>>6)
338#endif
339
340#ifndef S_ISUID
341# define S_ISUID 04000
342#endif
343
344#ifndef S_ISGID
345# define S_ISGID 02000
346#endif
347
450a55e4
LW
348typedef unsigned int STRLEN;
349
8d063cd8
LW
350typedef struct arg ARG;
351typedef struct cmd CMD;
352typedef struct formcmd FCMD;
353typedef struct scanpat SPAT;
8d063cd8 354typedef struct stio STIO;
378cc40b 355typedef struct sub SUBR;
8d063cd8
LW
356typedef struct string STR;
357typedef struct atbl ARRAY;
358typedef struct htbl HASH;
378cc40b 359typedef struct regexp REGEXP;
a687059c
LW
360typedef struct stabptrs STBP;
361typedef struct stab STAB;
d9d8d8de 362typedef struct callsave CSV;
8d063cd8 363
378cc40b
LW
364#include "handy.h"
365#include "regexp.h"
8d063cd8 366#include "str.h"
378cc40b 367#include "util.h"
8d063cd8
LW
368#include "form.h"
369#include "stab.h"
370#include "spat.h"
371#include "arg.h"
372#include "cmd.h"
373#include "array.h"
374#include "hash.h"
375
450a55e4 376#if defined(iAPX286) || defined(M_I286) || defined(I80286)
a687059c
LW
377# define I286
378#endif
379
380#ifndef __STDC__
135863df
AB
381#ifdef CHARSPRINTF
382 char *sprintf();
383#else
384 int sprintf();
385#endif
a687059c 386#endif
135863df 387
8d063cd8
LW
388EXT char *Yes INIT("1");
389EXT char *No INIT("");
390
a687059c
LW
391/* "gimme" values */
392
393/* Note: cmd.c assumes that it can use && to produce one of these values! */
394#define G_SCALAR 0
395#define G_ARRAY 1
396
397#ifdef CRIPPLED_CC
398int str_true();
399#else /* !CRIPPLED_CC */
400#define str_true(str) (Str = (str), \
401 (Str->str_pok ? \
402 ((*Str->str_ptr > '0' || \
403 Str->str_cur > 1 || \
404 (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \
405 : \
406 (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) ))
407#endif /* CRIPPLED_CC */
8d063cd8 408
135863df 409#ifdef DEBUGGING
a687059c
LW
410#define str_peek(str) (Str = (str), \
411 (Str->str_pok ? \
412 Str->str_ptr : \
413 (Str->str_nok ? \
414 (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \
415 (char*)tokenbuf) : \
416 "" )))
135863df
AB
417#endif
418
a687059c
LW
419#ifdef CRIPPLED_CC
420char *str_get();
421#else
422#ifdef TAINT
423#define str_get(str) (Str = (str), tainted |= Str->str_tainted, \
424 (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
425#else
8d063cd8 426#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
a687059c
LW
427#endif /* TAINT */
428#endif /* CRIPPLED_CC */
429
430#ifdef CRIPPLED_CC
431double str_gnum();
432#else /* !CRIPPLED_CC */
433#ifdef TAINT
434#define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \
435 (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
436#else /* !TAINT */
437#define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
438#endif /* TAINT*/
439#endif /* CRIPPLED_CC */
8d063cd8
LW
440EXT STR *Str;
441
442#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
443
450a55e4 444#ifndef MSDOS
a687059c 445#define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
450a55e4
LW
446#define Str_Grow str_grow
447#else
448/* extra parentheses intentionally NOT placed around "len"! */
449#define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \
450 str_grow(str,(unsigned long)len)
451#define Str_Grow(str,len) str_grow(str,(unsigned long)(len))
452#endif /* MSDOS */
a687059c
LW
453
454#ifndef BYTEORDER
ffed7fef 455#define BYTEORDER 0x1234
a687059c
LW
456#endif
457
fe14fcc3
LW
458#if defined(htonl) && !defined(HAS_HTONL)
459#define HAS_HTONL
ae986130 460#endif
fe14fcc3
LW
461#if defined(htons) && !defined(HAS_HTONS)
462#define HAS_HTONS
ae986130 463#endif
fe14fcc3
LW
464#if defined(ntohl) && !defined(HAS_NTOHL)
465#define HAS_NTOHL
ae986130 466#endif
fe14fcc3
LW
467#if defined(ntohs) && !defined(HAS_NTOHS)
468#define HAS_NTOHS
ae986130 469#endif
fe14fcc3 470#ifndef HAS_HTONL
d9d8d8de 471#if (BYTEORDER & 0xffff) != 0x4321
fe14fcc3
LW
472#define HAS_HTONS
473#define HAS_HTONL
474#define HAS_NTOHS
475#define HAS_NTOHL
a687059c
LW
476#define MYSWAP
477#define htons my_swap
478#define htonl my_htonl
479#define ntohs my_swap
480#define ntohl my_ntohl
481#endif
482#else
d9d8d8de 483#if (BYTEORDER & 0xffff) == 0x4321
fe14fcc3
LW
484#undef HAS_HTONS
485#undef HAS_HTONL
486#undef HAS_NTOHS
487#undef HAS_NTOHL
a687059c
LW
488#endif
489#endif
490
0f85fab0
LW
491#ifdef CASTNEGFLOAT
492#define U_S(what) ((unsigned short)(what))
493#define U_I(what) ((unsigned int)(what))
494#define U_L(what) ((unsigned long)(what))
495#else
496unsigned long castulong();
497#define U_S(what) ((unsigned int)castulong(what))
498#define U_I(what) ((unsigned int)castulong(what))
499#define U_L(what) (castulong(what))
500#endif
501
8d063cd8
LW
502CMD *add_label();
503CMD *block_head();
504CMD *append_line();
505CMD *make_acmd();
506CMD *make_ccmd();
a687059c 507CMD *make_icmd();
8d063cd8
LW
508CMD *invert();
509CMD *addcond();
510CMD *addloop();
511CMD *wopt();
378cc40b 512CMD *over();
8d063cd8 513
8d063cd8 514STAB *stabent();
378cc40b 515STAB *genstab();
8d063cd8 516
378cc40b 517ARG *stab2arg();
8d063cd8
LW
518ARG *op_new();
519ARG *make_op();
8d063cd8
LW
520ARG *make_match();
521ARG *make_split();
a687059c 522ARG *rcatmaybe();
378cc40b 523ARG *listish();
a687059c 524ARG *maybelistish();
378cc40b 525ARG *localize();
a687059c
LW
526ARG *fixeval();
527ARG *jmaybe();
378cc40b 528ARG *l();
a687059c 529ARG *fixl();
378cc40b
LW
530ARG *mod_match();
531ARG *make_list();
532ARG *cmd_to_arg();
533ARG *addflags();
534ARG *hide_ary();
535ARG *cval_to_arg();
8d063cd8 536
8d063cd8
LW
537STR *str_new();
538STR *stab_str();
a687059c
LW
539
540int do_each();
541int do_subr();
542int do_match();
543int do_unpack();
544int eval(); /* this evaluates expressions */
545int do_eval(); /* this evaluates eval operator */
546int do_assign();
378cc40b
LW
547
548SUBR *make_sub();
8d063cd8
LW
549
550FCMD *load_format();
551
552char *scanpat();
553char *scansubst();
554char *scantrans();
555char *scanstr();
fe14fcc3 556char *scanident();
8d063cd8
LW
557char *str_append_till();
558char *str_gets();
a687059c 559char *str_grow();
8d063cd8 560
8d063cd8
LW
561bool do_open();
562bool do_close();
563bool do_print();
378cc40b
LW
564bool do_aprint();
565bool do_exec();
566bool do_aexec();
8d063cd8
LW
567
568int do_subst();
378cc40b
LW
569int cando();
570int ingroup();
8d063cd8 571
378cc40b
LW
572void str_replace();
573void str_inc();
574void str_dec();
8d063cd8 575void str_free();
a687059c 576void stab_clear();
378cc40b 577void do_join();
378cc40b 578void do_sprintf();
a687059c 579void do_accept();
ac58e20f 580void do_pipe();
a687059c 581void do_vecset();
fe14fcc3
LW
582void do_unshift();
583void do_execfree();
584void magicalize();
585void magicname();
a687059c
LW
586void savelist();
587void saveitem();
588void saveint();
589void savelong();
590void savesptr();
591void savehptr();
592void restorelist();
ac58e20f 593void repeatcpy();
a687059c
LW
594HASH *savehash();
595ARRAY *saveary();
378cc40b 596
ac58e20f
LW
597EXT char **origargv;
598EXT int origargc;
fe14fcc3 599EXT char **origenviron;
35c8bce7
LW
600extern char **environ;
601
a687059c
LW
602EXT line_t subline INIT(0);
603EXT STR *subname INIT(Nullstr);
8d063cd8
LW
604EXT int arybase INIT(0);
605
606struct outrec {
d9d8d8de
LW
607 long o_lines;
608 char *o_str;
609 int o_len;
8d063cd8
LW
610};
611
612EXT struct outrec outrec;
613EXT struct outrec toprec;
614
a687059c 615EXT STAB *stdinstab INIT(Nullstab);
8d063cd8
LW
616EXT STAB *last_in_stab INIT(Nullstab);
617EXT STAB *defstab INIT(Nullstab);
618EXT STAB *argvstab INIT(Nullstab);
619EXT STAB *envstab INIT(Nullstab);
620EXT STAB *sigstab INIT(Nullstab);
621EXT STAB *defoutstab INIT(Nullstab);
622EXT STAB *curoutstab INIT(Nullstab);
623EXT STAB *argvoutstab INIT(Nullstab);
378cc40b 624EXT STAB *incstab INIT(Nullstab);
a687059c
LW
625EXT STAB *leftstab INIT(Nullstab);
626EXT STAB *amperstab INIT(Nullstab);
627EXT STAB *rightstab INIT(Nullstab);
628EXT STAB *DBstab INIT(Nullstab);
d9d8d8de 629EXT STAB *DBline INIT(Nullstab);
a687059c
LW
630EXT STAB *DBsub INIT(Nullstab);
631
632EXT HASH *defstash; /* main symbol table */
633EXT HASH *curstash; /* symbol table for current package */
634EXT HASH *debstash; /* symbol table for perldb package */
635
636EXT STR *curstname; /* name of current package */
8d063cd8
LW
637
638EXT STR *freestrroot INIT(Nullstr);
378cc40b 639EXT STR *lastretstr INIT(Nullstr);
a687059c 640EXT STR *DBsingle INIT(Nullstr);
d9d8d8de
LW
641EXT STR *DBtrace INIT(Nullstr);
642EXT STR *DBsignal INIT(Nullstr);
a687059c
LW
643
644EXT int lastspbase;
645EXT int lastsize;
8d063cd8 646
fe14fcc3 647EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEF");
378cc40b 648EXT char *origfilename;
ac58e20f 649EXT FILE * VOLATILE rsfp;
8d063cd8 650EXT char buf[1024];
a687059c
LW
651EXT char *bufptr;
652EXT char *oldbufptr;
653EXT char *oldoldbufptr;
654EXT char *bufend;
8d063cd8
LW
655
656EXT STR *linestr INIT(Nullstr);
657
fe14fcc3
LW
658EXT char *rs INIT("\n");
659EXT int rschar INIT('\n'); /* final char of rs, or 0777 if none */
a687059c 660EXT int rslen INIT(1);
8d063cd8 661EXT char *ofs INIT(Nullch);
a687059c 662EXT int ofslen INIT(0);
8d063cd8 663EXT char *ors INIT(Nullch);
a687059c 664EXT int orslen INIT(0);
8d063cd8
LW
665EXT char *ofmt INIT(Nullch);
666EXT char *inplace INIT(Nullch);
a687059c 667EXT char *nointrp INIT("");
8d063cd8 668
378cc40b
LW
669EXT bool preprocess INIT(FALSE);
670EXT bool minus_n INIT(FALSE);
671EXT bool minus_p INIT(FALSE);
fe14fcc3 672EXT bool minus_l INIT(FALSE);
378cc40b
LW
673EXT bool minus_a INIT(FALSE);
674EXT bool doswitches INIT(FALSE);
675EXT bool dowarn INIT(FALSE);
450a55e4 676EXT bool doextract INIT(FALSE);
378cc40b
LW
677EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/
678EXT bool sawampersand INIT(FALSE); /* must save all match strings */
679EXT bool sawstudy INIT(FALSE); /* do fbminstr on all strings */
a687059c
LW
680EXT bool sawi INIT(FALSE); /* study must assume case insensitive */
681EXT bool sawvec INIT(FALSE);
ac58e20f 682EXT bool localizing INIT(FALSE); /* are we processing a local() list? */
a687059c 683
ae986130
LW
684#ifdef CSH
685char *cshname INIT(CSH);
686int cshlen INIT(0);
687#endif /* CSH */
a687059c
LW
688
689#ifdef TAINT
690EXT bool tainted INIT(FALSE); /* using variables controlled by $< */
691#endif
378cc40b 692
450a55e4 693#ifndef MSDOS
378cc40b 694#define TMPPATH "/tmp/perl-eXXXXXX"
450a55e4 695#else
57ebbfd0 696#define TMPPATH "plXXXXXX"
450a55e4 697#endif /* MSDOS */
378cc40b
LW
698EXT char *e_tmpname;
699EXT FILE *e_fp INIT(Nullfp);
700
8d063cd8 701EXT char tokenbuf[256];
a687059c 702EXT int expectterm INIT(TRUE); /* how to interpret ambiguous tokens */
ac58e20f 703EXT VOLATILE int in_eval INIT(FALSE); /* trap fatal errors? */
a687059c
LW
704EXT int multiline INIT(0); /* $*--do strings hold >1 line? */
705EXT int forkprocess; /* so do_open |- can return proc# */
706EXT int do_undump INIT(0); /* -u or dump seen? */
707EXT int error_count INIT(0); /* how many errors so far, max 10 */
708EXT int multi_start INIT(0); /* 1st line of multi-line string */
709EXT int multi_end INIT(0); /* last line of multi-line string */
710EXT int multi_open INIT(0); /* delimiter of said string */
711EXT int multi_close INIT(0); /* delimiter of said string */
8d063cd8
LW
712
713FILE *popen();
714/* char *str_get(); */
715STR *interp();
716void free_arg();
717STIO *stio_new();
718
719EXT struct stat statbuf;
a687059c
LW
720EXT struct stat statcache;
721STAB *statstab INIT(Nullstab);
722STR *statname;
d9d8d8de 723#ifndef MSDOS
8d063cd8 724EXT struct tms timesbuf;
d9d8d8de 725#endif
378cc40b
LW
726EXT int uid;
727EXT int euid;
a687059c
LW
728EXT int gid;
729EXT int egid;
378cc40b
LW
730UIDTYPE getuid();
731UIDTYPE geteuid();
732GIDTYPE getgid();
733GIDTYPE getegid();
734EXT int unsafe;
8d063cd8
LW
735
736#ifdef DEBUGGING
ac58e20f 737EXT VOLATILE int debug INIT(0);
8d063cd8 738EXT int dlevel INIT(0);
a687059c
LW
739EXT int dlmax INIT(128);
740EXT char *debname;
741EXT char *debdelim;
d96024cf 742#define YYDEBUG 1
8d063cd8 743#endif
a687059c 744EXT int perldb INIT(0);
fe14fcc3 745#define YYMAXDEPTH 300
8d063cd8 746
378cc40b
LW
747EXT line_t cmdline INIT(NOLINE);
748
a687059c 749EXT STR str_undef;
8d063cd8
LW
750EXT STR str_no;
751EXT STR str_yes;
752
753/* runtime control stuff */
754
755EXT struct loop {
a687059c
LW
756 char *loop_label; /* what the loop was called, if anything */
757 int loop_sp; /* stack pointer to copy stuff down to */
8d063cd8 758 jmp_buf loop_env;
a687059c 759} *loop_stack;
8d063cd8
LW
760
761EXT int loop_ptr INIT(-1);
a687059c 762EXT int loop_max INIT(128);
8d063cd8
LW
763
764EXT jmp_buf top_env;
765
ac58e20f 766EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
8d063cd8 767
450a55e4
LW
768struct ufuncs {
769 int (*uf_val)();
770 int (*uf_set)();
771 int uf_index;
772};
773
a687059c
LW
774EXT ARRAY *stack; /* THE STACK */
775
ac58e20f 776EXT ARRAY * VOLATILE savestack; /* to save non-local values on */
378cc40b
LW
777
778EXT ARRAY *tosave; /* strings to save on recursive subroutine */
779
a687059c 780EXT ARRAY *lineary; /* lines of script for debugger */
d9d8d8de 781EXT ARRAY *dbargs; /* args to call listed by caller function */
a687059c 782
d9d8d8de
LW
783EXT ARRAY *fdpid; /* keep fd-to-pid mappings for mypopen */
784EXT HASH *pidstatus; /* keep pid-to-status mappings for waitpid */
a687059c 785
ac58e20f
LW
786EXT int *di; /* for tmp use in debuggers */
787EXT char *dc;
788EXT short *ds;
789
fe14fcc3
LW
790/* Fix these up for __STDC__ */
791EXT long basetime INIT(0);
792char *mktemp();
793#ifndef __STDC__
794/* All of these are in stdlib.h or time.h for ANSI C */
8d063cd8 795double atof();
a687059c 796long time();
8d063cd8 797struct tm *gmtime(), *localtime();
378cc40b
LW
798char *index(), *rindex();
799char *strcpy(), *strcat();
fe14fcc3 800#endif /* ! __STDC__ */
8d063cd8 801
8d063cd8 802#ifdef EUNICE
378cc40b
LW
803#define UNLINK unlnk
804int unlnk();
8d063cd8
LW
805#else
806#define UNLINK unlink
807#endif
a687059c 808
fe14fcc3
LW
809#ifndef HAS_SETREUID
810#ifdef HAS_SETRESUID
a687059c 811#define setreuid(r,e) setresuid(r,e,-1)
fe14fcc3 812#define HAS_SETREUID
a687059c
LW
813#endif
814#endif
fe14fcc3
LW
815#ifndef HAS_SETREGID
816#ifdef HAS_SETRESGID
a687059c 817#define setregid(r,e) setresgid(r,e,-1)
fe14fcc3 818#define HAS_SETREGID
a687059c
LW
819#endif
820#endif