diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-06-24 12:58:35 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-06-24 12:58:35 +0000 |
commit | 09122b95120d497042cb9df9ebb06ebcfca423aa (patch) | |
tree | 7d7dd07a88d94fb0e8311f7c8ec54c276350e179 /ext/Cwd | |
parent | 121d9cecb1c235bcbe2e57c08c68b6c96f24fe54 (diff) | |
download | perl-09122b95120d497042cb9df9ebb06ebcfca423aa.tar.gz |
Upgrade to Cwd 2.17_03
p4raw-id: //depot/perl@22988
Diffstat (limited to 'ext/Cwd')
-rw-r--r-- | ext/Cwd/Changes | 25 | ||||
-rw-r--r-- | ext/Cwd/Cwd.xs | 40 |
2 files changed, 64 insertions, 1 deletions
diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes index ca9684e367..12e14e707d 100644 --- a/ext/Cwd/Changes +++ b/ext/Cwd/Changes @@ -1,5 +1,30 @@ Revision history for Perl extension Cwd. +2.18 (pending, still in beta release) + + - Fixed a problem in which abs_path($arg) on some platforms could + only be called on directories, and died when called on files. This + was a problem in the pure-perl implementation _perl_abs_path(). + + - Fixed fast_abs_path($arg) in the same way as abs_path($arg) above. + + - On Win32, a function getdcwd($vol) has been added, which gets the + current working directory of the specified drive/volume. + [Steve Hay] + + - Fixed a problem on perl 5.6.2 when built with the MULTIPLICITY + compile-time flags. [Yitzchak Scott-Thoennes] + + - When looking for a `pwd` system command, we no longer assume the + path separator is ':'. + + - On platforms where cwd() is implemented internally (like Win32), + don't look for a `pwd` command externally. This can greatly speed + up load time. [Stefan Scherer] + + - The pure-perl version of abs_path() now has the same prototype as + the XS version (;$). + 2.17 Wed Mar 10 07:55:36 CST 2004 - The change in 2.16 created a testing failure when tested from diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 04ab25eaeb..fae3ef97e3 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -212,7 +212,8 @@ err2: #ifndef getcwd_sv /* Taken from perl 5.8's util.c */ -int getcwd_sv(pTHX_ register SV *sv) +#define getcwd_sv(a) Perl_getcwd_sv(aTHX_ a) +int Perl_getcwd_sv(pTHX_ register SV *sv) { #ifndef PERL_MICRO @@ -402,3 +403,40 @@ PPCODE: SvTAINTED_on(TARG); #endif } + +#ifdef WIN32 + +void +getdcwd(...) +PPCODE: +{ + dXSTARG; + int drive; + char *dir; + + /* Drive 0 is the current drive, 1 is A:, 2 is B:, 3 is C: and so on. */ + if ( items == 0 || + (items == 1 && (!SvOK(ST(0)) || (SvPOK(ST(0)) && !SvCUR(ST(0)))))) + drive = 0; + else if (items == 1 && SvPOK(ST(0)) && SvCUR(ST(0)) && + isALPHA(SvPVX(ST(0))[0])) + drive = toUPPER(SvPVX(ST(0))[0]) - 'A' + 1; + else + croak("Usage: getdcwd(DRIVE)"); + + /* Pass a NULL pointer as the second argument to have space allocated. */ + if (dir = _getdcwd(drive, NULL, MAXPATHLEN)) { + sv_setpvn(TARG, dir, strlen(dir)); + free(dir); + SvPOK_only(TARG); + } + else + sv_setsv(TARG, &PL_sv_undef); + + XSprePUSH; PUSHTARG; +#ifndef INCOMPLETE_TAINTS + SvTAINTED_on(TARG); +#endif +} + +#endif |