Merge branch 'obsd-master'

Conflicts:
	format.c
	window.c
This commit is contained in:
Thomas Adam
2014-05-13 21:58:48 +01:00
29 changed files with 747 additions and 486 deletions

View File

@ -35,7 +35,7 @@ enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_split_window_entry = {
"split-window", "splitw",
"c:dF:l:hp:Pt:v", 0, 1,
"c:dF:l:hp:Pt:v", 0, -1,
"[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] "
CMD_TARGET_PANE_USAGE " [command]",
0,
@ -61,9 +61,9 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
struct window_pane *wp, *new_wp = NULL;
struct environ env;
const char *cmd, *path, *shell, *template;
char *cause, *new_cause, *cp;
char **argv, *cause, *new_cause, *cp;
u_int hlimit;
int size, percentage, cwd, fd = -1;
int argc, size, percentage, cwd, fd = -1;
enum layout_type type;
struct layout_cell *lc;
struct client *c;
@ -80,10 +80,19 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
environ_copy(&s->environ, &env);
server_fill_environ(s, &env);
if (args->argc == 0)
if (args->argc == 0) {
cmd = options_get_string(&s->options, "default-command");
else
cmd = args->argv[0];
if (cmd != NULL && *cmd != '\0') {
argc = 1;
argv = (char**)&cmd;
} else {
argc = 0;
argv = NULL;
}
} else {
argc = args->argc;
argv = args->argv;
}
if (args_has(args, 'c')) {
ft = format_create();
@ -157,8 +166,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
if (envent != NULL)
path = envent->value;
if (window_pane_spawn(
new_wp, cmd, path, shell, cwd, &env, s->tio, &cause) != 0)
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, &env,
s->tio, &cause) != 0)
goto error;
layout_assign_pane(lc, new_wp);