1 /* maxpath.h - Find out what this system thinks PATH_MAX and NAME_MAX are. */
2 
3 /* Copyright (C) 1993 Free Software Foundation, Inc.
4 
5    This file is part of GNU Bash, the Bourne Again SHell.
6 
7    Bash is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    Bash is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #if !defined (_MAXPATH_H_)
22 #define _MAXPATH_H_
23 
24 /* These values are supposed to be in <limits.h> or one of the files
25    it includes. */
26 #if defined (HAVE_LIMITS_H)
27 #  include <limits.h>
28 #endif /* !HAVE_LIMITS_H */
29 
30 /* If PATH_MAX is not defined, look for MAXPATHLEN */
31 #if !defined (PATH_MAX)
32 #  if defined (HAVE_SYS_PARAM_H)
33 #    include <sys/param.h>
34 #    define maxpath_param_h
35 #  endif
36 #  if defined (MAXPATHLEN) && !defined (PATH_MAX)
37 #    define PATH_MAX MAXPATHLEN
38 #  endif /* MAXPATHLEN && !PATH_MAX */
39 #endif /* !PATH_MAX */
40 
41 /* If NAME_MAX is not defined, look for MAXNAMLEN */
42 #if !defined (NAME_MAX)
43 #  if defined (HAVE_SYS_PARAM_H) && !defined (maxpath_param_h)
44 #    include <sys/param.h>
45 #  endif
46 #  if defined (MAXNAMLEN) && !defined (NAME_MAX)
47 #    define NAME_MAX MAXNAMLEN
48 #  endif /* MAXNAMLEN && !NAME_MAX */
49 #endif /* !NAME_MAX */
50 
51 /* Default POSIX values */
52 #if !defined (PATH_MAX) && defined (_POSIX_PATH_MAX)
53 #  define PATH_MAX _POSIX_PATH_MAX
54 #endif
55 
56 #if !defined (NAME_MAX) && defined (_POSIX_NAME_MAX)
57 #  define NAME_MAX _POSIX_NAME_MAX
58 #endif
59 
60 
61 /* Default values */
62 #if !defined (PATH_MAX)
63 #  define PATH_MAX 1024
64 #endif
65 
66 #if !defined (NAME_MAX)
67 #  define NAME_MAX 14
68 #endif
69 
70 #if PATH_MAX < 1024
71 #  undef PATH_MAX
72 #  define PATH_MAX 1024
73 #endif
74 
75 #endif /* _MAXPATH_H_ */
76