version 1.7, 2009/07/26 12:58:44 |
version 1.8, 2009/08/08 21:52:43 |
|
|
struct winlink *wl; |
struct winlink *wl; |
struct window *w; |
struct window *w; |
struct window_pane *wp; |
struct window_pane *wp; |
const char **env; |
struct environ env; |
char *cmd, *cwd, *cause; |
char *cmd, *cwd, *cause; |
u_int hlimit; |
u_int hlimit; |
int size; |
int size; |
|
|
return (-1); |
return (-1); |
w = wl->window; |
w = wl->window; |
|
|
env = server_fill_environ(s); |
environ_init(&env); |
|
environ_copy(&global_environ, &env); |
|
environ_copy(&s->environ, &env); |
|
server_fill_environ(s, &env); |
|
|
cmd = data->cmd; |
cmd = data->cmd; |
if (cmd == NULL) |
if (cmd == NULL) |
|
|
type = LAYOUT_LEFTRIGHT; |
type = LAYOUT_LEFTRIGHT; |
|
|
wp = window_add_pane(w, hlimit); |
wp = window_add_pane(w, hlimit); |
if (window_pane_spawn(wp, cmd, cwd, env, &cause) != 0) |
if (window_pane_spawn(wp, cmd, cwd, &env, &cause) != 0) |
goto error; |
goto error; |
if (layout_split_pane(w->active, type, size, wp) != 0) { |
if (layout_split_pane(w->active, type, size, wp) != 0) { |
cause = xstrdup("pane too small"); |
cause = xstrdup("pane too small"); |
|
|
} else |
} else |
server_status_session(s); |
server_status_session(s); |
|
|
|
environ_free(&env); |
return (0); |
return (0); |
|
|
error: |
error: |
|
environ_free(&env); |
if (wp != NULL) |
if (wp != NULL) |
window_remove_pane(w, wp); |
window_remove_pane(w, wp); |
ctx->error(ctx, "create pane failed: %s", cause); |
ctx->error(ctx, "create pane failed: %s", cause); |