summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2002-08-05 22:26:45 +0000
committerhv <hv@crypt.org>2002-08-05 22:26:45 +0000
commite55ac0fa2de97f387f14e72ecb12931a1e26d2c6 (patch)
tree0efd18e0c0d4681b170489bfc603dcf9bc4afb8d /perl.c
parentc963b151157dab5813a32fc6004b63916ad155e8 (diff)
downloadperl-e55ac0fa2de97f387f14e72ecb12931a1e26d2c6.tar.gz
Integrate from maint-5.6/macperl via macperl
Changes 17660, 17661, 17662, 17663, 17664 p4raw-id: //depot/perl@17683 p4raw-integrated: from //depot/macperl@17682 'copy in' perl.c (@17528..)
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index f7131d0682..3647708cbf 100644
--- a/perl.c
+++ b/perl.c
@@ -1158,7 +1158,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
#ifdef MACOS_TRADITIONAL
/* ignore -e for Dev:Pseudo argument */
if (argv[1] && !strcmp(argv[1], "Dev:Pseudo"))
- break;
+ break;
#endif
if (PL_euid != PL_uid || PL_egid != PL_gid)
Perl_croak(aTHX_ "No -e allowed in setuid scripts");
@@ -3274,6 +3274,9 @@ STATIC void
S_find_beginning(pTHX)
{
register char *s, *s2;
+#ifdef MACOS_TRADITIONAL
+ int maclines = 0;
+#endif
/* skip forward in input to the real script? */
@@ -3285,16 +3288,16 @@ S_find_beginning(pTHX)
if ((s = sv_gets(PL_linestr, PL_rsfp, 0)) == Nullch) {
if (!gMacPerl_AlwaysExtract)
Perl_croak(aTHX_ "No Perl script found in input\n");
-
+
if (PL_doextract) /* require explicit override ? */
if (!OverrideExtract(PL_origfilename))
Perl_croak(aTHX_ "User aborted script\n");
else
PL_doextract = FALSE;
-
+
/* Pater peccavi, file does not have #! */
PerlIO_rewind(PL_rsfp);
-
+
break;
}
#else
@@ -3317,7 +3320,18 @@ S_find_beginning(pTHX)
;
}
#ifdef MACOS_TRADITIONAL
+ /* We are always searching for the #!perl line in MacPerl,
+ * so if we find it, still keep the line count correct
+ * by counting lines we already skipped over
+ */
+ for (; maclines > 0 ; maclines--)
+ PerlIO_ungetc(PL_rsfp, '\n');
+
break;
+
+ /* gMacPerl_AlwaysExtract is false in MPW tool */
+ } else if (gMacPerl_AlwaysExtract) {
+ ++maclines;
#endif
}
}