Imported Upstream version 4.4
[platform/upstream/make.git] / lib / concat-filename.h
1 /* Construct a full filename from a directory and a relative filename.
2    Copyright (C) 2001-2004, 2007-2022 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 #include <stdlib.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 /* Concatenate a directory filename, a relative filename and an optional
28    suffix.  Return a freshly allocated filename.  Return NULL and set errno
29    upon memory allocation failure.  */
30 extern char *concatenated_filename (const char *directory,
31                                     const char *filename, const char *suffix)
32   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
33
34 /* Concatenate a directory filename, a relative filename and an optional
35    suffix.  Return a freshly allocated filename.  */
36 extern char *xconcatenated_filename (const char *directory,
37                                      const char *filename, const char *suffix)
38   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
39   _GL_ATTRIBUTE_RETURNS_NONNULL;
40
41
42 #ifdef __cplusplus
43 }
44 #endif
45
46 #endif /* _CONCAT_FILENAME_H */