diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-05-23 13:02:27 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-05-23 13:02:27 +0100 |
commit | 75aeb733f292639f8332df11315ca8280e5631fd (patch) | |
tree | d459b4c2381ca737009613577deafe14196eceef /mode-tree.c | |
parent | 7ca2e2fe88cd282d3e8faea3f2000ad15972f71d (diff) | |
parent | 723010ba72e337832402f8e44981c02caa30b476 (diff) | |
download | rtmux-75aeb733f292639f8332df11315ca8280e5631fd.tar.gz rtmux-75aeb733f292639f8332df11315ca8280e5631fd.tar.bz2 rtmux-75aeb733f292639f8332df11315ca8280e5631fd.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'mode-tree.c')
-rw-r--r-- | mode-tree.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/mode-tree.c b/mode-tree.c index fb186c1a..9dd96190 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -1045,8 +1045,8 @@ mode_tree_run_command(struct client *c, struct cmd_find_state *fs, const char *template, const char *name) { struct cmdq_item *new_item; - struct cmd_list *cmdlist; - char *command, *cause; + char *command; + struct cmd_parse_result *pr; command = cmd_template_replace(template, name, 1); if (command == NULL || *command == '\0') { @@ -1054,17 +1054,22 @@ mode_tree_run_command(struct client *c, struct cmd_find_state *fs, return; } - cmdlist = cmd_string_parse(command, NULL, 0, &cause); - if (cmdlist == NULL) { - if (cause != NULL && c != NULL) { - *cause = toupper((u_char)*cause); - status_message_set(c, "%s", cause); + pr = cmd_parse_from_string(command, NULL); + switch (pr->status) { + case CMD_PARSE_EMPTY: + break; + case CMD_PARSE_ERROR: + if (c != NULL) { + *pr->error = toupper((u_char)*pr->error); + status_message_set(c, "%s", pr->error); } - free(cause); - } else { - new_item = cmdq_get_command(cmdlist, fs, NULL, 0); + free(pr->error); + break; + case CMD_PARSE_SUCCESS: + new_item = cmdq_get_command(pr->cmdlist, fs, NULL, 0); cmdq_append(c, new_item); - cmd_list_free(cmdlist); + cmd_list_free(pr->cmdlist); + break; } free(command); |