version 1.59, 2015/10/27 15:58:42 |
version 1.60, 2015/10/28 09:51:55 |
|
|
struct winlink *wl; |
struct winlink *wl; |
struct window *w; |
struct window *w; |
struct window_pane *wp, *new_wp = NULL; |
struct window_pane *wp, *new_wp = NULL; |
struct environ env; |
struct environ *env; |
const char *cmd, *path, *shell, *template; |
const char *cmd, *path, *shell, *template; |
char **argv, *cause, *new_cause, *cp; |
char **argv, *cause, *new_cause, *cp; |
u_int hlimit; |
u_int hlimit; |
|
|
w = wl->window; |
w = wl->window; |
server_unzoom_window(w); |
server_unzoom_window(w); |
|
|
environ_init(&env); |
env = environ_create(); |
environ_copy(&global_environ, &env); |
environ_copy(global_environ, env); |
environ_copy(&s->environ, &env); |
environ_copy(s->environ, env); |
server_fill_environ(s, &env); |
server_fill_environ(s, env); |
|
|
if (args->argc == 0) { |
if (args->argc == 0) { |
cmd = options_get_string(s->options, "default-command"); |
cmd = options_get_string(s->options, "default-command"); |
|
|
|
|
path = NULL; |
path = NULL; |
if (cmdq->client != NULL && cmdq->client->session == NULL) |
if (cmdq->client != NULL && cmdq->client->session == NULL) |
envent = environ_find(&cmdq->client->environ, "PATH"); |
envent = environ_find(cmdq->client->environ, "PATH"); |
else |
else |
envent = environ_find(&s->environ, "PATH"); |
envent = environ_find(s->environ, "PATH"); |
if (envent != NULL) |
if (envent != NULL) |
path = envent->value; |
path = envent->value; |
|
|
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, &env, |
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, env, |
s->tio, &cause) != 0) |
s->tio, &cause) != 0) |
goto error; |
goto error; |
|
|
|
|
} else |
} else |
server_status_session(s); |
server_status_session(s); |
|
|
environ_free(&env); |
environ_free(env); |
|
|
if (args_has(args, 'P')) { |
if (args_has(args, 'P')) { |
if ((template = args_get(args, 'F')) == NULL) |
if ((template = args_get(args, 'F')) == NULL) |
|
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
|
|
error: |
error: |
environ_free(&env); |
environ_free(env); |
if (new_wp != NULL) { |
if (new_wp != NULL) { |
layout_close_pane(new_wp); |
layout_close_pane(new_wp); |
window_remove_pane(w, new_wp); |
window_remove_pane(w, new_wp); |