Upgrade to PathTools 3.25
[p5sagit/p5-mst-13.2.git] / ext / Cwd / Cwd.xs
index 00ebcc7..7434dfa 100644 (file)
@@ -1,8 +1,10 @@
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
-#define NEED_sv_2pv_nolen
-#include "ppport.h"
+#ifndef NO_PPPORT_H
+#   define NEED_sv_2pv_nolen
+#   include "ppport.h"
+#endif
 
 #ifdef I_UNISTD
 #   include <unistd.h>
@@ -70,9 +72,7 @@ static char *rcsid = "$OpenBSD: realpath.c,v 1.4 1998/05/18 09:55:19 deraadt Exp
  */
 static
 char *
-bsd_realpath(path, resolved)
-       const char *path;
-       char *resolved;
+bsd_realpath(const char *path, char *resolved)
 {
 #ifdef VMS
        dTHX;
@@ -270,7 +270,7 @@ int Perl_getcwd_sv(pTHX_ register SV *sv)
     }
 
 #else
-
+  {
     Stat_t statbuf;
     int orig_cdev, orig_cino, cdev, cino, odev, oino, tdev, tino;
     int namelen, pathlen=0;
@@ -382,6 +382,7 @@ int Perl_getcwd_sv(pTHX_ register SV *sv)
     }
 
     return TRUE;
+  }
 #endif
 
 #else
@@ -410,6 +411,19 @@ PPCODE:
 }
 
 void
+getcwd(...)
+PROTOTYPE: DISABLE
+PPCODE:
+{
+    dXSTARG;
+    getcwd_sv(TARG);
+    XSprePUSH; PUSHTARG;
+#ifndef INCOMPLETE_TAINTS
+    SvTAINTED_on(TARG);
+#endif
+}
+
+void
 abs_path(pathsv=Nullsv)
     SV *pathsv
 PROTOTYPE: DISABLE
@@ -419,7 +433,7 @@ PPCODE:
     char *path;
     char buf[MAXPATHLEN];
 
-    path = pathsv ? SvPV_nolen(pathsv) : ".";
+    path = pathsv ? SvPV_nolen(pathsv) : (char *)".";
 
     if (bsd_realpath(path, buf)) {
         sv_setpvn(TARG, buf, strlen(buf));
@@ -435,7 +449,7 @@ PPCODE:
 #endif
 }
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(UNDER_CE)
 
 void
 getdcwd(...)