summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-28 04:08:09 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-28 04:08:09 +0000
commit113b7d9de713e57a510f822be9651ee29df72538 (patch)
tree2dc928b0b86c4a325c0ac408fdcc7751429d9819 /perl.c
parentf83ee824cada302b23f7337a82f3b9d44bde7629 (diff)
parentde0c8cb881313fb53ccecc309c3a182787a8a527 (diff)
downloadperl-113b7d9de713e57a510f822be9651ee29df72538.tar.gz
integrate mainline contents
p4raw-id: //depot/utfperl@4725
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/perl.c b/perl.c
index 9af4a6071a..8b4c59cb78 100644
--- a/perl.c
+++ b/perl.c
@@ -119,9 +119,8 @@ perl_construct(pTHXx)
/* Init the real globals (and main thread)? */
if (!PL_linestr) {
-#ifdef USE_THREADS
-
INIT_THREADS;
+#ifdef USE_THREADS
#ifdef ALLOC_THREAD_KEY
ALLOC_THREAD_KEY;
#else
@@ -856,18 +855,18 @@ S_parse_body(pTHX_ va_list args)
if (!*++s && (s=argv[1]) != Nullch) {
argc--,argv++;
}
- while (s && isSPACE(*s))
- ++s;
if (s && *s) {
- char *e, *p;
- for (e = s; *e && !isSPACE(*e); e++) ;
- p = savepvn(s, e-s);
+ char *p;
+ STRLEN len = strlen(s);
+ p = savepvn(s, len);
incpush(p, TRUE);
- sv_catpv(sv,"-I");
- sv_catpv(sv,p);
- sv_catpv(sv," ");
+ sv_catpvn(sv, "-I", 2);
+ sv_catpvn(sv, p, len);
+ sv_catpvn(sv, " ", 1);
Safefree(p);
- } /* XXX else croak? */
+ }
+ else
+ Perl_croak(aTHX_ "No directory specified for -I");
break;
case 'P':
forbid_setid("-P");
@@ -978,7 +977,8 @@ print \" \\@INC:\\n @INC\\n\";");
#ifndef SECURE_INTERNAL_GETENV
!PL_tainting &&
#endif
- (s = PerlEnv_getenv("PERL5OPT"))) {
+ (s = PerlEnv_getenv("PERL5OPT")))
+ {
while (isSPACE(*s))
s++;
if (*s == '-' && *(s+1) == 'T')
@@ -1762,14 +1762,23 @@ Perl_moreswitches(pTHX_ char *s)
++s;
if (*s) {
char *e, *p;
- for (e = s; *e && !isSPACE(*e); e++) ;
- p = savepvn(s, e-s);
- incpush(p, TRUE);
- Safefree(p);
- s = e;
+ 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);
+ incpush(e, TRUE);
+ Safefree(e);
+ s = p;
+ if (*s == '-')
+ s++;
}
else
- Perl_croak(aTHX_ "No space allowed after -I");
+ Perl_croak(aTHX_ "No directory specified for -I");
return s;
case 'l':
PL_minus_l = TRUE;
@@ -2154,7 +2163,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv, int *fdscript)
Perl_sv_catpvf(aTHX_ cpp, "%s/", BIN_EXP);
sv_catpv(cpp, cpp_cfg);
- sv_catpv(sv,"-I");
+ sv_catpvn(sv, "-I", 2);
sv_catpv(sv,PRIVLIB_EXP);
#ifdef MSDOS