summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-01-25 15:58:00 +1200
committerChip Salzenberg <chip@atlantic.net>1997-01-25 15:58:00 +1200
commit774d564bb7dd1ed64ca0d7e534aa67e93f991f02 (patch)
tree2e8fac95be59aed598a9217a2911632612d07854 /perl.c
parent9e3a2af888982d0a201149cbcdbf3feb6771acb4 (diff)
parentbbad36071d5a6d4be3588f0f10c88247439076d8 (diff)
downloadperl-774d564bb7dd1ed64ca0d7e534aa67e93f991f02.tar.gz
[inseparable changes from patch from perl5.003_22 to perl5.003_23]perl-5.003_23
BUILD PROCESS Subject: Make configure.gnu a copy of configure; make configure writea From: Chip Salzenberg <chip@atlantic.net> Files: MANIFEST configure.gnu Subject: Regen Configure with metaconfig: +ARCHNAME, -FILE_filbuf From: Chip Salzenberg <chip@perl.com> Files: Configure config_H config_h.SH hints/lynxos.sh os2/diff.configure os2/os2ish.h plan9/config.plan9 sv.c utils/perlbug.PL vms/config.vms vms/fndvers.com Subject: Compile with optimization when testing memory functions From: Chip Salzenberg <chip@atlantic.net> Files: Configure CORE LANGUAGE CHANGES Subject: Disallow changing $_[0] in __DIE__ handlers From: Chip Salzenberg <chip@atlantic.net> Files: pod/perlfunc.pod util.c Subject: Fix overloading with inheritance and AUTOLOAD Date: Mon, 20 Jan 1997 17:26:32 -0500 (EST) From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: gv.c lib/diagnostics.pm lib/overload.pm pod/perldebug.pod pod/perldiag.pod pod/perlfunc.pod pod/perlop.pod pod/perlre.pod pod/perltoc.pod pod/perlxs.pod Msg-ID: <199701202226.RAA05072@monk.mps.ohio-state.edu> (applied based on p5p patch as commit e7ea3e70155d0bea30720ba41eb6bb6742aac0d1) Subject: Nested here-docs Date: Mon, 20 Jan 1997 15:13:42 -0800 From: Larry Wall <larry@wall.org> Files: toke.c Msg-ID: <199701202313.PAA11693@wall.org> (applied based on p5p patch as commit fd2d0953290ddd46f0820dbd6c87245486b7ab28) Subject: Revert $^X to old behavior (plus HP-UX bug fix) From: Chip Salzenberg <chip@atlantic.net> Files: hints/hpux.sh toke.c Subject: Protect against '0' in 'stmt while <HANDLE>' From: Chip Salzenberg <chip@atlantic.net> Files: op.c Subject: Don't warn when closure uses var at file scope From: Chip Salzenberg <chip@atlantic.net> Files: op.c CORE PORTABILITY Subject: VMS patches for _22 Date: Mon, 20 Jan 1997 22:50:21 -0500 (EST) From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU> Files: ext/POSIX/POSIX.xs lib/ExtUtils/MM_VMS.pm lib/ExtUtils/xsubpp lib/Test/Harness.pm toke.c vms/Makefile vms/descrip.mms vms/genconfig.pl vms/perly_c.vms vms/vmsish.h x2p/a2p.h vms/Makefile vms/config.vms vms/descrip.mms vms/perly_c.vms private-msgid: <01IEGBJ2TMYS003PCL@hmivax.humgen.upenn.edu> Subject: Plan9 update From: Luther Huffman <lutherh@stratcom.com> Files: plan9/config.plan9 plan9/mkfile Subject: hints & Configure changes to build perl on DC/OSx Date: Thu, 16 Jan 1997 16:43:52 -0800 From: Stephen Zander <stephen.zander@interlock.mckesson.com> Files: Configure MANIFEST hints/dcosx.sh Msg-ID: <199701170043.QAA25985@wsbip1.mckesson.com> (applied based on p5p patch as commit 23f8769697279d7912be5943de9fdf93f6aa3013) DOCUMENTATION Subject: Additional docs for __DIE__ and __WARN__ From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: pod/perlfunc.pod pod/perlrun.pod pod/perlvar.pod Subject: Document #line directive Date: Fri, 24 Jan 1997 04:08:44 -0500 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: pod/perlsyn.pod pod/perltoc.pod private-msgid: <199701240908.EAA23846@aatma.engin.umich.edu> Subject: delta for perldelta Date: Fri, 24 Jan 1997 07:57:43 -0800 From: Tom Christiansen <tchrist@mox.perl.com> Files: pod/perlnews.pod pod/perltoc.pod private-msgid: <804.854121463@jinete> Subject: Updates to perldelta Date: Mon, 20 Jan 1997 06:48:49 -0500 (EST) From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: pod/perlnews.pod pod/perltoc.pod private-msgid: <199701211610.LAA06227@monk.mps.ohio-state.edu> Subject: perlnews.pod diff for the Fcntl Date: Tue, 21 Jan 1997 18:00:56 +0200 (EET) From: Jarkko Hietaniemi <jhi@cc.hut.fi> Files: pod/perlnews.pod private-msgid: <199701211600.SAA30117@alpha.hut.fi> Subject: Rename perlnews -> perldelta per Tom's request From: Chip Salzenberg <chip@atlantic.net> Files: MANIFEST pod/Makefile pod/buildtoc pod/perl.pod pod/perldelta.pod pod/perltoc.pod pod/roffitall LIBRARY AND EXTENSIONS Subject: Refresh IO to 1.15 (plus DESTROY and new_tmpfile fixes) From: Chip Salzenberg <chip@atlantic.net> Files: ext/IO/lib/IO/File.pm ext/IO/lib/IO/Handle.pm ext/IO/lib/IO/Pipe.pm ext/IO/lib/IO/Seekable.pm ext/IO/lib/IO/Socket.pm t/lib/io_pipe.t Subject: Allow IO.xs to remain at 1.15 while $VERSION is 1.1501 From: Chip Salzenberg <chip@atlantic.net> Files: XSUB.h ext/IO/Makefile.PL ext/IO/lib/IO/Handle.pm Subject: Add E* and SA_* constants Date: Wed, 22 Jan 1997 21:36:07 -0500 From: Roderick Schertler <roderick@gate.net> Files: ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod ext/POSIX/POSIX.xs private-msgid: <23338.853986967@eeyore.ibcinc.com> OTHER CORE CHANGES Subject: Make PERL5LIB and -I work like C<use lib> Date: Thu, 23 Jan 1997 15:23:27 +0000 From: Tim Bunce <Tim.Bunce@ig.co.uk> Files: lib/lib.pm perl.c private-msgid: <9701231523.AA26613@toad.ig.co.uk> Subject: Fix /\G.a/ From: Chip Salzenberg <chip@atlantic.net> Files: regcomp.c regcomp.h regexec.c regexp.h toke.c Subject: Extend stack in pp_undef (!) From: Chip Salzenberg <chip@atlantic.net> Files: pp.c Subject: Allow for sub to be redefined while executing From: Chip Salzenberg <chip@atlantic.net> Files: cop.h pp_hot.c t/op/misc.t Subject: Eliminate redundant flag CVf_FORMAT From: Chip Salzenberg <chip@atlantic.net> Files: cv.h op.c perl.c perly.c perly.y proto.h sv.c toke.c Subject: Generate IVs when possible in abs() and int() From: Chip Salzenberg <chip@atlantic.net> Files: pp.c Subject: Efficiency patchlet for pp_aassign() Date: Mon, 20 Jan 1997 22:05:39 -0500 (EST) From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: pp_hot.c Msg-ID: <199701210305.WAA05451@monk.mps.ohio-state.edu> (applied based on p5p patch as commit 7e42bd57a6867e174bc3bc555c3268b485940a98) Subject: Remove "suidperl security patch" message From: Chip Salzenberg <chip@atlantic.net> Files: perl.c TESTS Subject: Fix tests of $^X and $0 to work with QNX From: Chip Salzenberg <chip@atlantic.net> Files: t/lib/io_pipe.t t/lib/open2.t t/lib/open3.t t/op/magic.t Subject: Patch tests for systems without fork() Date: Thu, 23 Jan 1997 23:51:28 +0100 From: "Norbert Pueschel" <pueschel@imsdd.meb.uni-bonn.de> Files: t/io/pipe.t t/lib/filehand.t t/lib/io_pipe.t t/lib/io_sock.t t/lib/open2.t t/lib/open3.t t/op/fork.t private-msgid: <77724697@Armageddon.meb.uni-bonn.de> Subject: Test patches for OS/2 Date: Thu, 16 Jan 1997 23:48:18 -0500 (EST) From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: os2/OS2/ExtAttr/t/os2_ea.t os2/OS2/PrfDB/t/os2_prfdb.t os2/OS2/REXX/t/rx_cmprt.t os2/OS2/REXX/t/rx_dllld.t os2/OS2/REXX/t/rx_objcall.t os2/OS2/REXX/t/rx_sql.test os2/OS2/REXX/t/rx_tiesql.test os2/OS2/REXX/t/rx_tievar.t os2/OS2/REXX/t/rx_tieydb.t os2/OS2/REXX/t/rx_varset.t os2/OS2/REXX/t/rx_vrexx.t t/README t/cmd/while.t t/comp/colon.t t/comp/multiline.t t/io/argv.t t/lib/anydbm.t t/lib/gdbm.t t/lib/ndbm.t t/lib/odbm.t t/lib/sdbm.t t/op/cmp.t t/op/magic.t Msg-ID: <199701170448.XAA28948@monk.mps.ohio-state.edu> (applied based on p5p patch as commit bbad36071d5a6d4be3588f0f10c88247439076d8) UTILITIES Subject: Translate \200 to &#200; in pod2html From: Chip Salzenberg <chip@atlantic.net> Files: pod/pod2html.PL Subject: VMS patches: '.com' extension on scripts Date: Fri, 24 Jan 1997 18:42:29 -0500 (EST) From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU> Files: pod/checkpods.PL pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL utils/c2ph.PL utils/h2ph.PL utils/h2xs.PL utils/perlbug.PL utils/perldoc.PL utils/pl2pm.PL utils/splain.PL vms/Makefile vms/descrip.mms x2p/find2perl.PL x2p/s2p.PL private-msgid: <01IELNPDLYJM003E7J@hmivax.humgen.upenn.edu>
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c165
1 files changed, 106 insertions, 59 deletions
diff --git a/perl.c b/perl.c
index d6f055de15..9b9265cab1 100644
--- a/perl.c
+++ b/perl.c
@@ -59,7 +59,7 @@ dEXTCONST char rcsid[] = "perl.c\nPatch level: ###\n";
static void find_beginning _((void));
static void forbid_setid _((char *));
-static void incpush _((char *));
+static void incpush _((char *, int));
static void init_ids _((void));
static void init_debugger _((void));
static void init_lexer _((void));
@@ -561,10 +561,10 @@ setuid perl scripts securely.\n");
sv_catpv(sv,s);
sv_catpv(sv," ");
if (*++s) {
- av_push(GvAVn(incgv),newSVpv(s,0));
+ incpush(s, TRUE);
}
else if (argv[1]) {
- av_push(GvAVn(incgv),newSVpv(argv[1],0));
+ incpush(argv[1], TRUE);
sv_catpv(sv,argv[1]);
argc--,argv++;
sv_catpv(sv," ");
@@ -881,7 +881,7 @@ I32 create;
{
GV* gv = gv_fetchpv(name, create, SVt_PVCV);
if (create && !GvCVu(gv))
- return newSUB(start_subparse(0),
+ return newSUB(start_subparse(FALSE, 0),
newSVOP(OP_CONST, 0, newSVpv(name,0)),
Nullop,
Nullop);
@@ -1190,47 +1190,6 @@ I32 namlen;
sv_magic(GvSV(gv), (SV*)gv, 0, name, namlen);
}
-#if defined(DOSISH)
-# define PERLLIB_SEP ';'
-#else
-# if defined(VMS)
-# define PERLLIB_SEP '|'
-# else
-# define PERLLIB_SEP ':'
-# endif
-#endif
-#ifndef PERLLIB_MANGLE
-# define PERLLIB_MANGLE(s,n) (s)
-#endif
-
-static void
-incpush(p)
-char *p;
-{
- char *s;
-
- if (!p)
- return;
-
- /* Break at all separators */
- while (*p) {
- /* First, skip any consecutive separators */
- while ( *p == PERLLIB_SEP ) {
- /* Uncomment the next line for PATH semantics */
- /* av_push(GvAVn(incgv), newSVpv(".", 1)); */
- p++;
- }
- if ( (s = strchr(p, PERLLIB_SEP)) != Nullch ) {
- av_push(GvAVn(incgv), newSVpv(PERLLIB_MANGLE(p, (STRLEN)(s - p)),
- (STRLEN)(s - p)));
- p = s + 1;
- } else {
- av_push(GvAVn(incgv), newSVpv(PERLLIB_MANGLE(p, 0), 0));
- break;
- }
- }
-}
-
static void
usage(name) /* XXX move this out into a module ? */
char *name;
@@ -1346,9 +1305,11 @@ char *s;
case 'I':
forbid_setid("-I");
if (*++s) {
- char *e;
+ char *e, *p;
for (e = s; *e && !isSPACE(*e); e++) ;
- av_push(GvAVn(incgv),newSVpv(s,e-s));
+ p = savepvn(s, e-s);
+ incpush(p, TRUE);
+ Safefree(p);
if (*e)
return e;
}
@@ -1444,7 +1405,6 @@ char *s;
#endif
printf("\n\nCopyright 1987-1997, Larry Wall\n");
- printf("\n\t+ suidperl security patch");
#ifdef MSDOS
printf("\n\nMS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n");
#endif
@@ -2298,9 +2258,9 @@ init_perllib()
#ifndef VMS
s = getenv("PERL5LIB");
if (s)
- incpush(s);
+ incpush(s, TRUE);
else
- incpush(getenv("PERLLIB"));
+ incpush(getenv("PERLLIB"), FALSE);
#else /* VMS */
/* Treat PERL5?LIB as a possible search list logical name -- the
* "natural" VMS idiom for a Unix path string. We allow each
@@ -2309,9 +2269,9 @@ init_perllib()
char buf[256];
int idx = 0;
if (my_trnlnm("PERL5LIB",buf,0))
- do { incpush(buf); } while (my_trnlnm("PERL5LIB",buf,++idx));
+ do { incpush(buf,TRUE); } while (my_trnlnm("PERL5LIB",buf,++idx));
else
- while (my_trnlnm("PERLLIB",buf,idx++)) incpush(buf);
+ while (my_trnlnm("PERLLIB",buf,idx++)) incpush(buf,FALSE);
#endif /* VMS */
}
@@ -2319,29 +2279,116 @@ init_perllib()
ARCHLIB PRIVLIB SITEARCH SITELIB and OLDARCHLIB
*/
#ifdef APPLLIB_EXP
- incpush(APPLLIB_EXP);
+ incpush(APPLLIB_EXP, FALSE);
#endif
#ifdef ARCHLIB_EXP
- incpush(ARCHLIB_EXP);
+ incpush(ARCHLIB_EXP, FALSE);
#endif
#ifndef PRIVLIB_EXP
#define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
#endif
- incpush(PRIVLIB_EXP);
+ incpush(PRIVLIB_EXP, FALSE);
#ifdef SITEARCH_EXP
- incpush(SITEARCH_EXP);
+ incpush(SITEARCH_EXP, FALSE);
#endif
#ifdef SITELIB_EXP
- incpush(SITELIB_EXP);
+ incpush(SITELIB_EXP, FALSE);
#endif
#ifdef OLDARCHLIB_EXP /* 5.00[01] compatibility */
- incpush(OLDARCHLIB_EXP);
+ incpush(OLDARCHLIB_EXP, FALSE);
#endif
if (!tainting)
- incpush(".");
+ incpush(".", FALSE);
+}
+
+#if defined(DOSISH)
+# define PERLLIB_SEP ';'
+#else
+# if defined(VMS)
+# define PERLLIB_SEP '|'
+# else
+# define PERLLIB_SEP ':'
+# endif
+#endif
+#ifndef PERLLIB_MANGLE
+# define PERLLIB_MANGLE(s,n) (s)
+#endif
+
+static void
+incpush(p, addsubdirs)
+char *p;
+int addsubdirs;
+{
+ SV *subdir = Nullsv;
+ static char *archpat_auto;
+
+ if (!p)
+ return;
+
+ if (addsubdirs) {
+ subdir = newSV(0);
+ if (!archpat_auto) {
+ STRLEN len = (sizeof(ARCHNAME) + strlen(patchlevel)
+ + sizeof("//auto"));
+ New(55, archpat_auto, len, char);
+ sprintf(archpat_auto, "/%s/%s/auto", ARCHNAME, patchlevel);
+ }
+ }
+
+ /* Break at all separators */
+ while (p && *p) {
+ SV *libdir = newSV(0);
+ char *s;
+
+ /* skip any consecutive separators */
+ while ( *p == PERLLIB_SEP ) {
+ /* Uncomment the next line for PATH semantics */
+ /* av_push(GvAVn(incgv), newSVpv(".", 1)); */
+ p++;
+ }
+
+ if ( (s = strchr(p, PERLLIB_SEP)) != Nullch ) {
+ sv_setpvn(libdir, PERLLIB_MANGLE(p, (STRLEN)(s - p)),
+ (STRLEN)(s - p));
+ p = s + 1;
+ }
+ else {
+ sv_setpv(libdir, PERLLIB_MANGLE(p, 0));
+ p = Nullch; /* break out */
+ }
+
+ /*
+ * BEFORE pushing libdir onto @INC we may first push version- and
+ * archname-specific sub-directories.
+ */
+ if (addsubdirs) {
+ struct stat tmpstatbuf;
+
+ /* .../archname/version if -d .../archname/auto */
+ sv_setsv(subdir, libdir);
+ sv_catpv(subdir, archpat_auto);
+ if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
+ S_ISDIR(tmpstatbuf.st_mode))
+ av_push(GvAVn(incgv),
+ newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
+
+ /* .../archname/version if -d .../archname/version/auto */
+ sv_insert(subdir, SvCUR(libdir) + sizeof(ARCHNAME),
+ strlen(patchlevel) + 1, "", 0);
+ if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
+ S_ISDIR(tmpstatbuf.st_mode))
+ av_push(GvAVn(incgv),
+ newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
+ }
+
+ /* finally push this lib directory on the end of @INC */
+ av_push(GvAVn(incgv), libdir);
+ }
+
+ SvREFCNT_dec(subdir);
}
void