coreutils/lib/pathmax.h

50 lines
1.5 KiB
C
Raw Normal View History

1994-04-29 02:39:34 +08:00
/* Define PATH_MAX somehow. Requires sys/types.h.
Copyright (C) 1992, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
1994-04-29 02:39:34 +08:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
1996-07-15 08:02:50 +08:00
along with this program; if not, write to the Free Software Foundation,
2005-05-14 15:58:06 +08:00
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
1994-04-29 02:39:34 +08:00
#ifndef _PATHMAX_H
1999-07-11 00:40:16 +08:00
# define _PATHMAX_H
1994-04-29 02:39:34 +08:00
2001-08-13 02:49:13 +08:00
# if HAVE_UNISTD_H
1999-07-11 00:40:16 +08:00
# include <unistd.h>
# endif
1994-04-29 02:39:34 +08:00
# include <limits.h>
1994-04-29 02:39:34 +08:00
1999-07-11 00:40:16 +08:00
# ifndef _POSIX_PATH_MAX
# define _POSIX_PATH_MAX 256
1999-07-11 00:40:16 +08:00
# endif
1994-04-29 02:39:34 +08:00
2001-08-13 02:49:13 +08:00
# if !defined PATH_MAX && defined _PC_PATH_MAX
1999-07-11 00:40:16 +08:00
# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
: pathconf ("/", _PC_PATH_MAX))
# endif
1994-04-29 02:39:34 +08:00
/* Don't include sys/param.h if it already has been. */
2001-08-13 02:49:13 +08:00
# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
1999-07-11 00:40:16 +08:00
# include <sys/param.h>
# endif
1994-04-29 02:39:34 +08:00
2001-08-13 02:49:13 +08:00
# if !defined PATH_MAX && defined MAXPATHLEN
1999-07-11 00:40:16 +08:00
# define PATH_MAX MAXPATHLEN
# endif
1994-04-29 02:39:34 +08:00
1999-07-11 00:40:16 +08:00
# ifndef PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
# endif
1994-04-29 02:39:34 +08:00
#endif /* _PATHMAX_H */