diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-03-24 10:11:02 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-03-24 11:42:44 +1000 |
commit | 6ba530f2d8038c433d5e849f23815f528666d155 (patch) | |
tree | 0cac9492c1f6f564b7cb67f50030f551a8f0bc71 /tools | |
parent | 078d5cb332c756102a7fce7099a6d63724c099d2 (diff) |
tools: use 'required_argument'/'no_argument' for getopt_long
See the getopt_long example, makes the code more obvious
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/shared.c b/tools/shared.c index c618573..c4f19f8 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -171,33 +171,33 @@ tools_parse_args(int argc, char **argv, struct tools_context *context) int c; int option_index = 0; static struct option opts[] = { - { "device", 1, 0, OPT_DEVICE }, - { "udev", 0, 0, OPT_UDEV }, - { "grab", 0, 0, OPT_GRAB }, - { "help", 0, 0, OPT_HELP }, - { "verbose", 0, 0, OPT_VERBOSE }, - { "quiet", 0, 0, OPT_QUIET }, - { "enable-tap", 0, 0, OPT_TAP_ENABLE }, - { "disable-tap", 0, 0, OPT_TAP_DISABLE }, - { "enable-drag", 0, 0, OPT_DRAG_ENABLE }, - { "disable-drag", 0, 0, OPT_DRAG_DISABLE }, - { "enable-drag-lock", 0, 0, OPT_DRAG_LOCK_ENABLE }, - { "disable-drag-lock", 0, 0, OPT_DRAG_LOCK_DISABLE }, - { "enable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_ENABLE }, - { "disable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_DISABLE }, - { "enable-left-handed", 0, 0, OPT_LEFT_HANDED_ENABLE }, - { "disable-left-handed", 0, 0, OPT_LEFT_HANDED_DISABLE }, - { "enable-middlebutton", 0, 0, OPT_MIDDLEBUTTON_ENABLE }, - { "disable-middlebutton", 0, 0, OPT_MIDDLEBUTTON_DISABLE }, - { "enable-dwt", 0, 0, OPT_DWT_ENABLE }, - { "disable-dwt", 0, 0, OPT_DWT_DISABLE }, - { "set-click-method", 1, 0, OPT_CLICK_METHOD }, - { "set-scroll-method", 1, 0, OPT_SCROLL_METHOD }, - { "set-scroll-button", 1, 0, OPT_SCROLL_BUTTON }, - { "set-profile", 1, 0, OPT_PROFILE }, - { "set-tap-map", 1, 0, OPT_TAP_MAP }, - { "set-speed", 1, 0, OPT_SPEED }, - { "show-keycodes", 0, 0, OPT_SHOW_KEYCODES }, + { "device", required_argument, 0, OPT_DEVICE }, + { "udev", no_argument, 0, OPT_UDEV }, + { "grab", no_argument, 0, OPT_GRAB }, + { "help", no_argument, 0, OPT_HELP }, + { "verbose", no_argument, 0, OPT_VERBOSE }, + { "quiet", no_argument, 0, OPT_QUIET }, + { "enable-tap", no_argument, 0, OPT_TAP_ENABLE }, + { "disable-tap", no_argument, 0, OPT_TAP_DISABLE }, + { "enable-drag", no_argument, 0, OPT_DRAG_ENABLE }, + { "disable-drag", no_argument, 0, OPT_DRAG_DISABLE }, + { "enable-drag-lock", no_argument, 0, OPT_DRAG_LOCK_ENABLE }, + { "disable-drag-lock", no_argument, 0, OPT_DRAG_LOCK_DISABLE }, + { "enable-natural-scrolling", no_argument, 0, OPT_NATURAL_SCROLL_ENABLE }, + { "disable-natural-scrolling", no_argument, 0, OPT_NATURAL_SCROLL_DISABLE }, + { "enable-left-handed", no_argument, 0, OPT_LEFT_HANDED_ENABLE }, + { "disable-left-handed", no_argument, 0, OPT_LEFT_HANDED_DISABLE }, + { "enable-middlebutton", no_argument, 0, OPT_MIDDLEBUTTON_ENABLE }, + { "disable-middlebutton", no_argument, 0, OPT_MIDDLEBUTTON_DISABLE }, + { "enable-dwt", no_argument, 0, OPT_DWT_ENABLE }, + { "disable-dwt", no_argument, 0, OPT_DWT_DISABLE }, + { "set-click-method", required_argument, 0, OPT_CLICK_METHOD }, + { "set-scroll-method", required_argument, 0, OPT_SCROLL_METHOD }, + { "set-scroll-button", required_argument, 0, OPT_SCROLL_BUTTON }, + { "set-profile", required_argument, 0, OPT_PROFILE }, + { "set-tap-map", required_argument, 0, OPT_TAP_MAP }, + { "set-speed", required_argument, 0, OPT_SPEED }, + { "show-keycodes", no_argument, 0, OPT_SHOW_KEYCODES }, { 0, 0, 0, 0} }; |