summaryrefslogtreecommitdiffstats
path: root/cmd-unbind-key.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-20 19:50:16 +0000
committernicm <nicm>2021-08-20 19:50:16 +0000
commit5f32b7d9613e9ef3f8198302379a42630323da6a (patch)
tree0a0b488496625e9da5cbc02c5a1271634568ecc3 /cmd-unbind-key.c
parentde94a344f61b0e4ef6459c11621be3c3d1683c9e (diff)
Hide struct args behind a couple of accessor functions.
Diffstat (limited to 'cmd-unbind-key.c')
-rw-r--r--cmd-unbind-key.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index a29831af..202a07f4 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -44,11 +44,11 @@ cmd_unbind_key_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
key_code key;
- const char *tablename;
+ const char *tablename, *keystr = args_string(args, 0);
int quiet = args_has(args, 'q');
if (args_has(args, 'a')) {
- if (args->argc != 0) {
+ if (keystr != NULL) {
if (!quiet)
cmdq_error(item, "key given with -a");
return (CMD_RETURN_ERROR);
@@ -73,16 +73,16 @@ cmd_unbind_key_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
}
- if (args->argc != 1) {
+ if (keystr == NULL) {
if (!quiet)
cmdq_error(item, "missing key");
return (CMD_RETURN_ERROR);
}
- key = key_string_lookup_string(args->argv[0]);
+ key = key_string_lookup_string(keystr);
if (key == KEYC_NONE || key == KEYC_UNKNOWN) {
if (!quiet)
- cmdq_error(item, "unknown key: %s", args->argv[0]);
+ cmdq_error(item, "unknown key: %s", keystr);
return (CMD_RETURN_ERROR);
}