perl.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* perl.c
*
* Copyright (c) 1987-2001 Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
/*
*/
#include "EXTERN.h"
#define PERL_IN_PERL_C
#include "perl.h"
#include "patchlevel.h" /* for local_patches */
/* XXX If this causes problems, set i_unistd=undef in the hint file. */
#ifdef I_UNISTD
#include <unistd.h>
#endif
#if !defined(STANDARD_C) && !defined(HAS_GETENV_PROTOTYPE)
#endif
#ifdef IAMSUID
#ifndef DOSUID
#define DOSUID
#endif
#endif
#ifdef DOSUID
#endif
#endif
#ifdef PERL_OBJECT
#define perl_construct Perl_construct
#define perl_parse Perl_parse
#define perl_destruct Perl_destruct
#endif
#if defined(USE_THREADS)
# define INIT_TLS_AND_INTERP \
STMT_START { \
if (!PL_curinterp) { \
INIT_THREADS; \
} \
} STMT_END
#else
# if defined(USE_ITHREADS)
# define INIT_TLS_AND_INTERP \
STMT_START { \
if (!PL_curinterp) { \
INIT_THREADS; \
PERL_SET_THX(my_perl); \
} \
else { \
PERL_SET_THX(my_perl); \
} \
} STMT_END
# else
# define INIT_TLS_AND_INTERP \
STMT_START { \
if (!PL_curinterp) { \
} \
PERL_SET_THX(my_perl); \
} STMT_END
# endif
#endif
#ifdef PERL_IMPLICIT_SYS
{
#ifdef PERL_OBJECT
#else
/* New() needs interpreter, so call malloc() instead */
PL_MemShared = ipMS;
PL_MemParse = ipMP;
#endif
return my_perl;
}
#else
/*
=for apidoc perl_alloc
Allocates a new Perl interpreter. See L<perlembed>.
=cut
*/
perl_alloc(void)
{
/* New() needs interpreter, so call malloc() instead */
return my_perl;
}
#endif /* PERL_IMPLICIT_SYS */
/*
=for apidoc perl_construct
Initializes a new Perl interpreter. See L<perlembed>.
=cut
*/
void
{
#ifdef USE_THREADS
int i;
#ifndef FAKE_THREADS
#endif /* FAKE_THREADS */
#endif /* USE_THREADS */
#ifdef MULTIPLICITY
init_interp();
#else
if (PL_perl_destruct_level > 0)
init_interp();
#endif
/* Init the real globals (and main thread)? */
if (!PL_linestr) {
#ifdef USE_THREADS
/*
* Safe to use basic SV functions from now on (though
* not things like mortals or tainting yet).
*/
# ifdef EMULATE_ATOMIC_REFCOUNTS
# endif /* EMULATE_ATOMIC_REFCOUNTS */
thr = init_main_thread();
#endif /* USE_THREADS */
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#endif
if (!SvREADONLY(&PL_sv_undef)) {
/* set read-only and try to insure than we wont see REFCNT==0
very often */
}
#ifdef PERL_OBJECT
/* TODO: */
/* PL_sighandlerp = sighandler; */
#else
#endif
PL_pidstatus = newHV();
#ifdef MSDOS
/*
* There is no way we can refer to them from Perl so close them to save
* space. The other alternative would be to provide STDAUX and STDPRN
* filehandles.
*/
#endif
}
init_stacks();
init_ids();
init_i18nl10n(1);
{
U8 *s;
*s = '\0';
#if defined(PERL_SUBVERSION) && PERL_SUBVERSION > 0
#endif
;
}
#if defined(LOCAL_PATCH_COUNT)
#endif
#ifdef HAVE_INTERP_INTERN
#endif
PerlIO_init(); /* Hook to IO system */
}
/*
=for apidoc perl_destruct
Shuts down a Perl interpreter. See L<perlembed>.
=cut
*/
void
{
int destruct_level; /* 0=none, 1=full, 2=full with checks */
#ifdef USE_THREADS
Thread t;
dTHX;
#endif /* USE_THREADS */
/* wait for all pseudo-forked children to finish */
#ifdef USE_THREADS
#ifndef FAKE_THREADS
/* Pass 1 on any remaining threads: detach joinables, join zombies */
"perl_destruct: waiting for %d threads...\n",
PL_nthreads - 1));
MUTEX_LOCK(&t->mutex);
switch (ThrSTATE(t)) {
case THRf_ZOMBIE:
"perl_destruct: joining zombie %p\n", t));
ThrSETSTATE(t, THRf_DEAD);
MUTEX_UNLOCK(&t->mutex);
PL_nthreads--;
/*
* The SvREFCNT_dec below may take a long time (e.g. av
* may contain an object scalar whose destructor gets
* called) so we have to unlock threads_mutex and start
* all over again.
*/
"perl_destruct: joined zombie %p OK\n", t));
goto retry_cleanup;
case THRf_R_JOINABLE:
"perl_destruct: detaching thread %p\n", t));
/*
* We unlock threads_mutex and t->mutex in the opposite order
* from which we locked them just so that DETACH won't
* deadlock if it panics. It's only a breach of good style
* not a bug since they are unlocks not locks.
*/
DETACH(t);
MUTEX_UNLOCK(&t->mutex);
goto retry_cleanup;
default:
"perl_destruct: ignoring %p (state %u)\n",
t, ThrSTATE(t)));
MUTEX_UNLOCK(&t->mutex);
/* fall through and out */
}
}
/* We leave the above "Pass 1" loop with threads_mutex still locked */
/* Pass 2 on remaining threads: wait for the thread count to drop to one */
while (PL_nthreads > 1)
{
"perl_destruct: final wait for %d threads\n",
PL_nthreads - 1));
}
/* At this point, we're the last thread */
PL_nthreads--;
#endif /* !defined(FAKE_THREADS) */
#endif /* USE_THREADS */
#ifdef DEBUGGING
{
char *s;
if ((s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL"))) {
int i = atoi(s);
if (destruct_level < i)
destruct_level = i;
}
}
#endif
/* We must account for everything. */
/* Destroy the main CV and syntax tree */
if (PL_main_root) {
}
PL_main_cv = Nullcv;
if (PL_sv_objcount) {
/*
* Try to destruct global references. We do this first so that the
* destructors and destructees still exist. Some sv's might remain.
* Non-referenced objects are on their own.
*/
}
/* unhook hooks which will soon be, or use, destroyed data */
PL_diehook = Nullsv;
/* call exit list functions */
while (PL_exitlistlen-- > 0)
if (destruct_level == 0){
DEBUG_P(debprofdump());
/* The exit() function will do everything that needs doing. */
return;
}
/* jettison our possibly duplicated environment */
#ifdef USE_ENVIRON_ARRAY
if (environ != PL_origenviron) {
I32 i;
for (i = 0; environ[i]; i++)
safesysfree(environ[i]);
/* Must use safesysfree() when working with environ. */
}
#endif
/* loosen bonds of global variables */
if(PL_rsfp) {
(void)PerlIO_close(PL_rsfp);
}
/* Filters for program text */
/* switches */
PL_minus_n = FALSE;
PL_minus_p = FALSE;
PL_minus_l = FALSE;
PL_minus_a = FALSE;
PL_minus_F = FALSE;
PL_inplace = Nullch;
if (PL_e_script) {
}
/* magical thingies */
PL_multiline = 0; /* $* */
/* defgv, aka *_ should be taken care of elsewhere */
/* clean up after study() */
PL_screamfirst = 0;
PL_screamnext = 0;
/* float buffer */
PL_efloatsize = 0;
/* startup and shutdown function lists */
PL_beginav = Nullav;
PL_checkav = Nullav;
/* shortcuts just get cleared */
PL_stdingv = Nullgv;
/* reset so print() ends up where we expect */
PL_subname = Nullsv;
PL_linestr = Nullsv;
/* free locale stuff */
#ifdef USE_LOCALE_COLLATE
#endif
#ifdef USE_LOCALE_NUMERIC
#endif
/* clear utf8 character classes */
#ifdef USE_ITHREADS
#else
/* cop_stash is not refcounted */
#endif
/* Prepare to destruct main symbol table. */
hv = PL_defstash;
PL_defstash = 0;
/* clear queued errors */
if (PL_scopestack_ix != 0)
"Unbalanced scopes: %ld more ENTERs than LEAVEs\n",
(long)PL_scopestack_ix);
if (PL_savestack_ix != 0)
"Unbalanced saves: %ld more saves than restores\n",
(long)PL_savestack_ix);
if (PL_tmps_floor != -1)
(long)PL_tmps_floor + 1);
if (cxstack_ix != -1)
(long)cxstack_ix + 1);
}
/* Now absolutely destruct everything, somehow or other, loops or no. */
/* the 2 is for PL_fdpid and PL_strtab */
;
#ifdef HAVE_INTERP_INTERN
#endif
/* Destruct the global string table. */
{
/* Yell and reset the HeVAL() slots that are still holding refcounts,
* so that sv_free() won't fail on them.
*/
riter = 0;
for (;;) {
"Unbalanced string table refcount: (%d) for \"%s\"",
}
if (!hent) {
break;
}
}
}
#ifdef USE_ITHREADS
/* free the pointer table used for cloning */
#endif
/* free special SVs */
SvREFCNT(&PL_sv_undef) = 0;
if (PL_reg_curpm)
nuke_stacks();
PL_hints = 0; /* Reset hints. Should hints be per-interpreter ? */
DEBUG_P(debprofdump());
#ifdef USE_THREADS
#ifdef EMULATE_ATOMIC_REFCOUNTS
#endif /* EMULATE_ATOMIC_REFCOUNTS */
/* As the penultimate thing, free the non-arena SV for thrsv */
#endif /* USE_THREADS */
/* As the absolutely last thing, free the non-arena SV for mess() */
if (PL_mess_sv) {
/* it could have accumulated taint magic */
}
}
/* we know that type >= SVt_PV */
(void)SvOOK_off(PL_mess_sv);
PL_mess_sv = Nullsv;
}
}
/*
=for apidoc perl_free
Releases a Perl interpreter. See L<perlembed>.
=cut
*/
void
{
#if defined(PERL_OBJECT)
#else
# if defined(PERL_IMPLICIT_SYS) && defined(WIN32)
void *host = w32_internal_host;
# else
# endif
#endif
}
void
{
}
/*
=for apidoc perl_parse
Tells a Perl interpreter to parse a Perl script. See L<perlembed>.
=cut
*/
int
{
int ret;
#ifdef USE_THREADS
dTHX;
#endif
#ifdef IAMSUID
setuid perl scripts securely.\n");
#endif
#endif
#endif /* environ */
PL_origargv = argv;
PL_origargc = argc;
#ifdef USE_ENVIRON_ARRAY
#endif
if (PL_do_undump) {
/* Come here if running an undumped a.out. */
init_ids();
return 0;
}
if (PL_main_root) {
}
PL_main_cv = Nullcv;
time(&PL_basetime);
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#else
#endif
switch (ret) {
case 0:
#ifndef PERL_FLEXIBLE_EXCEPTIONS
#endif
if (PL_checkav)
ret = 0;
break;
case 1:
/* FALL THROUGH */
case 2:
/* my_exit() was called */
while (PL_scopestack_ix > oldscope)
if (PL_checkav)
break;
case 3:
ret = 1;
break;
}
return ret;
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
STATIC void *
{
}
#endif
STATIC void *
{
int argc = PL_origargc;
char **argv = PL_origargv;
char *scriptname = NULL;
int fdscript = -1;
char *validarg = "";
register char *s;
SAVEFREESV(sv);
break;
#ifdef DOSUID
if (*validarg)
validarg = " PHOOEY ";
else
#endif
s = argv[0]+1;
switch (*s) {
case 'C':
#ifdef WIN32
/* FALL THROUGH */
#endif
#ifndef PERL_STRICT_CR
case '\r':
#endif
case ' ':
case '0':
case 'F':
case 'a':
case 'c':
case 'd':
case 'D':
case 'h':
case 'i':
case 'l':
case 'M':
case 'm':
case 'n':
case 'p':
case 's':
case 'u':
case 'U':
case 'v':
case 'W':
case 'X':
case 'w':
if ((s = moreswitches(s)))
goto reswitch;
break;
case 'T':
PL_tainting = TRUE;
s++;
goto reswitch;
case 'e':
#ifdef MACOS_TRADITIONAL
/* ignore -e for Dev:Pseudo argument */
break;
#endif
if (!PL_e_script) {
}
if (*++s)
sv_catpv(PL_e_script, s);
else if (argv[1]) {
}
else
break;
case 'I': /* -I handled both here and in moreswitches() */
forbid_setid("-I");
}
if (s && *s) {
char *p;
Safefree(p);
}
else
break;
case 'P':
forbid_setid("-P");
s++;
goto reswitch;
case 'S':
forbid_setid("-S");
s++;
goto reswitch;
case 'V':
if (!PL_preambleav)
PL_preambleav = newAV();
if (*++s != ':') {
#ifdef VMS
#else
#endif
# ifdef DEBUGGING
# endif
# ifdef MULTIPLICITY
# endif
# ifdef USE_THREADS
# endif
# ifdef USE_ITHREADS
# endif
# ifdef USE_64_BIT_INT
# endif
# ifdef USE_64_BIT_ALL
# endif
# ifdef USE_LONG_DOUBLE
# endif
# ifdef USE_LARGE_FILES
# endif
# ifdef USE_SOCKS
# endif
# ifdef PERL_OBJECT
# endif
# ifdef PERL_IMPLICIT_CONTEXT
# endif
# ifdef PERL_IMPLICIT_SYS
# endif
#if defined(LOCAL_PATCH_COUNT)
if (LOCAL_PATCH_COUNT > 0) {
int i;
for (i = 1; i <= LOCAL_PATCH_COUNT; i++) {
if (PL_localpatches[i])
}
}
#endif
#ifdef __DATE__
# ifdef __TIME__
# else
# endif
#endif
$\"=\"\\n \"; \
@env = map { \"$_=\\\"$ENV{$_}\\\"\" } sort grep {/^PERL/} keys %ENV; \
print \" \\%ENV:\\n @env\\n\" if @env; \
print \" \\@INC:\\n @INC\\n\";");
}
else {
s += strlen(s);
}
goto reswitch;
case 'x':
PL_doextract = TRUE;
s++;
if (*s)
cddir = s;
break;
case 0:
break;
case '-':
if (!*++s || isSPACE(*s)) {
goto switch_end;
}
/* catch use of gnu style long options */
if (strEQ(s, "version")) {
s = "v";
goto reswitch;
}
if (strEQ(s, "help")) {
s = "h";
goto reswitch;
}
s--;
/* FALL THROUGH */
default:
}
}
if (
#ifndef SECURE_INTERNAL_GETENV
!PL_tainting &&
#endif
(s = PerlEnv_getenv("PERL5OPT")))
{
while (isSPACE(*s))
s++;
if (*s == '-' && *(s+1) == 'T')
PL_tainting = TRUE;
else {
while (s && *s) {
char *d;
while (isSPACE(*s))
s++;
if (*s == '-') {
s++;
if (isSPACE(*s))
continue;
}
d = s;
if (!*s)
break;
if (!strchr("DIMUdmw", *s))
while (++s && *s) {
if (isSPACE(*s)) {
*s++ = '\0';
break;
}
}
moreswitches(d);
}
}
}
if (!scriptname)
scriptname = argv[0];
if (PL_e_script) {
}
else if (scriptname == Nullch) {
#ifdef MSDOS
moreswitches("h");
#endif
scriptname = "-";
}
init_perllib();
{
#ifndef SIGCHLD
#endif
if (ckWARN(WARN_SIGNAL))
"Can't ignore signal CHLD, forcing to default");
}
}
#endif
#ifdef MACOS_TRADITIONAL
if (PL_doextract || gMacPerl_AlwaysExtract) {
#else
if (PL_doextract) {
#endif
}
PL_comppad = newAV();
PL_comppad_name = newAV();
PL_comppad_name_fill = 0;
PL_min_intro_pending = 0;
PL_padix = 0;
#ifdef USE_THREADS
#endif /* USE_THREADS */
comppadlist = newAV();
#ifndef PERL_MICRO
#endif
if (xsinit)
#endif
#ifdef USE_SOCKS
# ifdef HAS_SOCKS5_INIT
socks5_init(argv[0]);
# else
# endif
#endif
/* init_postdump_symbols not currently designed to be called */
/* more than once (ENV isn't cleared first, for example) */
/* But running with -u leaves %ENV & @ARGV undefined! XXX */
if (!PL_do_undump)
init_lexer();
/* now parse the script */
PL_error_count = 0;
#ifdef MACOS_TRADITIONAL
if (PL_minus_c)
else {
}
}
#else
if (yyparse() || PL_error_count) {
if (PL_minus_c)
else {
}
}
#endif
CopLINE_set(PL_curcop, 0);
if (PL_e_script) {
}
/* now that script is parsed, we can modify record separator */
if (PL_do_undump)
my_unexec();
if (isWARN_ONCE) {
}
#ifdef MYMALLOC
dump_mstats("after compilation:");
#endif
PL_restartop = 0;
return NULL;
}
/*
=for apidoc perl_run
Tells a Perl interpreter to run. See L<perlembed>.
=cut
*/
int
{
int ret = 0;
#ifdef USE_THREADS
dTHX;
#endif
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#else
#endif
switch (ret) {
case 1:
goto redo_body;
case 0: /* normal completion */
#ifndef PERL_FLEXIBLE_EXCEPTIONS
#endif
/* FALL THROUGH */
case 2: /* my_exit() */
while (PL_scopestack_ix > oldscope)
if (PL_endav && !PL_minus_c)
#ifdef MYMALLOC
if (PerlEnv_getenv("PERL_DEBUG_MSTATS"))
dump_mstats("after execution: ");
#endif
break;
case 3:
if (PL_restartop) {
goto redo_body;
}
ret = 1;
break;
}
return ret;
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
STATIC void *
{
}
#endif
STATIC void *
{
if (!PL_restartop) {
if (PL_minus_c) {
#ifdef MACOS_TRADITIONAL
#else
#endif
my_exit(0);
}
if (PERLDB_SINGLE && PL_DBsingle)
if (PL_initav)
}
/* do it */
if (PL_restartop) {
PL_restartop = 0;
}
else if (PL_main_start) {
}
my_exit(0);
/* NOTREACHED */
return NULL;
}
/*
=for apidoc p||get_sv
Returns the SV of the specified Perl scalar. If C<create> is set and the
Perl variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
=cut
*/
SV*
{
#ifdef USE_THREADS
if (tmp != NOT_IN_PAD)
}
#endif /* USE_THREADS */
if (gv)
return Nullsv;
}
/*
=for apidoc p||get_av
Returns the AV of the specified Perl array. If C<create> is set and the
Perl variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
=cut
*/
AV*
{
if (create)
if (gv)
return Nullav;
}
/*
=for apidoc p||get_hv
Returns the HV of the specified Perl hash. If C<create> is set and the
Perl variable does not exist then it will be created. If C<create> is not
set and the variable does not exist then NULL is returned.
=cut
*/
HV*
{
if (create)
if (gv)
return Nullhv;
}
/*
=for apidoc p||get_cv
Returns the CV of the specified Perl subroutine. If C<create> is set and
the Perl subroutine does not exist then it will be declared (which has the
same effect as saying C<sub name;>). If C<create> is not set and the
subroutine does not exist then NULL is returned.
=cut
*/
CV*
{
/* XXX unsafe for threads if eval_owner isn't held */
/* XXX this is probably not what they think they're getting.
* It has the same effect as "sub name;", i.e. just a forward
* declaration! */
Nullop);
if (gv)
return Nullcv;
}
/* Be sure to refetch the stack pointer after calling these routines. */
/*
=for apidoc p||call_argv
Performs a callback to the specified Perl sub. See L<perlcall>.
=cut
*/
/* See G_* flags in cop.h */
/* null terminated arg list */
{
dSP;
if (argv) {
while (*argv) {
argv++;
}
}
}
/*
=for apidoc p||call_pv
Performs a callback to the specified Perl sub. See L<perlcall>.
=cut
*/
/* name of the subroutine */
/* See G_* flags in cop.h */
{
}
/*
=for apidoc p||call_method
Performs a callback to the specified Perl method. The blessed object must
be on the stack. See L<perlcall>.
=cut
*/
/* name of the subroutine */
/* See G_* flags in cop.h */
{
}
/* May be called with any of a CV, a GV, or an SV containing the name. */
/*
=for apidoc p||call_sv
Performs a callback to the Perl sub whose name is in the SV. See
L<perlcall>.
=cut
*/
/* See G_* flags in cop.h */
{
dSP;
int ret;
}
SAVEOP();
*++PL_stack_sp = sv;
/* Handle first BEGIN of -d. */
/* Try harder, since this may have been a sighandler, thus
* curstash may be meaningless. */
}
}
else {
/* we're trying to emulate pp_entertry() here */
{
register PERL_CONTEXT *cx;
else
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#else
#endif
switch (ret) {
case 0:
#ifndef PERL_FLEXIBLE_EXCEPTIONS
#endif
break;
case 1:
/* FALL THROUGH */
case 2:
/* my_exit() was called */
my_exit_jump();
/* NOTREACHED */
case 3:
if (PL_restartop) {
PL_restartop = 0;
goto redo_body;
}
retval = 0;
else {
retval = 1;
*++PL_stack_sp = &PL_sv_undef;
}
break;
}
if (PL_scopestack_ix > oldscope) {
register PERL_CONTEXT *cx;
pop_return();
}
}
retval = 0;
}
return retval;
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
STATIC void *
{
return NULL;
}
#endif
STATIC void
{
if (is_eval)
else
}
if (PL_op)
}
/* Eval a string. The G_EVAL flag is always assumed. */
/*
=for apidoc p||eval_sv
Tells Perl to C<eval> the string in the SV.
=cut
*/
/* See G_* flags in cop.h */
{
dSP;
int ret;
}
SAVEOP();
*++PL_stack_sp = sv;
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#else
#endif
switch (ret) {
case 0:
#ifndef PERL_FLEXIBLE_EXCEPTIONS
#endif
break;
case 1:
/* FALL THROUGH */
case 2:
/* my_exit() was called */
my_exit_jump();
/* NOTREACHED */
case 3:
if (PL_restartop) {
PL_restartop = 0;
goto redo_body;
}
retval = 0;
else {
retval = 1;
*++PL_stack_sp = &PL_sv_undef;
}
break;
}
retval = 0;
}
return retval;
}
/*
=for apidoc p||eval_pv
Tells Perl to C<eval> the given string and return an SV* result.
=cut
*/
SV*
{
dSP;
}
return sv;
}
/* Require a module. */
/*
=for apidoc p||require_pv
Tells Perl to C<require> a module.
=cut
*/
void
{
dSP;
sv = sv_newmortal();
}
void
{
}
STATIC void
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that opton. Others? */
static char *usage_msg[] = {
"-0[octal] specify record separator (\\0, if no argument)",
"-a autosplit mode with -n or -p (splits $_ into @F)",
"-C enable native wide character system interfaces",
"-c check syntax only (runs BEGIN and CHECK blocks)",
"-d[:debugger] run program under debugger",
"-e 'command' one line of program (several -e's allowed, omit programfile)",
"-i[extension] edit <> files in place (makes backup if extension supplied)",
"-Idirectory specify @INC/#include directory (several -I's allowed)",
"-l[octal] enable line ending processing, specifies line terminator",
"-n assume 'while (<>) { ... }' loop around program",
"-p assume loop like -n but print line also, like sed",
"-P run program through C preprocessor before compilation",
"-s enable rudimentary parsing for switches after programfile",
"-S look for programfile using PATH environment variable",
"-T enable tainting checks",
"-u dump core after parsing program",
"-U allow unsafe operations",
"-v print version, subversion (includes VERY IMPORTANT perl info)",
"-V[:variable] print configuration summary (or a single Config.pm variable)",
"-w enable many useful warnings (RECOMMENDED)",
"-W enable all warnings",
"-X disable all warnings",
"-x[directory] strip off text before #!perl line and perhaps cd to directory",
"\n",
};
char **p = usage_msg;
"\nUsage: %s [switches] [--] [programfile] [arguments]",
name);
while (*p)
}
/* This routine handles any switches that can be given during run */
char *
Perl_moreswitches(pTHX_ char *s)
{
switch (*s) {
case '0':
{
numlen = 0; /* disallow underscores */
PL_nrs = &PL_sv_undef;
else {
}
return s + numlen;
}
case 'C':
s++;
return s;
case 'F':
PL_minus_F = TRUE;
s += strlen(s);
return s;
case 'a':
PL_minus_a = TRUE;
s++;
return s;
case 'c':
PL_minus_c = TRUE;
s++;
return s;
case 'd':
forbid_setid("-d");
s++;
/* The following permits -d:Mod to accepts arguments following an =
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
char *start;
start = ++s;
/* We now allow -d:Module=Foo,Bar */
while(isALNUM(*s) || *s==':') ++s;
if (*s != '=')
else {
}
s += strlen(s);
}
if (!PL_perldb) {
}
return s;
case 'D':
{
#ifdef DEBUGGING
forbid_setid("-D");
if (isALPHA(s[1])) {
static char debopts[] = "psltocPmfrxuLHXDST";
char *d;
}
else {
for (s++; isDIGIT(*s); s++) ;
}
PL_debug |= 0x80000000;
#else
if (ckWARN_d(WARN_DEBUGGING))
"Recompile perl with -DDEBUGGING to use -D switch\n");
for (s++; isALNUM(*s); s++) ;
#endif
/*SUPPRESS 530*/
return s;
}
case 'h':
usage(PL_origargv[0]);
PerlProc_exit(0);
case 'i':
if (PL_inplace)
/*SUPPRESS 530*/
for (s = PL_inplace; *s && !isSPACE(*s); s++) ;
if (*s) {
*s++ = '\0';
if (*s == '-') /* Additional switches on #! line. */
s++;
}
return s;
case 'I': /* -I handled both here and in parse_perl() */
forbid_setid("-I");
++s;
while (*s && isSPACE(*s))
++s;
if (*s) {
char *e, *p;
p = s;
/* ignore trailing spaces (possibly followed by other switches) */
do {
for (e = p; *e && !isSPACE(*e); e++) ;
p = e;
while (isSPACE(*p))
p++;
} while (*p && *p != '-');
e = savepvn(s, e-s);
Safefree(e);
s = p;
if (*s == '-')
s++;
}
else
return s;
case 'l':
PL_minus_l = TRUE;
s++;
if (PL_ors)
if (isDIGIT(*s)) {
PL_orslen = 1;
numlen = 0; /* disallow underscores */
s += numlen;
}
else {
PL_ors = "\n\n";
PL_orslen = 2;
}
else
}
return s;
case 'M':
/* FALL THROUGH */
case 'm':
if (*++s) {
char *start;
char *use = "use ";
/* -M-foo == 'no foo' */
start = s;
/* We allow -M'Module qw(Foo Bar)' */
while(isALNUM(*s) || *s==':') ++s;
if (*s != '=') {
if (*s != '\0')
}
} else {
if (s == start)
s[-1]);
}
s += strlen(s);
if (!PL_preambleav)
PL_preambleav = newAV();
}
else
return s;
case 'n':
PL_minus_n = TRUE;
s++;
return s;
case 'p':
PL_minus_p = TRUE;
s++;
return s;
case 's':
forbid_setid("-s");
s++;
return s;
case 'T':
if (!PL_tainting)
s++;
return s;
case 'u':
#ifdef MACOS_TRADITIONAL
#endif
PL_do_undump = TRUE;
s++;
return s;
case 'U':
s++;
return s;
case 'v':
#if defined(LOCAL_PATCH_COUNT)
if (LOCAL_PATCH_COUNT > 0)
"\n(with %d registered patch%s, "
"see perl -V for more detail)",
(int)LOCAL_PATCH_COUNT,
#endif
"\n\nCopyright 1987-2001, Larry Wall\n");
#ifdef MACOS_TRADITIONAL
"\nMac OS port Copyright (c) 1991-2001, Matthias Neeracher\n");
#endif
#ifdef MSDOS
"\nMS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n");
#endif
#ifdef DJGPP
"djgpp v2 port (jpl5003c) by Hirofumi Watanabe, 1996\n"
"djgpp v2 port (perl5004+) by Laszlo Molnar, 1997-1999\n");
#endif
#ifdef OS2
"\n\nOS/2 port Copyright (c) 1990, 1991, Raymond Chen, Kai Uwe Rommel\n"
"Version 5 port Copyright (c) 1994-1999, Andreas Kaiser, Ilya Zakharevich\n");
#endif
#ifdef atarist
"atariST series port, ++jrb bammi@cadence.com\n");
#endif
#ifdef __BEOS__
"BeOS port Copyright Tom Spindler, 1997-1999\n");
#endif
#ifdef MPE
#endif
#ifdef OEMVS
"MVS (OS390) port by Mortice Kern Systems, 1997-1999\n");
#endif
#ifdef __VOS__
"Stratus VOS port by Paul_Green@stratus.com, 1997-1999\n");
#endif
#ifdef __OPEN_VM
#endif
#ifdef POSIX_BC
"BS2000 (POSIX) port by Start Amadeus GmbH, 1998-1999\n");
#endif
#ifdef __MINT__
"MiNT port by Guido Flohr, 1997-1999\n");
#endif
#ifdef EPOC
"EPOC port by Olaf Flebbe, 1999-2000\n");
#endif
#ifdef BINARY_BUILD_NOTICE
#endif
"\n\
Perl may be copied only under the terms of either the Artistic License or the\n\
GNU General Public License, which may be found in the Perl 5 source kit.\n\n\
Complete documentation for Perl, including FAQ lists, should be found on\n\
this system using `man perl' or `perldoc perl'. If you have access to the\n\
Internet, point your browser at http://www.perl.com/, the Perl Home Page.\n\n");
PerlProc_exit(0);
case 'w':
if (! (PL_dowarn & G_WARN_ALL_MASK))
s++;
return s;
case 'W':
s++;
return s;
case 'X':
s++;
return s;
case '*':
case ' ':
if (s[1] == '-') /* Additional switches on #! line. */
return s+2;
break;
case '-':
case 0:
#if defined(WIN32) || !defined(PERL_STRICT_CR)
case '\r':
#endif
case '\n':
case '\t':
break;
#ifdef ALTERNATE_SHEBANG
case 'S': /* OS/2 needs -S on "extproc" line. */
break;
#endif
case 'P':
if (PL_preprocess)
return s+1;
/* FALL THROUGH */
default:
}
return Nullch;
}
/* compliments of Tom Christiansen */
/* unexec() can be found in the Gnu emacs distribution */
/* Known to work with -DUNEXEC and using unexelf.c from GNU emacs-20.2 */
void
{
#ifdef UNEXEC
int status = 1;
extern int etext;
/* unexec prints msg to stderr in case of failure */
#else
# ifdef VMS
# else
ABORT(); /* for use with undump */
# endif
#endif
}
/* initialize curinterp */
STATIC void
{
#ifdef PERL_OBJECT /* XXX kludge */
#define I_REINIT \
STMT_START { \
PL_chopset = " \n-"; \
PL_copline = NOLINE; \
PL_curcop = &PL_compiling;\
PL_curcopdb = NULL; \
PL_dbargs = 0; \
PL_dumpindent = 4; \
PL_laststatval = -1; \
PL_laststype = OP_STAT; \
PL_maxscream = -1; \
PL_maxsysfd = MAXSYSFD; \
PL_statname = Nullsv; \
PL_tmps_floor = -1; \
PL_tmps_ix = -1; \
PL_op_mask = NULL; \
PL_laststatval = -1; \
PL_laststype = OP_STAT; \
PL_mess_sv = Nullsv; \
PL_splitstr = " "; \
PL_generation = 100; \
PL_exitlist = NULL; \
PL_exitlistlen = 0; \
PL_regindent = 0; \
PL_in_clean_objs = FALSE; \
PL_in_clean_all = FALSE; \
PL_profiledata = NULL; \
PL_rsfp_filters = Nullav; \
} STMT_END
#else
# ifdef MULTIPLICITY
# if defined(PERL_IMPLICIT_CONTEXT)
# if defined(USE_THREADS)
# else /* !USE_THREADS */
# endif /* USE_THREADS */
# else
# endif
# include "intrpvar.h"
# ifndef USE_THREADS
# include "thrdvar.h"
# endif
# else
# include "intrpvar.h"
# ifndef USE_THREADS
# include "thrdvar.h"
# endif
# endif
#endif
}
STATIC void
{
/* Note that strtab is a rather special HV. Assumptions are made
about not iterating on it, and not adding tie magic to it.
It is properly deallocated in perl_destruct() */
#ifdef USE_THREADS
#endif
/* We must init $/ before switches are processed. */
}
STATIC void
{
*fdscript = -1;
if (PL_e_script) {
}
else {
/* if find_script() returns, it returns a malloc()-ed value */
char *s = scriptname + 8;
while (isDIGIT(*s))
s++;
if (*s) {
}
}
}
#ifdef USE_ITHREADS
#else
#endif
scriptname = "";
if (*fdscript >= 0) {
if (PL_rsfp)
#endif
}
else if (PL_preprocess) {
sed %s -e \"/^[^#]/b\" \
-e \"/^#[ ]*include[ ]/b\" \
-e \"/^#[ ]*define[ ]/b\" \
-e \"/^#[ ]*if[ ]/b\" \
-e \"/^#[ ]*ifdef[ ]/b\" \
-e \"/^#[ ]*ifndef[ ]/b\" \
-e \"/^#[ ]*else/b\" \
-e \"/^#[ ]*elif[ ]/b\" \
-e \"/^#[ ]*undef[ ]/b\" \
-e \"/^#[ ]*endif/b\" \
-e \"s/^#.*//\" \
#else
# ifdef __OPEN_VM
%s %s -e '/^[^#]/b' \
-e '/^#[ ]*include[ ]/b' \
-e '/^#[ ]*define[ ]/b' \
-e '/^#[ ]*if[ ]/b' \
-e '/^#[ ]*ifdef[ ]/b' \
-e '/^#[ ]*ifndef[ ]/b' \
-e '/^#[ ]*else/b' \
-e '/^#[ ]*elif[ ]/b' \
-e '/^#[ ]*undef[ ]/b' \
-e '/^#[ ]*endif/b' \
-e 's/^[ ]*#.*//' \
# else
%s %s -e '/^[^#]/b' \
-e '/^#[ ]*include[ ]/b' \
-e '/^#[ ]*define[ ]/b' \
-e '/^#[ ]*if[ ]/b' \
-e '/^#[ ]*ifdef[ ]/b' \
-e '/^#[ ]*ifndef[ ]/b' \
-e '/^#[ ]*else/b' \
-e '/^#[ ]*elif[ ]/b' \
-e '/^#[ ]*undef[ ]/b' \
-e '/^#[ ]*endif/b' \
-e 's/^[ ]*#.*//' \
# endif
#ifdef LOC_SED
#else
"sed",
#endif
#endif
#ifdef IAMSUID /* actually, this is caught earlier */
#ifdef HAS_SETEUID
#else
#ifdef HAS_SETREUID
#else
#ifdef HAS_SETRESUID
#else
#endif
#endif
#endif
if (PerlProc_geteuid() != PL_uid)
}
#endif /* IAMSUID */
}
else if (!*scriptname) {
forbid_setid("program input from stdin");
PL_rsfp = PerlIO_stdin();
}
else {
if (PL_rsfp)
#endif
}
if (!PL_rsfp) {
#ifdef DOSUID
#ifndef IAMSUID /* in case script is not readable before setuid */
if (PL_euid &&
{
/* try again */
(int)PERL_REVISION, (int)PERL_VERSION,
(int)PERL_SUBVERSION), PL_origargv);
}
#endif
#endif
}
}
/* Mention
* I_SYSSTATVFS HAS_FSTATVFS
* I_SYSMOUNT
* I_STATFS HAS_FSTATFS HAS_GETFSSTAT
* I_MNTENT HAS_GETMNTENT HAS_HASMNTOPT
* here so that metaconfig picks them up. */
#ifdef IAMSUID
STATIC int
{
int check_okay = 0; /* able to do all the required sys/libcalls */
int on_nosuid = 0; /* the fd is on a nosuid fs */
/*
* Preferred order: fstatvfs(), fstatfs(), ustat()+getmnt(), getmntent().
* fstatvfs() is UNIX98.
* fstatfs() is 4.3 BSD.
* ustat()+getmnt() is pre-4.3 BSD.
* getmntent() is O(number-of-mounted-filesystems) and can hang on
* an irrelevant filesystem while trying to reach the right one.
*/
# if !defined(FD_ON_NOSUID_CHECK_OKAY) && \
defined(HAS_FSTATVFS)
# define FD_ON_NOSUID_CHECK_OKAY
# endif /* fstatvfs */
# if !defined(FD_ON_NOSUID_CHECK_OKAY) && \
defined(PERL_MOUNT_NOSUID) && \
defined(HAS_FSTATFS) && \
defined(HAS_STRUCT_STATFS) && \
defined(HAS_STRUCT_STATFS_F_FLAGS)
# define FD_ON_NOSUID_CHECK_OKAY
# endif /* fstatfs */
# if !defined(FD_ON_NOSUID_CHECK_OKAY) && \
defined(PERL_MOUNT_NOSUID) && \
defined(HAS_FSTAT) && \
defined(HAS_USTAT) && \
defined(HAS_GETMNT) && \
defined(HAS_STRUCT_FS_DATA) && \
defined(NOSTAT_ONE)
# define FD_ON_NOSUID_CHECK_OKAY
/* NOSTAT_ONE here because we're not examining fields which
* vary between that case and STAT_ONE. */
check_okay = 1;
}
}
}
}
}
# endif /* fstat+ustat+getmnt */
# if !defined(FD_ON_NOSUID_CHECK_OKAY) && \
defined(HAS_GETMNTENT) && \
defined(HAS_HASMNTOPT) && \
defined(MNTOPT_NOSUID)
# define FD_ON_NOSUID_CHECK_OKAY
{
/* found the filesystem */
check_okay = 1;
on_nosuid = 1;
break;
} /* A single fs may well fail its stat(). */
}
}
if (mtab)
# endif /* getmntent+hasmntopt */
if (!check_okay)
return on_nosuid;
}
#endif /* IAMSUID */
STATIC void
{
#ifdef IAMSUID
int which;
#endif
/* do we need to emulate setuid on scripts? */
/* This code is for those BSD systems that have setuid #! scripts disabled
* in the kernel because of a security problem. Merely defining DOSUID
* in perl will not fix that problem, but if you have disabled setuid
* scripts in the kernel, this will attempt to emulate setuid and setgid
* on scripts that have those now-otherwise-useless bits set. The setuid
* root version must be called suidperl or sperlN.NNN. If regular perl
* discovers that it has opened a setuid script, it calls suidperl with
* the same argv that it had. If suidperl finds that the script it has
* just opened is NOT setuid root, it sets the effective uid back to the
* uid. We don't just make perl setuid root because that loses the
* effective uid we had before invoking perl, if it was different from the
* uid.
*
* DOSUID must be defined in both perl and suidperl, and IAMSUID must
* be defined in suidperl only. suidperl must be setuid root. The
* Configure script will set this up for you if you want it.
*/
#ifdef DOSUID
char *s, *s2;
#ifdef IAMSUID
#ifndef HAS_SETREUID
/* On this access check to make sure the directories are readable,
* there is actually a small window that the user could use to make
* filename point to an accessible directory. So there is a faint
* chance that someone could execute a setuid script down in a
* non-accessible directory. I don't know what to do about that.
* But I don't think it's too important. The manual lies when
* it says access() is useful in setuid programs.
*/
#else
/* If we can swap euid and uid, then we can determine access rights
* with a simple stat of the file, and then compare device and
* inode to make sure we did stat() on the same file we opened.
* Then we just have to make sure he or she can execute it.
*/
{
struct stat tmpstatbuf;
if (
#ifdef HAS_SETREUID
#else
# if HAS_SETRESUID
# endif
#endif
#if defined(IAMSUID) && !defined(NO_NOSUID_CHECK)
#endif
(void)PerlIO_close(PL_rsfp);
}
if (
#ifdef HAS_SETREUID
#else
# if defined(HAS_SETRESUID)
# endif
#endif
}
#endif /* HAS_SETREUID */
#endif /* IAMSUID */
if (*s == ' ') s++;
while (!isSPACE(*s)) s++;
while (*s == ' ' || *s == '\t') s++;
/*
* #! arg must be what we saw above. They can invoke it by
* mentioning suidperl explicitly, but they may not add any strange
* arguments beyond what #! says if they do invoke suidperl that way.
*/
#ifndef IAMSUID
if (!PL_do_undump)
FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
#endif /* IAMSUID */
if (PL_euid) { /* oops, we're not the setuid root perl */
(void)PerlIO_close(PL_rsfp);
#ifndef IAMSUID
/* try again */
(int)PERL_REVISION, (int)PERL_VERSION,
(int)PERL_SUBVERSION), PL_origargv);
#endif
}
#ifdef HAS_SETEGID
#else
#ifdef HAS_SETREGID
#else
#ifdef HAS_SETRESGID
#else
#endif
#endif
#endif
}
#ifdef HAS_SETEUID
#else
#ifdef HAS_SETREUID
#else
#ifdef HAS_SETRESUID
#else
#endif
#endif
#endif
}
else if (PL_uid) { /* oops, mustn't run as root */
#ifdef HAS_SETEUID
#else
#ifdef HAS_SETREUID
#else
#ifdef HAS_SETRESUID
#else
#endif
#endif
#endif
if (PerlProc_geteuid() != PL_uid)
}
init_ids();
}
#ifdef IAMSUID
else if (PL_preprocess)
else if (fdscript >= 0)
else
/* We absolutely must clear out any saved ids here, so we */
/* exec the real perl, substituting fd script for scriptname. */
/* (We pass script name as "subdir" of fd, which perl will grok.) */
if (!PL_origargv[which])
#endif
(int)PERL_REVISION, (int)PERL_VERSION,
#endif /* IAMSUID */
#else /* !DOSUID */
#ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
||
)
if (!PL_do_undump)
FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
#endif /* SETUID_SCRIPTS_ARE_SECURE_NOW */
/* not set-id, must be wrapped */
}
#endif /* DOSUID */
}
STATIC void
{
register char *s, *s2;
/* skip forward in input to the real script? */
forbid_setid("-x");
#ifdef MACOS_TRADITIONAL
/* Since the Mac OS does not honor #! arguments for us, we do it ourselves */
while (PL_doextract || gMacPerl_AlwaysExtract) {
if (!gMacPerl_AlwaysExtract)
if (PL_doextract) /* require explicit override ? */
if (!OverrideExtract(PL_origfilename))
else
/* Pater peccavi, file does not have #! */
break;
}
#else
while (PL_doextract) {
#endif
while (*s && !(isSPACE (*s) || *s == '#')) s++;
s2 = s;
while (*s == ' ' || *s == '\t') s++;
if (*s++ == '-') {
/*SUPPRESS 530*/
while ((s = moreswitches(s)))
;
}
}
}
}
STATIC void
{
PL_uid = PerlProc_getuid();
PL_euid = PerlProc_geteuid();
PL_gid = PerlProc_getgid();
PL_egid = PerlProc_getegid();
#ifdef VMS
#endif
}
STATIC void
S_forbid_setid(pTHX_ char *s)
{
}
void
{
sv_setiv(PL_DBsingle, 0);
sv_setiv(PL_DBtrace, 0);
sv_setiv(PL_DBsignal, 0);
}
#ifndef STRESS_REALLOC
#else
#endif
void
{
/* start with 128-item stack and 8K cxstack */
PL_tmps_floor = -1;
PL_tmps_ix = -1;
PL_scopestack_ix = 0;
PL_savestack_ix = 0;
PL_retstack_ix = 0;
}
STATIC void
{
while (PL_curstackinfo->si_next)
while (PL_curstackinfo) {
/* curstackinfo->si_stack got nuked by sv_free_arenas() */
PL_curstackinfo = p;
}
}
#ifndef PERL_OBJECT
#endif
STATIC void
{
#ifdef PERL_OBJECT
#endif
}
STATIC void
{
if (PL_osname)
}
STATIC void
{
char *s;
char **dup_env_base = 0;
int dup_env_count = 0;
if (PL_doswitches) {
if (!argv[0][1])
break;
break;
}
*s++ = '\0';
}
else
}
}
PL_toptarget = NEWSV(0,0);
PL_bodytarget = NEWSV(0,0);
#ifdef MACOS_TRADITIONAL
/* $0 is not majick on a Mac */
#else
#endif
}
#ifdef OS2
#else
#endif
if (PL_widesyscalls)
(void)sv_utf8_decode(sv);
}
}
#ifdef USE_ENVIRON_ARRAY
/* Note that if the supplied env parameter is actually a copy
of the global environ then it may now point to free'd memory
if the environment has been modified since. To avoid this
problem we treat env==NULL as meaning 'use the default'
*/
if (!env)
#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
{
char **env_base;
if ((dup_env_base = (char **)
char **dup_env;
*env;
/* With environ one needs to use safesysmalloc(). */
}
env = dup_env_base;
} /* else what? */
}
#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
continue;
*s++ = '\0';
#if defined(MSDOS)
#endif
*s = '=';
}
#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
if (dup_env_base) {
char **dup_env;
}
#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
#endif /* USE_ENVIRON_ARRAY */
#ifdef DYNAMIC_ENV_FETCH
#endif
}
}
STATIC void
{
char *s;
if (!PL_tainting) {
#ifndef VMS
s = PerlEnv_getenv("PERL5LIB");
if (s)
else
#else /* VMS */
/* Treat PERL5?LIB as a possible search list logical name -- the
* "natural" VMS idiom for a Unix path string. We allow each
* element to be a set of |-separated directories for compatibility.
*/
char buf[256];
int idx = 0;
else
#endif /* VMS */
}
/* Use the ~-expanded versions of APPLLIB (undocumented),
ARCHLIB PRIVLIB SITEARCH SITELIB VENDORARCH and VENDORLIB
*/
#ifdef APPLLIB_EXP
#endif
#ifdef ARCHLIB_EXP
#endif
#ifdef MACOS_TRADITIONAL
{
struct stat tmpstatbuf;
if (!macperl)
macperl = "";
}
if (!PL_tainting)
#else
#ifndef PRIVLIB_EXP
#endif
#if defined(WIN32)
#else
#endif
#ifdef SITEARCH_EXP
/* sitearch is always relative to sitelib on Windows for
* DLL-based path intuition to work correctly */
# if !defined(WIN32)
# endif
#endif
#ifdef SITELIB_EXP
# if defined(WIN32)
# else
# endif
#endif
#ifdef SITELIB_STEM /* Search for version-specific dirs below here */
#endif
#ifdef PERL_VENDORARCH_EXP
/* vendorarch is always relative to vendorlib on Windows for
* DLL-based path intuition to work correctly */
# if !defined(WIN32)
# endif
#endif
#ifdef PERL_VENDORLIB_EXP
# if defined(WIN32)
# else
# endif
#endif
#ifdef PERL_VENDORLIB_STEM /* Search for version-specific dirs below here */
#endif
#ifdef PERL_OTHERLIBDIRS
#endif
if (!PL_tainting)
#endif /* MACOS_TRADITIONAL */
}
# define PERLLIB_SEP ';'
#else
# if defined(VMS)
# define PERLLIB_SEP '|'
# else
# if defined(MACOS_TRADITIONAL)
# define PERLLIB_SEP ','
# else
# define PERLLIB_SEP ':'
# endif
# endif
#endif
#ifndef PERLLIB_MANGLE
# define PERLLIB_MANGLE(s,n) (s)
#endif
STATIC void
{
if (!p || !*p)
return;
if (addsubdirs || addoldvers) {
subdir = sv_newmortal();
}
/* Break at all separators */
while (p && *p) {
char *s;
/* skip any consecutive separators */
while ( *p == PERLLIB_SEP ) {
/* Uncomment the next line for PATH semantics */
/* av_push(GvAVn(PL_incgv), newSVpvn(".", 1)); */
p++;
}
(STRLEN)(s - p));
p = s + 1;
}
else {
p = Nullch; /* break out */
}
#ifdef MACOS_TRADITIONAL
#endif
/*
* BEFORE pushing libdir onto @INC we may first push version- and
* archname-specific sub-directories.
*/
if (addsubdirs || addoldvers) {
#ifdef PERL_INC_VERSION_LIST
/* Configure terminates PERL_INC_VERSION_LIST with a NULL */
const char *incverlist[] = { PERL_INC_VERSION_LIST };
const char **incver;
#endif
struct stat tmpstatbuf;
#ifdef VMS
char *unix;
}
else
"Failed to unixify @INC element \"%s\"\n",
#endif
if (addsubdirs) {
#ifdef MACOS_TRADITIONAL
#define PERL_AV_SUFFIX_FMT ""
#define PERL_ARCH_FMT "%s:"
#else
#define PERL_AV_SUFFIX_FMT "/"
#define PERL_ARCH_FMT "/%s"
#endif
(int)PERL_REVISION, (int)PERL_VERSION,
(int)PERL_SUBVERSION, ARCHNAME);
/* .../version if -d .../version */
(int)PERL_REVISION, (int)PERL_VERSION,
(int)PERL_SUBVERSION);
/* .../archname if -d .../archname */
}
#ifdef PERL_INC_VERSION_LIST
if (addoldvers) {
/* .../xxx if -d .../xxx */
}
}
#endif
}
/* finally push this lib directory on the end of @INC */
}
}
#ifdef USE_THREADS
STATIC struct perl_thread *
{
#if !defined(PERL_IMPLICIT_CONTEXT)
struct perl_thread *thr;
#endif
/* thr->threadsvp is set when find_threadsv is called */
/* Handcraft thrsv similarly to mess_sv */
PL_chopset = " \n-";
PL_dumpindent = 4;
PL_nthreads++;
#ifdef HAVE_THREAD_INTERN
#endif
#ifdef SET_THREAD_SELF
#else
#endif /* SET_THREAD_SELF */
/*
* These must come after the thread self setting
* because sv_setpvn does SvTAINT and the taint
* fields thread selfness being set.
*/
PL_toptarget = NEWSV(0,0);
PL_bodytarget = NEWSV(0,0);
PL_maxscream = -1;
PL_regindent = 0;
PL_reginterp_cnt = 0;
return thr;
}
#endif /* USE_THREADS */
void
{
int ret;
/* save PL_beginav for compiler */
if (! PL_beginav_save)
PL_beginav_save = newAV();
} else {
SAVEFREESV(cv);
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
#else
#endif
switch (ret) {
case 0:
#ifndef PERL_FLEXIBLE_EXCEPTIONS
#endif
if (len) {
if (paramList == PL_beginav)
else
"%s failed--call queue aborted",
: "END");
while (PL_scopestack_ix > oldscope)
}
break;
case 1:
/* FALL THROUGH */
case 2:
/* my_exit() was called */
while (PL_scopestack_ix > oldscope)
if (paramList == PL_beginav)
else
: "END");
}
my_exit_jump();
/* NOTREACHED */
case 3:
if (PL_restartop) {
JMPENV_JUMP(3);
}
break;
}
}
}
#ifdef PERL_FLEXIBLE_EXCEPTIONS
STATIC void *
{
return call_list_body(cv);
}
#endif
STATIC void *
{
return NULL;
}
void
{
switch (status) {
case 0:
break;
case 1:
break;
default:
break;
}
my_exit_jump();
}
void
{
#ifdef VMS
STATUS_NATIVE_SET(44);
}
else {
STATUS_NATIVE_SET(44);
else
}
#else
int exitstatus;
if (errno & 255)
else {
if (exitstatus & 255)
else
STATUS_POSIX_SET(255);
}
#endif
my_exit_jump();
}
STATIC void
{
register PERL_CONTEXT *cx;
if (PL_e_script) {
}
if (cxstack_ix >= 0) {
if (cxstack_ix > 0)
dounwind(0);
}
JMPENV_JUMP(2);
}
#ifdef PERL_OBJECT
#include "XSUB.h"
#endif
static I32
{
char *p, *nl;
p = SvPVX(PL_e_script);
if (nl-p == 0) {
return 0;
}
return 1;
}