Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2025-11-18 10:01:07 +00:00
5 changed files with 21 additions and 8 deletions

View File

@@ -849,7 +849,7 @@ cmd_parse_build_command(struct cmd_parse_command *cmd,
count++; 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) { if (add == NULL) {
pr->status = CMD_PARSE_ERROR; pr->status = CMD_PARSE_ERROR;
pr->error = cmd_parse_get_error(pi->file, pi->line, cause); pr->error = cmd_parse_get_error(pi->file, pi->line, cause);

View File

@@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_messages_entry = {
.args = { "JTt:", 0, 0, NULL }, .args = { "JTt:", 0, 0, NULL },
.usage = "[-JT] " CMD_TARGET_CLIENT_USAGE, .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 .exec = cmd_show_messages_exec
}; };
@@ -55,7 +55,7 @@ cmd_show_messages_terminals(struct cmd *self, struct cmdq_item *item, int blank)
n = 0; n = 0;
LIST_FOREACH(term, &tty_terms, entry) { 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; continue;
if (blank) { if (blank) {
cmdq_print(item, "%s", ""); cmdq_print(item, "%s", "");

View File

@@ -166,7 +166,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
char *pattern, *cwd, *expanded = NULL; char *pattern, *cwd, *expanded = NULL;
const char *path, *error; const char *path, *error;
glob_t g; glob_t g;
int result; int result, parse_flags;
u_int i, j; u_int i, j;
if (c == NULL) { if (c == NULL) {
@@ -192,8 +192,11 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
cdata->flags |= CMD_PARSE_QUIET; cdata->flags |= CMD_PARSE_QUIET;
if (args_has(args, 'n')) if (args_has(args, 'n'))
cdata->flags |= CMD_PARSE_PARSEONLY; cdata->flags |= CMD_PARSE_PARSEONLY;
if (args_has(args, 'v') && (c == NULL || ~c->flags & CLIENT_CONTROL)) if (c == NULL || ~c->flags & CLIENT_CONTROL) {
cdata->flags |= CMD_PARSE_VERBOSE; 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)); cwd = cmd_source_file_quote_for_glob(server_client_get_cwd(c, NULL));

11
cmd.c
View File

@@ -220,6 +220,7 @@ struct cmd {
char *file; char *file;
u_int line; u_int line;
int parse_flags;
TAILQ_ENTRY(cmd) qentry; TAILQ_ENTRY(cmd) qentry;
}; };
@@ -412,6 +413,13 @@ cmd_get_source(struct cmd *cmd, const char **file, u_int *line)
*line = cmd->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. */ /* Look for an alias for a command. */
char * char *
cmd_get_alias(const char *name) cmd_get_alias(const char *name)
@@ -496,7 +504,7 @@ ambiguous:
/* Parse a single command from an argument vector. */ /* Parse a single command from an argument vector. */
struct cmd * struct cmd *
cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, 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; const struct cmd_entry *entry;
struct cmd *cmd; 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 = xcalloc(1, sizeof *cmd);
cmd->entry = entry; cmd->entry = entry;
cmd->args = args; cmd->args = args;
cmd->parse_flags = parse_flags;
if (file != NULL) if (file != NULL)
cmd->file = xstrdup(file); cmd->file = xstrdup(file);

3
tmux.h
View File

@@ -2712,7 +2712,8 @@ const struct cmd_entry *cmd_get_entry(struct cmd *);
struct args *cmd_get_args(struct cmd *); struct args *cmd_get_args(struct cmd *);
u_int cmd_get_group(struct cmd *); u_int cmd_get_group(struct cmd *);
void cmd_get_source(struct cmd *, const char **, u_int *); 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 **); char **);
struct cmd *cmd_copy(struct cmd *, int, char **); struct cmd *cmd_copy(struct cmd *, int, char **);
void cmd_free(struct cmd *); void cmd_free(struct cmd *);