diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-27 00:15:56 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-27 00:15:56 +0100 |
commit | 0301abf48ed3be921c33d409c73b554435cf6378 (patch) | |
tree | a519dad97ab1eb945be1999c2892aa2fe25509c3 /util.c | |
parent | 87f0e418cf2c58b3201d06a60e3696ec672d2662 (diff) |
implement drop-in directories
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -443,3 +443,28 @@ char *file_name_from_path(const char *p) { return (char*) p; } + +bool path_is_absolute(const char *p) { + assert(p); + + return p[0] == '/'; +} + +bool is_path(const char *p) { + + return !!strchr(p, '/'); +} + +char *path_make_absolute(const char *p, const char *prefix) { + char *r; + + assert(p); + + if (path_is_absolute(p) || !prefix) + return strdup(p); + + if (asprintf(&r, "%s/%s", prefix, p) < 0) + return NULL; + + return r; +} |