dirname.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Take file names apart into directory and base names.
  2. Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation,
  3. 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 3 of the License, or
  7. (at your option) 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, see <http://www.gnu.org/licenses/>. */
  14. #ifndef DIRNAME_H_
  15. # define DIRNAME_H_ 1
  16. # include <stdbool.h>
  17. # include <stddef.h>
  18. # include "dosname.h"
  19. # ifndef DIRECTORY_SEPARATOR
  20. # define DIRECTORY_SEPARATOR '/'
  21. # endif
  22. # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
  23. # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
  24. # endif
  25. # if GNULIB_DIRNAME
  26. char *base_name (char const *file);
  27. char *dir_name (char const *file);
  28. # endif
  29. char *mdir_name (char const *file);
  30. size_t base_len (char const *file) _GL_ATTRIBUTE_PURE;
  31. size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
  32. char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
  33. bool strip_trailing_slashes (char *file);
  34. #endif /* not DIRNAME_H_ */