summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2001-09-22 20:07:12 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-25 17:05:19 +0000
commit35ae6b54cb5a8d6a9ce74c7f818c7d62df4ac621 (patch)
treefa5a208bd09f6ab902095a80f0db07f745b8fc8e /pp_sys.c
parent037dbc56b912d3669ebd9c450f65ad1f94de2ee1 (diff)
downloadperl-35ae6b54cb5a8d6a9ce74c7f818c7d62df4ac621.tar.gz
Deprecating chdir(undef)/chdir('')
Message-ID: <20010923000712.A7005@blackrider> p4raw-id: //depot/perl@12203
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 40273ce315..0abf357d8b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3375,23 +3375,28 @@ PP(pp_chdir)
SV **svp;
STRLEN n_a;
- if (MAXARG < 1) {
- if (((svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE))
- || (svp = hv_fetch(GvHVn(PL_envgv), "LOGDIR", 6, FALSE))
+ if( MAXARG == 1 )
+ tmps = POPpx;
+ else
+ tmps = 0;
+
+ if( !tmps || !*tmps ) {
+ if ( (svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE))
+ || (svp = hv_fetch(GvHVn(PL_envgv), "LOGDIR", 6, FALSE))
#ifdef VMS
- || (svp = hv_fetch(GvHVn(PL_envgv), "SYS$LOGIN", 9, FALSE))
+ || (svp = hv_fetch(GvHVn(PL_envgv), "SYS$LOGIN", 9, FALSE))
#endif
- ) && SvPOK(*svp))
- {
- tmps = SvPV(*svp, n_a);
- }
- else {
+ )
+ {
+ if( MAXARG == 1 )
+ deprecate("chdir('') or chdir(undef) as chdir()");
+ tmps = SvPV(*svp, n_a);
+ }
+ else {
PUSHi(0);
RETURN;
}
}
- else
- tmps = POPpx;
TAINT_PROPER("chdir");
PUSHi( PerlDir_chdir(tmps) >= 0 );