X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fsystemctl%2Fsystemctl.c;h=b4253a45b183e4f5027eca9c83b10623ac911d1a;hp=92c79d038f5b94d3ceb7442315b27783800b870e;hb=386da8589b4206b7fc5f5729908473edacbee013;hpb=a223b325b409b325f4c2c2e11268596edd842631 diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 92c79d038..b4253a45b 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2158,6 +2158,8 @@ typedef struct UnitStatusInfo { const char *description; const char *following; + char **documentation; + const char *path; const char *default_control_group; @@ -2303,6 +2305,19 @@ static void print_status_info(UnitStatusInfo *i) { if (i->what) printf("\t What: %s\n", i->what); + if (!strv_isempty(i->documentation)) { + char **t; + bool first = true; + + STRV_FOREACH(t, i->documentation) { + if (first) { + printf("\t Docs: %s\n", *t); + first = false; + } else + printf("\t %s\n", *t); + } + } + if (i->accept) printf("\tAccepted: %u; Connected: %u\n", i->n_accepted, i->n_connections); @@ -2607,6 +2622,27 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn LIST_PREPEND(ExecStatusInfo, exec, i->exec, info); + dbus_message_iter_next(&sub); + } + } else if (dbus_message_iter_get_element_type(iter) == DBUS_TYPE_STRING && + streq(name, "Documentation")) { + + DBusMessageIter sub; + + dbus_message_iter_recurse(iter, &sub); + while (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { + const char *s; + char **l; + + dbus_message_iter_get_basic(&sub, &s); + + l = strv_append(i->documentation, s); + if (!l) + return -ENOMEM; + + strv_free(i->documentation); + i->documentation = l; + dbus_message_iter_next(&sub); } } @@ -2932,6 +2968,8 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo if (!show_properties) print_status_info(&info); + strv_free(info.documentation); + if (!streq_ptr(info.active_state, "active") && !streq_ptr(info.active_state, "reloading") && streq(verb, "status")) @@ -4266,7 +4304,7 @@ static int shutdown_help(void) { " -H --halt Halt the machine\n" " -P --poweroff Power-off the machine\n" " -r --reboot Reboot the machine\n" - " -h Equivalent to --poweroff, overriden by --halt\n" + " -h Equivalent to --poweroff, overridden by --halt\n" " -k Don't halt/power-off/reboot, just send warnings\n" " --no-wall Don't send wall message before halt/power-off/reboot\n" " -c Cancel a pending shutdown\n",