pathmax.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Define PATH_MAX somehow. Requires sys/types.h.
  2. Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software
  3. Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #ifndef _PATHMAX_H
  16. # define _PATHMAX_H
  17. # include <unistd.h>
  18. # include <limits.h>
  19. # ifndef _POSIX_PATH_MAX
  20. # define _POSIX_PATH_MAX 256
  21. # endif
  22. # if !defined PATH_MAX && defined _PC_PATH_MAX && defined HAVE_PATHCONF
  23. # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
  24. : pathconf ("/", _PC_PATH_MAX))
  25. # endif
  26. /* Don't include sys/param.h if it already has been. */
  27. # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
  28. # include <sys/param.h>
  29. # endif
  30. # if !defined PATH_MAX && defined MAXPATHLEN
  31. # define PATH_MAX MAXPATHLEN
  32. # endif
  33. # ifndef PATH_MAX
  34. # define PATH_MAX _POSIX_PATH_MAX
  35. # endif
  36. #endif /* _PATHMAX_H */