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-attach-session.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-attach-session.c')
-rw-r--r-- | usr.bin/tmux/cmd-attach-session.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 4baef01a664..8136886b634 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.69 2017/02/06 15:00:41 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.70 2017/03/08 13:36:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -54,8 +54,7 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, struct client *c = item->client, *c_loop; struct winlink *wl = item->state.tflag.wl; struct window_pane *wp = item->state.tflag.wp; - char *cause, *cwd; - struct format_tree *ft; + char *cause; if (RB_EMPTY(&sessions)) { cmdq_error(item, "no sessions"); @@ -77,13 +76,8 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, } if (cflag != NULL) { - ft = format_create(item, FORMAT_NONE, 0); - format_defaults(ft, c, s, wl, wp); - cwd = format_expand(ft, cflag); - format_free(ft); - free((void *)s->cwd); - s->cwd = cwd; + s->cwd = format_single(item, cflag, c, s, wl, wp); } if (c->session != NULL) { |