diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-23 22:42:49 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-23 22:42:49 +0000 |
commit | 69a8d6471634ebdfa9db70b306e493f47ddd9a5d (patch) | |
tree | 1d566f02b2f432d01b8cce7b0587250dd1764c78 /cmd-if-shell.c | |
parent | 3964309c67a683e5132662e38b5ff932af5cbeea (diff) | |
parent | 243244d285979e38401560383f6453457078e8de (diff) | |
download | rtmux-69a8d6471634ebdfa9db70b306e493f47ddd9a5d.tar.gz rtmux-69a8d6471634ebdfa9db70b306e493f47ddd9a5d.tar.bz2 rtmux-69a8d6471634ebdfa9db70b306e493f47ddd9a5d.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Conflicts:
cmd-if-shell.c
cmd-run-shell.c
tmux.1
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r-- | cmd-if-shell.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 3b280432..b921f418 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -37,8 +37,8 @@ void cmd_if_shell_free(void *); const struct cmd_entry cmd_if_shell_entry = { "if-shell", "if", - "b", 2, 3, - "[-b] shell-command command [command]", + "bt:", 2, 3, + "[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]", 0, NULL, NULL, @@ -58,7 +58,22 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct cmd_if_shell_data *cdata; - const char *shellcmd = args->argv[0]; + char *shellcmd; + struct session *s; + struct winlink *wl; + struct window_pane *wp; + struct format_tree *ft; + + wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); + if (wl == NULL) + return (CMD_RETURN_ERROR); + + ft = format_create(); + format_session(ft, s); + format_winlink(ft, s, wl); + format_window_pane(ft, wp); + shellcmd = format_expand(ft, args->argv[0]); + format_free(ft); cdata = xmalloc(sizeof *cdata); cdata->cmd_if = xstrdup(args->argv[1]); @@ -73,6 +88,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) cmdq->references++; job_run(shellcmd, cmd_if_shell_callback, cmd_if_shell_free, cdata); + free(shellcmd); if (cdata->bflag) return (CMD_RETURN_NORMAL); |