summaryrefslogtreecommitdiff
path: root/lib/xconcat-filename.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-09-02 01:34:21 +0200
committerBruno Haible <bruno@clisp.org>2008-09-02 01:34:21 +0200
commit27dbed51f810014b4d495bf69ab41c423e2eb15d (patch)
treed484a8d4f8cd0434e4debd38fa3482405e909b0b /lib/xconcat-filename.c
parentbe6c2737cca8fa0f8e41e836e0cb843bc9138035 (diff)
downloadgnulib-27dbed51f810014b4d495bf69ab41c423e2eb15d.tar.gz
New module 'xconcat-filename', split off from module 'concat-filename'.
Diffstat (limited to 'lib/xconcat-filename.c')
-rw-r--r--lib/xconcat-filename.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/xconcat-filename.c b/lib/xconcat-filename.c
new file mode 100644
index 0000000000..2726036a0f
--- /dev/null
+++ b/lib/xconcat-filename.c
@@ -0,0 +1,41 @@
+/* Construct a full filename from a directory and a relative filename.
+ Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <haible@clisp.cons.org>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "concat-filename.h"
+
+#include "xalloc.h"
+
+/* Concatenate a directory filename, a relative filename and an optional
+ suffix. The directory may end with the directory separator. The second
+ argument may not start with the directory separator (it is relative).
+ Return a freshly allocated filename. */
+char *
+xconcatenated_filename (const char *directory, const char *filename,
+ const char *suffix)
+{
+ char *result;
+
+ result = concatenated_filename (directory, filename, suffix);
+ if (result == NULL)
+ xalloc_die ();
+
+ return result;
+}