summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/getpwd.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
committerobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
commitc8f5fc7032940ad6633f932ac40cade82ec4d0cc (patch)
tree29a0f0a6c79a69ecc64f612947a0fe5904311713 /contrib/gcc/getpwd.c
parentc9ab9ae440a8066b2c2b85b157b1fdadcf09916a (diff)
downloadFreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.zip
FreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.tar.gz
Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/gcc/getpwd.c')
-rw-r--r--contrib/gcc/getpwd.c49
1 files changed, 43 insertions, 6 deletions
diff --git a/contrib/gcc/getpwd.c b/contrib/gcc/getpwd.c
index c3d155e..f508b1e 100644
--- a/contrib/gcc/getpwd.c
+++ b/contrib/gcc/getpwd.c
@@ -1,23 +1,60 @@
/* getpwd.c - get the working directory */
+/*
+
+@deftypefn Supplemental char* getpwd (void)
+
+Returns the current working directory. This implementation caches the
+result on the assumption that the process will not call @code{chdir}
+between calls to @code{getpwd}.
+
+@end deftypefn
+
+*/
+
+#ifdef HAVE_CONFIG_H
#include "config.h"
-#include "system.h"
+#endif
+
+#include <sys/types.h>
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+/* Prototype these in case the system headers don't provide them. */
+extern char *getpwd ();
+extern char *getwd ();
+
+#include "libiberty.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)) || defined (HAVE_GETWD)
+#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
#define getcwd(buf,len) getwd(buf)
+#endif
+
#ifdef MAXPATHLEN
#define GUESSPATHLEN (MAXPATHLEN + 1)
#else
#define GUESSPATHLEN 100
#endif
-#else /* (defined (USG) || defined (VMS)) */
-/* We actually use this as a starting point, not a limit. */
-#define GUESSPATHLEN 100
-#endif /* (defined (USG) || defined (VMS)) */
#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
OpenPOWER on IntegriCloud