diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-07-23 21:49:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 21:49:16 -0400 |
commit | 71774ecd3658653328f3c903869b52c51c62e237 (patch) | |
tree | bfc136252f81a5350f240c20161d2d0bfc2f80dd /sway/commands/output | |
parent | 224ade138208e9aa525423cbfbd643aa9d9b63c3 (diff) | |
parent | 9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc (diff) |
Merge pull request #2340 from RedSoxFan/parse_boolean
Switch to using a function to parse booleans
Diffstat (limited to 'sway/commands/output')
-rw-r--r-- | sway/commands/output/dpms.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sway/commands/output/dpms.c b/sway/commands/output/dpms.c index 0959ea6b..3492061e 100644 --- a/sway/commands/output/dpms.c +++ b/sway/commands/output/dpms.c @@ -1,5 +1,6 @@ #include "sway/commands.h" #include "sway/config.h" +#include "util.h" struct cmd_results *output_cmd_dpms(int argc, char **argv) { if (!config->handler_context.output_config) { @@ -9,13 +10,10 @@ struct cmd_results *output_cmd_dpms(int argc, char **argv) { return cmd_results_new(CMD_INVALID, "output", "Missing dpms argument."); } - if (strcmp(*argv, "on") == 0) { + if (parse_boolean(argv[0], true)) { config->handler_context.output_config->dpms_state = DPMS_ON; - } else if (strcmp(*argv, "off") == 0) { - config->handler_context.output_config->dpms_state = DPMS_OFF; } else { - return cmd_results_new(CMD_INVALID, "output", - "Invalid dpms state, valid states are on/off."); + config->handler_context.output_config->dpms_state = DPMS_OFF; } config->handler_context.leftovers.argc = argc - 1; |