summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-split-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-split-window.c')
-rw-r--r--usr.bin/tmux/cmd-split-window.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index db453271150..8994ff94fd9 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.74 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.75 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,8 @@
#define SPLIT_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
-static enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_split_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_split_window_entry = {
.name = "split-window",
@@ -50,13 +51,13 @@ const struct cmd_entry cmd_split_window_entry = {
};
static enum cmd_retval
-cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
- struct window_pane *wp = cmdq->state.tflag.wp, *new_wp = NULL;
+ struct window_pane *wp = item->state.tflag.wp, *new_wp = NULL;
struct environ *env;
const char *cmd, *path, *shell, *template, *cwd, *to_free;
char **argv, *cause, *new_cause, *cp;
@@ -91,12 +92,12 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
to_free = NULL;
if (args_has(args, 'c')) {
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, NULL, NULL);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, NULL, NULL);
to_free = cwd = format_expand(ft, args_get(args, 'c'));
format_free(ft);
- } else if (cmdq->client != NULL && cmdq->client->session == NULL)
- cwd = cmdq->client->cwd;
+ } else if (item->client != NULL && item->client->session == NULL)
+ cwd = item->client->cwd;
else
cwd = s->cwd;
@@ -142,8 +143,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
layout_assign_pane(lc, new_wp);
path = NULL;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- envent = environ_find(cmdq->client->environ, "PATH");
+ if (item->client != NULL && item->client->session == NULL)
+ envent = environ_find(item->client->environ, "PATH");
else
envent = environ_find(s->environ, "PATH");
if (envent != NULL)
@@ -168,11 +169,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = SPLIT_WINDOW_TEMPLATE;
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, wl, new_wp);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, wl, new_wp);
cp = format_expand(ft, template);
- cmdq_print(cmdq, "%s", cp);
+ cmdq_print(item, "%s", cp);
free(cp);
format_free(ft);
@@ -188,7 +189,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
fs.w = w;
fs.wp = new_wp;
cmd_find_log_state(__func__, &fs);
- hooks_insert(s->hooks, cmdq, &fs, "after-split-window");
+ hooks_insert(s->hooks, item, &fs, "after-split-window");
return (CMD_RETURN_NORMAL);
@@ -198,7 +199,7 @@ error:
layout_close_pane(new_wp);
window_remove_pane(w, new_wp);
}
- cmdq_error(cmdq, "create pane failed: %s", cause);
+ cmdq_error(item, "create pane failed: %s", cause);
free(cause);
if (to_free != NULL)