summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/main.c b/src/core/main.c
index ae3769be52..f1f8b21ae0 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -66,6 +66,7 @@
static enum {
ACTION_RUN,
ACTION_HELP,
+ ACTION_VERSION,
ACTION_TEST,
ACTION_DUMP_CONFIGURATION_ITEMS,
ACTION_DONE
@@ -750,6 +751,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_SYSTEM,
ARG_USER,
ARG_TEST,
+ ARG_VERSION,
ARG_DUMP_CONFIGURATION_ITEMS,
ARG_DUMP_CORE,
ARG_CRASH_SHELL,
@@ -772,6 +774,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "user", no_argument, NULL, ARG_USER },
{ "test", no_argument, NULL, ARG_TEST },
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
{ "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS },
{ "dump-core", optional_argument, NULL, ARG_DUMP_CORE },
{ "crash-shell", optional_argument, NULL, ARG_CRASH_SHELL },
@@ -877,6 +880,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_action = ACTION_TEST;
break;
+ case ARG_VERSION:
+ arg_action = ACTION_VERSION;
+ break;
+
case ARG_DUMP_CONFIGURATION_ITEMS:
arg_action = ACTION_DUMP_CONFIGURATION_ITEMS;
break;
@@ -1043,6 +1050,14 @@ static int help(void) {
return 0;
}
+static int version(void) {
+ puts(PACKAGE_STRING);
+ puts(DISTRIBUTION);
+ puts(SYSTEMD_FEATURES);
+
+ return 0;
+}
+
static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
FILE *f = NULL;
FDSet *fds = NULL;
@@ -1328,6 +1343,9 @@ int main(int argc, char *argv[]) {
if (arg_action == ACTION_HELP) {
retval = help();
goto finish;
+ } else if (arg_action == ACTION_VERSION) {
+ retval = version();
+ goto finish;
} else if (arg_action == ACTION_DUMP_CONFIGURATION_ITEMS) {
unit_dump_config_items(stdout);
retval = EXIT_SUCCESS;