Add create_name() helper function

This commit is contained in:
Marcel Holtmann 2006-07-26 12:58:09 +00:00
parent f616523e5c
commit ab767dcf7c
2 changed files with 6 additions and 0 deletions

View File

@ -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);

View File

@ -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);