OSDN Git Service

* configure.ac: Add m4_pattern_allow(LIBOBJS).
[pf3gnuchains/gcc-fork.git] / libiberty / getpwd.c
index 2fa3416..31c7d20 100644 (file)
@@ -1,5 +1,17 @@
 /* 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"
 #endif
@@ -23,6 +35,9 @@ extern int errno;
 #if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
 
 /* Prototype these in case the system headers don't provide them. */
 extern char *getpwd ();
@@ -34,17 +49,15 @@ extern char *getwd ();
    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__)))