summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/getpwd.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
committerobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
commit0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch)
tree68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/getpwd.c
parentd4db5fb866b7ad5216abd5047774a3973b9901a9 (diff)
downloadFreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip
FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/getpwd.c')
-rw-r--r--contrib/gcc/getpwd.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/contrib/gcc/getpwd.c b/contrib/gcc/getpwd.c
index 3692e92..947383e 100644
--- a/contrib/gcc/getpwd.c
+++ b/contrib/gcc/getpwd.c
@@ -1,22 +1,14 @@
/* getpwd.c - get the working directory */
#include "config.h"
-
-#include <errno.h>
-#include <sys/types.h>
+#include "system.h"
#include <sys/stat.h>
-#ifndef errno
-extern int errno;
-#endif
-
/* 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)) || defined (HAVE_GETWD)
-#include <sys/param.h>
-extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#ifdef MAXPATHLEN
#define GUESSPATHLEN (MAXPATHLEN + 1)
@@ -24,18 +16,13 @@ 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 _WIN32
-#include <direct.h>
-#endif
-char *getenv ();
char *xmalloc ();
-#ifndef VMS
+#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN32__)))
/* 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 +70,7 @@ getpwd ()
return p;
}
-#else /* VMS */
+#else /* VMS || _WIN32 && !__CYGWIN32__ */
#ifndef MAXPATHLEN
#define MAXPATHLEN 255
@@ -94,8 +81,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 && !__CYGWIN32__ */
OpenPOWER on IntegriCloud