summaryrefslogtreecommitdiffstats
path: root/cmd-display-message.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-display-message.c
parentde94a344f61b0e4ef6459c11621be3c3d1683c9e (diff)
Hide struct args behind a couple of accessor functions.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 8fd6a8ff..f4d41e6c 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -68,9 +68,9 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
struct window_pane *wp = target->wp;
const char *template;
char *msg, *cause;
- int delay = -1;
+ int delay = -1, flags;
struct format_tree *ft;
- int flags;
+ u_int count = args_count(args);
if (args_has(args, 'I')) {
if (wp == NULL)
@@ -83,7 +83,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_WAIT);
}
- if (args_has(args, 'F') && args->argc != 0) {
+ if (args_has(args, 'F') && count != 0) {
cmdq_error(item, "only one of -F or argument must be given");
return (CMD_RETURN_ERROR);
}
@@ -97,9 +97,10 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
}
}
- template = args_get(args, 'F');
- if (args->argc != 0)
- template = args->argv[0];
+ if (count != 0)
+ template = args_string(args, 0);
+ else
+ template = args_get(args, 'F');
if (template == NULL)
template = DISPLAY_MESSAGE_TEMPLATE;