diff options
Diffstat (limited to 'src/shared/specifier.c')
-rw-r--r-- | src/shared/specifier.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/shared/specifier.c b/src/shared/specifier.c index 599027cd47..7577c91052 100644 --- a/src/shared/specifier.c +++ b/src/shared/specifier.c @@ -109,3 +109,39 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata char* specifier_string(char specifier, void *data, void *userdata) { return strdup(strempty(data)); } + +char *specifier_machine_id(char specifier, void *data, void *userdata) { + sd_id128_t id; + char *buf; + int r; + + r = sd_id128_get_machine(&id); + if (r < 0) + return NULL; + + buf = new(char, 33); + if (!buf) + return NULL; + + return sd_id128_to_string(id, buf); +} + +char *specifier_boot_id(char specifier, void *data, void *userdata) { + sd_id128_t id; + char *buf; + int r; + + r = sd_id128_get_boot(&id); + if (r < 0) + return NULL; + + buf = new(char, 33); + if (!buf) + return NULL; + + return sd_id128_to_string(id, buf); +} + +char *specifier_host_name(char specifier, void *data, void *userdata) { + return gethostname_malloc(); +} |