Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 1 | /* maxpath.h - Find out what this system thinks PATH_MAX and NAME_MAX are. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 2 | |
| 3 | /* Copyright (C) 1993 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GNU Bash, the Bourne Again SHell. |
| 6 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 11 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 16 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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 | */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 20 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 21 | #if !defined (_MAXPATH_H_) |
| 22 | #define _MAXPATH_H_ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 23 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 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 */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 29 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 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 */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 40 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 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 */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 50 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 51 | /* Default POSIX values */ |
| 52 | #if !defined (PATH_MAX) && defined (_POSIX_PATH_MAX) |
| 53 | # define PATH_MAX _POSIX_PATH_MAX |
| 54 | #endif |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 55 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 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_ */ |