summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-21 15:12:18 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-21 15:14:51 +0200
commit49dbfa7b2b0bf3906704dac1eaeb4eba91056a19 (patch)
treeb7bf6ad5bef741f68b45a431807f58a81a5c845a /src/core/load-fragment.c
parenta223b325b409b325f4c2c2e11268596edd842631 (diff)
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.
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c37
1 files changed, 37 insertions, 0 deletions
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) {