4 /* Copyright (C) 2005 Free Software Foundation, Inc.
5 Written by Werner Lemberg (wl@gnu.org)
7 This file is part of groff.
9 groff is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
14 groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License along
20 with groff; see the file COPYING. If not, write to the Free Software
21 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
23 /* path_name_max(dir) does the same as pathconf(dir, _PC_PATH_MAX) */
27 #include <sys/types.h>
31 #endif /* HAVE_UNISTD_H */
35 size_t path_name_max()
37 return pathconf("/", _PC_PATH_MAX
) < 1 ? 1024 : pathconf("/",_PC_PATH_MAX
);
40 #else /* not _POSIX_VERSION */
46 #else /* not HAVE_DIRENT_H */
47 # ifdef HAVE_SYS_DIR_H
49 # endif /* HAVE_SYS_DIR_H */
50 #endif /* not HAVE_DIRENT_H */
54 # define PATH_MAX MAXPATHLEN
55 # else /* !MAXPATHLEN */
57 # define PATH_MAX MAX_PATH
58 # else /* !MAX_PATH */
60 # define PATH_MAX _MAX_PATH
61 # else /* !_MAX_PATH */
63 # endif /* !_MAX_PATH */
64 # endif /* !MAX_PATH */
65 # endif /* !MAXPATHLEN */
66 #endif /* !PATH_MAX */
68 size_t path_name_max()
73 #endif /* not _POSIX_VERSION */