[systemd-commits] 2 commits - man/systemd.xml src/core src/udev

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 17 07:35:19 PDT 2012


 man/systemd.xml          |    6 ++++++
 src/core/main.c          |   18 ++++++++++++++++++
 src/udev/keymap/keymap.c |    9 +++++++++
 3 files changed, 33 insertions(+)

New commits:
commit d8f173fd2ee9ee60affa1a4d1a89f2501977fb0b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Jul 17 07:31:48 2012 +0200

    keymap: add --version option

diff --git a/src/udev/keymap/keymap.c b/src/udev/keymap/keymap.c
index 051aa42..5cbce86 100644
--- a/src/udev/keymap/keymap.c
+++ b/src/udev/keymap/keymap.c
@@ -362,8 +362,13 @@ static void help(int error)
 
 int main(int argc, char **argv)
 {
+        enum {
+                ARG_VERSION = 0x100,
+        };
+
         static const struct option options[] = {
                 { "help", no_argument, NULL, 'h' },
+                { "version", no_argument, NULL, ARG_VERSION },
                 { "interactive", no_argument, NULL, 'i' },
                 {}
         };
@@ -382,6 +387,10 @@ int main(int argc, char **argv)
                 case 'h':
                         help(0);
 
+                case ARG_VERSION:
+                        puts(PACKAGE_STRING);
+                        exit(0);
+
                 case 'i':
                         opt_interactive = 1;
                         break;

commit 9ba0bc4e0f3cc606635547c6215f5af8982851df
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Jul 17 07:31:47 2012 +0200

    systemd: add --version option
    
    systemd --version mirrors systemctl --version:
    
    $ ./systemd --version
    systemd 186
    other
    +PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT -LIBCRYPTSETUP
    
    This information can be retrieved by other means (systemctl, etc.),
    but it's easier for a newbie if 'systemd --version' says something
    useful. And 'systemd --help' is already there, so let's complement
    that with '--version'.

diff --git a/man/systemd.xml b/man/systemd.xml
index c598a89..dc89ee7 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -96,6 +96,12 @@
                                 text and exits.</para></listitem>
                         </varlistentry>
                         <varlistentry>
+                                <term><option>--version</option></term>
+
+                                <listitem><para>Prints a systemd version
+                                identifier and exits.</para></listitem>
+                        </varlistentry>
+                        <varlistentry>
                                 <term><option>--test</option></term>
 
                                 <listitem><para>Determine startup
diff --git a/src/core/main.c b/src/core/main.c
index ae3769b..f1f8b21 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;



More information about the systemd-commits mailing list