diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-04-22 10:22:40 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-04-22 10:22:40 +0000 |
commit | 3b5031a1e691e18e1bbe892b262d81db17887237 (patch) | |
tree | 280122dc6016981c484998db1ba10afbfdadb998 /usr.bin/tmux/cmd-new-session.c | |
parent | 61be04363b84fafcbfe17c4d58547b1ca814e2c7 (diff) |
Get rid of the extra layer of flags and cmd_prepare() and just store the
CMD_FIND_* flags in the cmd_entry and call it for the command. Commands
with special requirements call it themselves and update the target for
hooks to use.
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 4cc4eecf86e..502729d4d3e 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.104 2017/04/22 08:56:24 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.105 2017/04/22 10:22:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -44,7 +44,7 @@ const struct cmd_entry cmd_new_session_entry = { "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " "[-y height] [command]", - .tflag = CMD_SESSION_CANFAIL, + .target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL }, .flags = CMD_STARTSERVER, .exec = cmd_new_session_exec @@ -57,7 +57,7 @@ const struct cmd_entry cmd_has_session_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_SESSION_USAGE, - .tflag = CMD_SESSION, + .target = { 't', CMD_FIND_SESSION, 0 }, .flags = 0, .exec = cmd_new_session_exec @@ -108,10 +108,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) * have already been prepared, copy this * session into its tflag so it can be used. */ - cmd_find_from_session(&item->state.tflag, as); + cmd_find_from_session(&item->target, as); return (cmd_attach_session(item, - args_has(args, 'D'), 0, NULL, - args_has(args, 'E'))); + args_get(args, 't'), args_has(args, 'D'), + 0, NULL, args_has(args, 'E'))); } cmdq_error(item, "duplicate session: %s", newname); return (CMD_RETURN_ERROR); @@ -121,7 +121,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) /* Is this going to be part of a session group? */ group = args_get(args, 't'); if (group != NULL) { - groupwith = item->state.tflag.s; + groupwith = item->target.s; if (groupwith == NULL) { if (!session_check_name(group)) { cmdq_error(item, "bad group name: %s", group); |