summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-22 10:22:39 +0000
committernicm <nicm>2017-04-22 10:22:39 +0000
commitee45a8a149e1a3c8fe7c232a9e32f3a007e21bee (patch)
tree21cc9cafd10d55cd7cd92ec616d08ac59adc4a0a /cmd-new-session.c
parent2c0f826c360fc5a8f0e125759b596eb28441ba65 (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 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index cf0528d3..8c347ce6 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -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);