version 1.62, 2019/05/25 07:15:53 |
version 1.63, 2019/06/12 08:47:07 |
|
|
struct cmd_if_shell_data *cdata; |
struct cmd_if_shell_data *cdata; |
char *shellcmd, *cmd; |
char *shellcmd, *cmd; |
struct cmdq_item *new_item; |
struct cmdq_item *new_item; |
|
struct cmd_find_state *fs = &item->target; |
struct client *c = cmd_find_client(item, NULL, 1); |
struct client *c = cmd_find_client(item, NULL, 1); |
struct session *s = item->target.s; |
struct session *s = fs->s; |
struct winlink *wl = item->target.wl; |
struct winlink *wl = fs->wl; |
struct window_pane *wp = item->target.wp; |
struct window_pane *wp = fs->wp; |
struct cmd_parse_input pi; |
struct cmd_parse_input pi; |
struct cmd_parse_result *pr; |
struct cmd_parse_result *pr; |
|
|
|
|
pi.line = self->line; |
pi.line = self->line; |
pi.item = item; |
pi.item = item; |
pi.c = c; |
pi.c = c; |
cmd_find_copy_state(&pi.fs, &item->target); |
cmd_find_copy_state(&pi.fs, fs); |
|
|
pr = cmd_parse_from_string(cmd, &pi); |
pr = cmd_parse_from_string(cmd, &pi); |
switch (pr->status) { |
switch (pr->status) { |
|
|
free(pr->error); |
free(pr->error); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
case CMD_PARSE_SUCCESS: |
case CMD_PARSE_SUCCESS: |
new_item = cmdq_get_command(pr->cmdlist, NULL, m, 0); |
new_item = cmdq_get_command(pr->cmdlist, fs, m, 0); |
cmdq_insert_after(item, new_item); |
cmdq_insert_after(item, new_item); |
cmd_list_free(pr->cmdlist); |
cmd_list_free(pr->cmdlist); |
break; |
break; |
|
|
cdata->input.c = c; |
cdata->input.c = c; |
if (cdata->input.c != NULL) |
if (cdata->input.c != NULL) |
cdata->input.c->references++; |
cdata->input.c->references++; |
cmd_find_copy_state(&cdata->input.fs, &item->target); |
cmd_find_copy_state(&cdata->input.fs, fs); |
|
|
if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, |
if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, |
cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) { |
cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) { |