diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-11-10 08:06:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 08:06:11 -0500 |
commit | 80a1c340a9c8c8aac5fe4dd7bc1dc15b43fce0dc (patch) | |
tree | df51bf83b899933f1347508b9f1bd55aefa21ae5 /sway/commands/input/xkb_capslock.c | |
parent | 7fa7f4f48d17e0470c800b258061d188ceb705da (diff) | |
parent | b865dabebab717fea75f91e8ccebabc99e36bdd9 (diff) |
Merge pull request #3098 from c-edw/feature/RefactorArgParse
Use parse_boolean where possible.
Diffstat (limited to 'sway/commands/input/xkb_capslock.c')
-rw-r--r-- | sway/commands/input/xkb_capslock.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sway/commands/input/xkb_capslock.c b/sway/commands/input/xkb_capslock.c index 669b4ea9..a939c72f 100644 --- a/sway/commands/input/xkb_capslock.c +++ b/sway/commands/input/xkb_capslock.c @@ -3,6 +3,7 @@ #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" +#include "util.h" struct cmd_results *input_cmd_xkb_capslock(int argc, char **argv) { struct cmd_results *error = NULL; @@ -15,14 +16,7 @@ struct cmd_results *input_cmd_xkb_capslock(int argc, char **argv) { "No input device defined."); } - if (strcasecmp(argv[0], "enabled") == 0) { - ic->xkb_capslock = 1; - } else if (strcasecmp(argv[0], "disabled") == 0) { - ic->xkb_capslock = 0; - } else { - return cmd_results_new(CMD_INVALID, "xkb_capslock", - "Expected 'xkb_capslock <enabled|disabled>'"); - } + ic->xkb_capslock = parse_boolean(argv[0], false); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |