concat-filename.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Construct a full filename from a directory and a relative filename.
  2. Copyright (C) 2001-2004, 2007-2023 Free Software Foundation, Inc.
  3. This file is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This file 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. #ifndef _CONCAT_FILENAME_H
  14. #define _CONCAT_FILENAME_H
  15. #include <stdlib.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /* Concatenate a directory filename, a relative filename and an optional
  20. suffix. Return a freshly allocated filename. Return NULL and set errno
  21. upon memory allocation failure. */
  22. extern char *concatenated_filename (const char *directory,
  23. const char *filename, const char *suffix)
  24. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
  25. /* Concatenate a directory filename, a relative filename and an optional
  26. suffix. Return a freshly allocated filename. */
  27. extern char *xconcatenated_filename (const char *directory,
  28. const char *filename, const char *suffix)
  29. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
  30. _GL_ATTRIBUTE_RETURNS_NONNULL;
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif /* _CONCAT_FILENAME_H */