Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / maxpath.h
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 it under
8    the terms of the GNU General Public License as published by the Free
9    Software Foundation; either version 2, or (at your option) any later
10    version.
11
12    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
13    WARRANTY; without even the implied warranty of MERCHANTABILITY or
14    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15    for more details.
16
17    You should have received a copy of the GNU General Public License along
18    with Bash; see the file COPYING.  If not, write to the Free Software
19    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
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_ */