1 /* Construct a full filename from a directory and a relative filename.
2 Copyright (C) 2001-2004, 2007-2023 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17 #ifndef _CONCAT_FILENAME_H
18 #define _CONCAT_FILENAME_H
19
20 /* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL. */
21 #if !_GL_CONFIG_H_INCLUDED
22 #error "Please include config.h first."
23 #endif
24
25 #include <stdlib.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31
32 /* Concatenate a directory filename, a relative filename and an optional
33 suffix. Return a freshly allocated filename. Return NULL and set errno
34 upon memory allocation failure. */
35 extern char *concatenated_filename (const char *directory,
36 const char *filename, const char *suffix)
37 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
38
39 /* Concatenate a directory filename, a relative filename and an optional
40 suffix. Return a freshly allocated filename. */
41 extern char *xconcatenated_filename (const char *directory,
42 const char *filename, const char *suffix)
43 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
44 _GL_ATTRIBUTE_RETURNS_NONNULL;
45
46
47 #ifdef __cplusplus
48 }
49 #endif
50
51 #endif /* _CONCAT_FILENAME_H */