X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fsystemctl.c;h=627b9055aeb9f71eb020568b83db2b0a04fd0d7d;hp=ea09c3cf36df25bcc6e17ef98a20d575654bcf36;hb=ee0dd8021b3d6203235c8b0cd014431c8fb38d8f;hpb=aabd9b11ba563e1d988b119960c94b139ec5de00 diff --git a/src/systemctl.c b/src/systemctl.c index ea09c3cf3..627b9055a 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -52,6 +52,7 @@ #include "shutdownd.h" #include "exit-status.h" #include "bus-errors.h" +#include "build.h" static const char *arg_type = NULL; static char **arg_property = NULL; @@ -3845,6 +3846,7 @@ static int systemctl_help(void) { printf("%s [OPTIONS...] {COMMAND} ...\n\n" "Send control commands to or query the systemd manager.\n\n" " -h --help Show this help\n" + " --version Show package version\n" " -t --type=TYPE List only units of a particular type\n" " -p --property=NAME Show only properties by this name\n" " -a --all Show all units/properties, including dead/empty ones\n" @@ -3979,6 +3981,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { enum { ARG_FAIL = 0x100, + ARG_VERSION, ARG_SESSION, ARG_SYSTEM, ARG_GLOBAL, @@ -3994,6 +3997,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { static const struct option options[] = { { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, ARG_VERSION }, { "type", required_argument, NULL, 't' }, { "property", required_argument, NULL, 'p' }, { "all", no_argument, NULL, 'a' }, @@ -4026,6 +4030,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) { systemctl_help(); return 0; + case ARG_VERSION: + puts(PACKAGE_STRING); + puts(DISTRIBUTION); + puts(SYSTEMD_FEATURES); + return 0; + case 't': arg_type = optarg; break; @@ -4624,6 +4634,7 @@ finish: dbus_message_unref(reply); if (bus) { + dbus_connection_flush(bus); dbus_connection_close(bus); dbus_connection_unref(bus); } @@ -5039,6 +5050,7 @@ int main(int argc, char*argv[]) { finish: if (bus) { + dbus_connection_flush(bus); dbus_connection_close(bus); dbus_connection_unref(bus); }