summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-26 12:58:09 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-07-26 12:58:09 +0000
commitab767dcf7cf79a3411a5199b97b42e97ef80dbfc (patch)
treebdcf89550e770ac4e3a1fae4f1e3a1cad8e8a0a8 /common
parentf616523e5cdc65726d36dad404ed2f66a2fc8fd8 (diff)
Add create_name() helper function
Diffstat (limited to 'common')
-rw-r--r--common/textfile.c5
-rw-r--r--common/textfile.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/common/textfile.c b/common/textfile.c
index cdb42d13..076ec35b 100644
--- a/common/textfile.c
+++ b/common/textfile.c
@@ -88,6 +88,11 @@ int create_file(const char *filename, const mode_t mode)
return 0;
}
+int create_name(char *buf, size_t size, char *address, char *name)
+{
+ return snprintf(buf, size, "%s/%s/%s", STORAGEDIR, address, name);
+}
+
static inline char *find_key(char *map, const char *key, size_t len)
{
char *off = strstr(map, key);
diff --git a/common/textfile.h b/common/textfile.h
index b9c01ad3..21aa023d 100644
--- a/common/textfile.h
+++ b/common/textfile.h
@@ -26,6 +26,7 @@
int create_dirs(const char *filename, const mode_t mode);
int create_file(const char *filename, const mode_t mode);
+int create_name(char *buf, size_t size, char *address, char *name);
int textfile_put(const char *pathname, const char *key, const char *value);
int textfile_del(const char *pathname, const char *key);