summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-12 07:38:16 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-12 07:38:16 +0000
commit74288ac80044d4682050dc85f8309429977cc884 (patch)
tree5debc814cf6c36734f29872af73d9058ff9e5e61
parent35cd451c5a1303394968903750cc3b3a1a6bc892 (diff)
downloadperl-74288ac80044d4682050dc85f8309429977cc884.tar.gz
PERL5OPT=-T enables taint mode (suggested by Jason Riedy <ejr@cise.ufl.edu>)
p4raw-id: //depot/perl@2880
-rw-r--r--perl.c30
-rw-r--r--pod/perlrun.pod3
2 files changed, 20 insertions, 13 deletions
diff --git a/perl.c b/perl.c
index c91c960632..9d47e22467 100644
--- a/perl.c
+++ b/perl.c
@@ -891,19 +891,25 @@ print \" \\@INC:\\n @INC\\n\";");
switch_end:
if (!PL_tainting && (s = PerlEnv_getenv("PERL5OPT"))) {
- while (s && *s) {
- while (isSPACE(*s))
- s++;
- if (*s == '-') {
- s++;
- if (isSPACE(*s))
- continue;
+ while (isSPACE(*s))
+ s++;
+ if (*s == '-' && *(s+1) == 'T')
+ PL_tainting = TRUE;
+ else {
+ while (s && *s) {
+ while (isSPACE(*s))
+ s++;
+ if (*s == '-') {
+ s++;
+ if (isSPACE(*s))
+ continue;
+ }
+ if (!*s)
+ break;
+ if (!strchr("DIMUdmw", *s))
+ croak("Illegal switch in PERL5OPT: -%c", *s);
+ s = moreswitches(s);
}
- if (!*s)
- break;
- if (!strchr("DIMUdmw", *s))
- croak("Illegal switch in PERL5OPT: -%c", *s);
- s = moreswitches(s);
}
}
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index 6ea5a1dbfb..8a572570cb 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -686,7 +686,8 @@ Command-line options (switches). Switches in this variable are taken
as if they were on every Perl command line. Only the B<-[DIMUdmw]>
switches are allowed. When running taint checks (because the script
was running setuid or setgid, or the B<-T> switch was used), this
-variable is ignored.
+variable is ignored. If PERL5OPT begins with B<-T>, tainting will be
+enabled, and any subsequent options ignored.
=item PERLLIB