pathmax.h 1.5 KB

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