summaryrefslogtreecommitdiff
path: root/maxpath.h
diff options
context:
space:
mode:
Diffstat (limited to 'maxpath.h')
-rw-r--r--maxpath.h70
1 files changed, 51 insertions, 19 deletions
diff --git a/maxpath.h b/maxpath.h
index 6677309f..be0db2f8 100644
--- a/maxpath.h
+++ b/maxpath.h
@@ -1,4 +1,4 @@
-/* maxpath.h - Find out what this system thinks MAXPATHLEN is. */
+/* maxpath.h - Find out what this system thinks PATH_MAX and NAME_MAX are. */
/* Copyright (C) 1993 Free Software Foundation, Inc.
@@ -18,26 +18,58 @@
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#if !defined (_MAXPATH_H)
-#define _MAXPATH_H
+#if !defined (_MAXPATH_H_)
+#define _MAXPATH_H_
-#if !defined (MAXPATHLEN) && defined (HAVE_LIMITS_H)
-# if !defined (BUILDING_MAKEFILE)
-# include <limits.h>
-# endif /* BUILDING_MAKEFILE */
-#endif /* !MAXPATHLEN && HAVE_LIMITS_H */
+/* These values are supposed to be in <limits.h> or one of the files
+ it includes. */
+#if defined (HAVE_LIMITS_H)
+# include <limits.h>
+#endif /* !HAVE_LIMITS_H */
-#if !defined (MAXPATHLEN) && defined (HAVE_SYS_PARAM)
-# include <sys/param.h>
-#endif /* !MAXPATHLEN && HAVE_SYS_PARAM */
+/* If PATH_MAX is not defined, look for MAXPATHLEN */
+#if !defined (PATH_MAX)
+# if defined (HAVE_SYS_PARAM_H)
+# include <sys/param.h>
+# define maxpath_param_h
+# endif
+# if defined (MAXPATHLEN) && !defined (PATH_MAX)
+# define PATH_MAX MAXPATHLEN
+# endif /* MAXPATHLEN && !PATH_MAX */
+#endif /* !PATH_MAX */
-#if !defined (MAXPATHLEN) && defined (PATH_MAX)
-# define MAXPATHLEN PATH_MAX
-#endif /* !MAXPATHLEN && PATH_MAX */
+/* If NAME_MAX is not defined, look for MAXNAMLEN */
+#if !defined (NAME_MAX)
+# if defined (HAVE_SYS_PARAM_H) && !defined (maxpath_param_h)
+# include <sys/param.h>
+# endif
+# if defined (MAXNAMLEN) && !defined (NAME_MAX)
+# define NAME_MAX MAXNAMLEN
+# endif /* MAXNAMLEN && !NAME_MAX */
+#endif /* !NAME_MAX */
-/* Yecch! Who cares about this gross concept in the first place? */
-#if !defined (MAXPATHLEN)
-# define MAXPATHLEN 1024
-#endif /* MAXPATHLEN */
+/* Default POSIX values */
+#if !defined (PATH_MAX) && defined (_POSIX_PATH_MAX)
+# define PATH_MAX _POSIX_PATH_MAX
+#endif
-#endif /* _MAXPATH_H */
+#if !defined (NAME_MAX) && defined (_POSIX_NAME_MAX)
+# define NAME_MAX _POSIX_NAME_MAX
+#endif
+
+
+/* Default values */
+#if !defined (PATH_MAX)
+# define PATH_MAX 1024
+#endif
+
+#if !defined (NAME_MAX)
+# define NAME_MAX 14
+#endif
+
+#if PATH_MAX < 1024
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+
+#endif /* _MAXPATH_H_ */