diff --git a/cmd-parse.y b/cmd-parse.y index 843403a4..4cd8a420 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -849,7 +849,7 @@ cmd_parse_build_command(struct cmd_parse_command *cmd, count++; } - add = cmd_parse(values, count, pi->file, pi->line, &cause); + add = cmd_parse(values, count, pi->file, pi->line, pi->flags, &cause); if (add == NULL) { pr->status = CMD_PARSE_ERROR; pr->error = cmd_parse_get_error(pi->file, pi->line, cause); diff --git a/cmd-show-messages.c b/cmd-show-messages.c index dca3ab31..aa02c203 100644 --- a/cmd-show-messages.c +++ b/cmd-show-messages.c @@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_messages_entry = { .args = { "JTt:", 0, 0, NULL }, .usage = "[-JT] " CMD_TARGET_CLIENT_USAGE, - .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG, + .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG|CMD_CLIENT_CANFAIL, .exec = cmd_show_messages_exec }; @@ -55,7 +55,7 @@ cmd_show_messages_terminals(struct cmd *self, struct cmdq_item *item, int blank) n = 0; LIST_FOREACH(term, &tty_terms, entry) { - if (args_has(args, 't') && term != tc->tty.term) + if (args_has(args, 't') && tc != NULL && term != tc->tty.term) continue; if (blank) { cmdq_print(item, "%s", ""); diff --git a/cmd-source-file.c b/cmd-source-file.c index 9e1c18ac..cf5d5ff3 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -166,7 +166,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) char *pattern, *cwd, *expanded = NULL; const char *path, *error; glob_t g; - int result; + int result, parse_flags; u_int i, j; if (c == NULL) { @@ -192,8 +192,11 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) cdata->flags |= CMD_PARSE_QUIET; if (args_has(args, 'n')) cdata->flags |= CMD_PARSE_PARSEONLY; - if (args_has(args, 'v') && (c == NULL || ~c->flags & CLIENT_CONTROL)) - cdata->flags |= CMD_PARSE_VERBOSE; + if (c == NULL || ~c->flags & CLIENT_CONTROL) { + parse_flags = cmd_get_parse_flags(self); + if (args_has(args, 'v') || (parse_flags & CMD_PARSE_VERBOSE)) + cdata->flags |= CMD_PARSE_VERBOSE; + } cwd = cmd_source_file_quote_for_glob(server_client_get_cwd(c, NULL)); diff --git a/cmd.c b/cmd.c index 02d2ac41..7fed2a15 100644 --- a/cmd.c +++ b/cmd.c @@ -220,6 +220,7 @@ struct cmd { char *file; u_int line; + int parse_flags; TAILQ_ENTRY(cmd) qentry; }; @@ -412,6 +413,13 @@ cmd_get_source(struct cmd *cmd, const char **file, u_int *line) *line = cmd->line; } +/* Get parse flags for command. */ +int +cmd_get_parse_flags(struct cmd *cmd) +{ + return (cmd->parse_flags); +} + /* Look for an alias for a command. */ char * cmd_get_alias(const char *name) @@ -496,7 +504,7 @@ ambiguous: /* Parse a single command from an argument vector. */ struct cmd * cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, - char **cause) + int parse_flags, char **cause) { const struct cmd_entry *entry; struct cmd *cmd; @@ -525,6 +533,7 @@ cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, cmd = xcalloc(1, sizeof *cmd); cmd->entry = entry; cmd->args = args; + cmd->parse_flags = parse_flags; if (file != NULL) cmd->file = xstrdup(file); diff --git a/tmux.h b/tmux.h index c3959d2a..b2f10ca7 100644 --- a/tmux.h +++ b/tmux.h @@ -2712,7 +2712,8 @@ const struct cmd_entry *cmd_get_entry(struct cmd *); struct args *cmd_get_args(struct cmd *); u_int cmd_get_group(struct cmd *); void cmd_get_source(struct cmd *, const char **, u_int *); -struct cmd *cmd_parse(struct args_value *, u_int, const char *, u_int, +int cmd_get_parse_flags(struct cmd *); +struct cmd *cmd_parse(struct args_value *, u_int, const char *, u_int, int, char **); struct cmd *cmd_copy(struct cmd *, int, char **); void cmd_free(struct cmd *);