]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/getpwd.c
clean up both u77-test.f versions
[gcc.git] / gcc / getpwd.c
index f2317a4da3adfcec7f94853a61749b3ce4d802b3..c3d155e574145274281f1e8492a2b96e5a8796c7 100644 (file)
@@ -1,22 +1,13 @@
 /* getpwd.c - get the working directory */
 
 #include "config.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef errno
-extern int errno;
-#endif
+#include "system.h"
 
 /* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
    BSD systems) now provides getcwd as called for by POSIX.  Allow for
    the few exceptions to the general rule here.  */
 
-#if !(defined (POSIX) || defined (USG) || defined (VMS))
-#include <sys/param.h>
-extern char *getwd ();
+#if !(defined (POSIX) || defined (USG) || defined (VMS)) || defined (HAVE_GETWD)
 #define getcwd(buf,len) getwd(buf)
 #ifdef MAXPATHLEN
 #define GUESSPATHLEN (MAXPATHLEN + 1)
@@ -24,18 +15,11 @@ extern char *getwd ();
 #define GUESSPATHLEN 100
 #endif
 #else /* (defined (USG) || defined (VMS)) */
-extern char *getcwd ();
 /* We actually use this as a starting point, not a limit.  */
 #define GUESSPATHLEN 100
 #endif /* (defined (USG) || defined (VMS)) */
-#ifdef WINNT
-#include <direct.h>
-#endif
-
-char *getenv ();
-char *xmalloc ();
 
-#ifndef VMS
+#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
 
 /* Get the working directory.  Use the PWD environment variable if it's
    set correctly, since this is faster and gives more uniform answers
@@ -83,7 +67,7 @@ getpwd ()
   return p;
 }
 
-#else  /* VMS */
+#else  /* VMS || _WIN32 && !__CYGWIN__ */
 
 #ifndef MAXPATHLEN
 #define MAXPATHLEN 255
@@ -94,8 +78,13 @@ getpwd ()
 {
   static char *pwd = 0;
 
-  if (!pwd) pwd = getcwd (xmalloc (MAXPATHLEN+1), MAXPATHLEN+1);
+  if (!pwd)
+    pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
+#ifdef VMS
+                 , 0
+#endif
+                 );
   return pwd;
 }
 
-#endif /* VMS */
+#endif /* VMS || _WIN32 && !__CYGWIN__ */
This page took 0.028722 seconds and 5 git commands to generate.