From 5f32b7d9613e9ef3f8198302379a42630323da6a Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 20 Aug 2021 19:50:16 +0000 Subject: Hide struct args behind a couple of accessor functions. --- cmd-display-message.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cmd-display-message.c') 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; -- cgit