diff options
author | 2013-03-25 11:36:42 +0000 | |
---|---|---|
committer | 2013-03-25 11:36:42 +0000 | |
commit | 5be049e65f1f6116af58db8888c9270f89ae5762 (patch) | |
tree | 8e24a74597d47b5f5900a04dfc5ce482fff9e6b9 /usr.bin/tmux/cmd-if-shell.c | |
parent | Add home and end as modified by xterm in keypad mode, from Chris (diff) | |
download | wireguard-openbsd-5be049e65f1f6116af58db8888c9270f89ae5762.tar.xz wireguard-openbsd-5be049e65f1f6116af58db8888c9270f89ae5762.zip |
Fix if-shell and run-shell if there are no sessions. Batted around
through several people, finished off by Chris Johnsen.
Diffstat (limited to 'usr.bin/tmux/cmd-if-shell.c')
-rw-r--r-- | usr.bin/tmux/cmd-if-shell.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index d5e526889e1..a5f23df285b 100644 --- a/usr.bin/tmux/cmd-if-shell.c +++ b/usr.bin/tmux/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.20 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.21 2013/03/25 11:36:42 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -59,19 +59,21 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct cmd_if_shell_data *cdata; char *shellcmd; - struct session *s; - struct winlink *wl; - struct window_pane *wp; + struct session *s = NULL; + struct winlink *wl = NULL; + struct window_pane *wp = NULL; struct format_tree *ft; - wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); - if (wl == NULL) - return (CMD_RETURN_ERROR); + if (args_has(args, 't')) + wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); ft = format_create(); - format_session(ft, s); - format_winlink(ft, s, wl); - format_window_pane(ft, wp); + if (s != NULL) + format_session(ft, s); + if (s != NULL && wl != NULL) + format_winlink(ft, s, wl); + if (wp != NULL) + format_window_pane(ft, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); |