xconcat-filename.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Construct a full filename from a directory and a relative filename.
  2. Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the
  5. Free Software Foundation; either version 3 of the License, or any
  6. 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, see <http://www.gnu.org/licenses/>. */
  13. /* Written by Bruno Haible <haible@clisp.cons.org>. */
  14. #include <config.h>
  15. /* Specification. */
  16. #include "concat-filename.h"
  17. #include "xalloc.h"
  18. /* Concatenate a directory filename, a relative filename and an optional
  19. suffix. The directory may end with the directory separator. The second
  20. argument may not start with the directory separator (it is relative).
  21. Return a freshly allocated filename. */
  22. char *
  23. xconcatenated_filename (const char *directory, const char *filename,
  24. const char *suffix)
  25. {
  26. char *result;
  27. result = concatenated_filename (directory, filename, suffix);
  28. if (result == NULL)
  29. xalloc_die ();
  30. return result;
  31. }