summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 11:00:00 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 11:00:00 +0000
commit56530d4d9e327bc4c76b8b02290102a1fadfffb9 (patch)
treec902ce5f812b38436dec697a5fa08bf3615c0ed4 /usr.bin/tmux/cmd-new-session.c
parent9947eee19da9830a3c591d7fb4574df8cdd144e6 (diff)
Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make its
use more clearly defined and preparation for some future work).
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r--usr.bin/tmux/cmd-new-session.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 5f5c2729c0d..da79e3c88ed 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.125 2020/04/13 08:26:27 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.126 2020/04/13 10:59:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -67,7 +67,10 @@ static enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct client *c = item->client;
+ struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmd_find_state *current = &shared->current;
+ struct cmd_find_state *target = cmdq_get_target(item);
+ struct client *c = cmdq_get_client(item);
struct session *s, *as, *groupwith;
struct environ *env;
struct options *oo;
@@ -106,7 +109,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
if (newname != NULL)
as = session_find(newname);
else
- as = item->target.s;
+ as = target->s;
if (as != NULL) {
retval = cmd_attach_session(item, as->name,
args_has(args, 'D'), args_has(args, 'X'), 0, NULL,
@@ -123,7 +126,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->target.s;
+ groupwith = target->s;
if (groupwith == NULL) {
if (!session_check_name(group)) {
cmdq_error(item, "bad group name: %s", group);
@@ -172,7 +175,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
* over.
*/
if (!detached && !already_attached && c->tty.fd != -1) {
- if (server_client_check_nested(item->client)) {
+ if (server_client_check_nested(cmdq_get_client(item))) {
cmdq_error(item, "sessions should be nested with care, "
"unset $TMUX to force");
goto fail;
@@ -314,7 +317,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
} else if (c->session != NULL)
c->last_session = c->session;
c->session = s;
- if (~item->shared->flags & CMDQ_SHARED_REPEAT)
+ if (~shared->flags & CMDQ_SHARED_REPEAT)
server_client_set_key_table(c, NULL);
tty_update_client_offset(c);
status_timer_start(c);
@@ -344,7 +347,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
if (!detached) {
c->flags |= CLIENT_ATTACHED;
- cmd_find_from_session(&item->shared->current, s, 0);
+ cmd_find_from_session(current, s, 0);
}
cmd_find_from_session(&fs, s, 0);