summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-07-08 20:10:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-07-08 20:10:15 +0000
commit556c1dec75ad51f872cfdfbbd8c86d5def08c80b (patch)
treedecc7d109a54f67947fffc69166b3edb0a96d46d /toke.c
parentd2ccd3cbfc4a43ae3c17071c87b4d721f3560ad6 (diff)
downloadperl-556c1dec75ad51f872cfdfbbd8c86d5def08c80b.tar.gz
Integrate maint patches #17421, #17424:
on platforms like HP-UX that are subject to the ARG_ZERO_IS_SCRIPT hack, $^X was improperly set to the script name when the script was run via the PATH; argv[0] in that case shows up as the bare name of the script rather than its fully qualified path, which meant that the sanity check in the ARG_ZERO_IS_SCRIPT code fails to recognize it as the running script name; fix tries to match bare script name in that case (from Gisle Aas) tweak change#17421 ($0 is full path to script even when script is invoked via PATH almost everywhere except Windows) p4raw-link: @17421 on //depot/maint-5.6/perl: 32099b6ba13a228ffd08d5c7359d07c687b11471 p4raw-id: //depot/perl@17425 p4raw-integrated: from //depot/maint-5.6/perl@17423 'edit in' t/op/magic.t (@17421..) 'merge in' toke.c (@16508..)
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 4077c6052d..8d8ac54eeb 100644
--- a/toke.c
+++ b/toke.c
@@ -2614,6 +2614,19 @@ Perl_yylex(pTHX)
sv_setpvn(x, ipath, ipathend - ipath);
SvSETMAGIC(x);
}
+ else {
+ STRLEN blen;
+ STRLEN llen;
+ char *bstart = SvPV(CopFILESV(PL_curcop),blen);
+ char *lstart = SvPV(x,llen);
+ if (llen < blen) {
+ bstart += blen - llen;
+ if (strnEQ(bstart, lstart, llen) && bstart[-1] == '/') {
+ sv_setpvn(x, ipath, ipathend - ipath);
+ SvSETMAGIC(x);
+ }
+ }
+ }
TAINT_NOT; /* $^X is always tainted, but that's OK */
}
#endif /* ARG_ZERO_IS_SCRIPT */