diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-04-29 07:53:56 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-04-30 11:30:38 +1000 |
commit | 6b6f8151a41147eb44d08f33de143b43eb004563 (patch) | |
tree | fbc9f1661adbcc97e6f6aa176fdd070a96c6accc | |
parent | a7b2d04e90cb66526a825deaf38da9924b4fb89e (diff) |
tools: print version number in libinput-list-devices
Makes debugging a bit easier when you can just ask users to do that instead of
digging around in whatever packaging system they have.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
-rw-r--r-- | tools/libinput-list-devices.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c index 24c7c53..c9e1191 100644 --- a/tools/libinput-list-devices.c +++ b/tools/libinput-list-devices.c @@ -30,6 +30,7 @@ #include <libudev.h> #include <libinput.h> +#include <libinput-version.h> #include "shared.h" @@ -240,6 +241,23 @@ print_device_notify(struct libinput_event *ev) printf("\n"); } +static inline void +usage(void) +{ + printf("Usage: %s [--help|--version]\n" + "\n" + "This tool creates a libinput context on the default seat \"seat0\"\n" + "and lists all devices recognized by libinput and the configuration options.\n" + "Where multiple options are possible, the default is prefixed with \"*\".\n" + "\n" + "Options:\n" + "--help ...... show this help\n" + "--version ... show version information\n" + "\n" + "This tool requires access to the /dev/input/eventX nodes.\n", + program_invocation_short_name); +} + int main(int argc, char **argv) { @@ -248,16 +266,16 @@ main(int argc, char **argv) struct libinput_event *ev; if (argc > 1) { - printf("Usage: %s [--help]\n" - "\n" - "This tool creates a libinput context on the default seat \"seat0\"\n" - "and lists all devices recognized by libinput and the configuration options.\n" - "Where multiple options are possible, the default is prefixed with \"*\".\n" - "\n" - "This tool requires access to the /dev/input/eventX nodes.\n", - program_invocation_short_name); - - return 1; + if (strcmp(argv[1], "--help") == 0) { + usage(); + return 0; + } else if (strcmp(argv[1], "--version") == 0) { + printf("%s\n", LIBINPUT_VERSION); + return 0; + } else { + usage(); + return 1; + } } tools_init_options(&options); |