diff options
author | 2017-03-08 13:36:12 +0000 | |
---|---|---|
committer | 2017-03-08 13:36:12 +0000 | |
commit | e35be1bbf4eba1dc2915a61ee09f1af8f875b2dd (patch) | |
tree | 3df2cd70fb95ec0fd53f8b7f685c6ebbd9e6a0e5 /usr.bin/tmux/cmd-if-shell.c | |
parent | prevent infinite recursion while expanding the arguments (diff) | |
download | wireguard-openbsd-e35be1bbf4eba1dc2915a61ee09f1af8f875b2dd.tar.xz wireguard-openbsd-e35be1bbf4eba1dc2915a61ee09f1af8f875b2dd.zip |
Add a helper function for the most common format_create/defaults/expand
pattern.
Diffstat (limited to 'usr.bin/tmux/cmd-if-shell.c')
-rw-r--r-- | usr.bin/tmux/cmd-if-shell.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index f71b6865b5b..7ce23e0a046 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.50 2017/02/03 11:57:27 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.51 2017/03/08 13:36:12 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -69,10 +69,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) char *shellcmd, *cmd, *cause; struct cmd_list *cmdlist; struct cmdq_item *new_item; + struct client *c = item->state.c; struct session *s = item->state.tflag.s; struct winlink *wl = item->state.tflag.wl; struct window_pane *wp = item->state.tflag.wp; - struct format_tree *ft; const char *cwd; if (item->client != NULL && item->client->session == NULL) @@ -82,11 +82,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) else cwd = NULL; - ft = format_create(item, FORMAT_NONE, 0); - format_defaults(ft, item->state.c, s, wl, wp); - shellcmd = format_expand(ft, args->argv[0]); - format_free(ft); - + shellcmd = format_single(item, args->argv[0], c, s, wl, wp); if (args_has(args, 'F')) { cmd = NULL; if (*shellcmd != '0' && *shellcmd != '\0') |