From 49dbfa7b2b0bf3906704dac1eaeb4eba91056a19 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 21 May 2012 15:12:18 +0200 Subject: units: introduce new Documentation= field and make use of it everywhere This should help making the boot process a bit easier to explore and understand for the administrator. The simple idea is that "systemctl status" now shows a link to documentation alongside the other status and decriptionary information of a service. This patch adds the necessary fields to all our shipped units if we have proper documentation for them. --- src/core/load-fragment.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/core/load-fragment.c') diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index c2efec6657..3bc053341c 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2063,6 +2063,43 @@ int config_parse_unit_requires_mounts_for( return r; } +int config_parse_documentation( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + Unit *u = userdata; + int r; + char **a, **b; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(u); + + r = config_parse_unit_strv_printf(filename, line, section, lvalue, ltype, rvalue, data, userdata); + if (r < 0) + return r; + + for (a = b = u->documentation; a && *a; a++) { + + if (is_valid_documentation_url(*a)) + *(b++) = *a; + else { + log_error("[%s:%u] Invalid URL, ignoring: %s", filename, line, *a); + free(*a); + } + } + *b = NULL; + + return r; +} + #define FOLLOW_MAX 8 static int open_follow(char **filename, FILE **_f, Set *names, char **_final) { -- cgit v1.2.3-54-g00ecf