summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/getcwd.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-06-23 14:39:32 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-06-23 14:39:32 +0000
commitdf00b2c58d350db5e64e1becd76816c626268289 (patch)
tree90c8496245233960f94bcf7e5b3287b800bdf9c8 /otherlibs/unix/getcwd.c
parent840152fd2d0a26db041dc5e645f20eb67b157ae1 (diff)
Remplacer MAXPATHLEN par PATH_MAX
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1993 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/getcwd.c')
-rw-r--r--otherlibs/unix/getcwd.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/otherlibs/unix/getcwd.c b/otherlibs/unix/getcwd.c
index 1c7b19f73..f57d68799 100644
--- a/otherlibs/unix/getcwd.c
+++ b/otherlibs/unix/getcwd.c
@@ -15,17 +15,23 @@
#include <alloc.h>
#include "unixsupport.h"
-#ifdef HAS_GETCWD
-
#ifndef _WIN32
#include <sys/param.h>
+#endif
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAN MAXPATHLEN
#else
-#define MAXPATHLEN 512
+#define PATH_MAX 512
+#endif
#endif
+#ifdef HAS_GETCWD
+
value unix_getcwd(value unit) /* ML */
{
- char buff[MAXPATHLEN];
+ char buff[PATH_MAX];
if (getcwd(buff, sizeof(buff)) == 0) uerror("getcwd", Nothing);
return copy_string(buff);
}
@@ -33,11 +39,9 @@ value unix_getcwd(value unit) /* ML */
#else
#ifdef HAS_GETWD
-#include <sys/param.h>
-
value unix_getcwd(value unit)
{
- char buff[MAXPATHLEN];
+ char buff[PATH_MAX];
if (getwd(buff) == 0) uerror("getcwd", copy_string(buff));
return copy_string(buff);
}