=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-if-shell.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- src/usr.bin/tmux/cmd-if-shell.c 2020/04/13 15:55:51 1.72 +++ src/usr.bin/tmux/cmd-if-shell.c 2020/04/13 18:59:41 1.73 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.72 2020/04/13 15:55:51 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.73 2020/04/13 18:59:41 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -65,13 +65,12 @@ struct cmd_find_state *target = cmdq_get_target(item); struct cmdq_state *state = cmdq_get_state(item); struct cmd_if_shell_data *cdata; - char *shellcmd, *cmd; + char *shellcmd, *cmd, *error; const char *file; - struct cmdq_item *new_item; struct client *c = cmd_find_client(item, NULL, 1); struct session *s = target->s; struct cmd_parse_input pi; - struct cmd_parse_result *pr; + enum cmd_parse_status status; shellcmd = format_single_from_target(item, args->argv[0], c); if (args_has(args, 'F')) { @@ -91,19 +90,11 @@ pi.c = c; cmd_find_copy_state(&pi.fs, target); - pr = cmd_parse_from_string(cmd, &pi); - switch (pr->status) { - case CMD_PARSE_EMPTY: - break; - case CMD_PARSE_ERROR: - cmdq_error(item, "%s", pr->error); - free(pr->error); + status = cmd_parse_and_insert(cmd, &pi, item, state, &error); + if (status == CMD_PARSE_ERROR) { + cmdq_error(item, "%s", error); + free(error); return (CMD_RETURN_ERROR); - case CMD_PARSE_SUCCESS: - new_item = cmdq_get_command(pr->cmdlist, state); - cmdq_insert_after(item, new_item); - cmd_list_free(pr->cmdlist); - break; } return (CMD_RETURN_NORMAL); }