version 1.74, 2015/10/27 15:58:42 |
version 1.75, 2015/10/28 09:51:55 |
|
|
struct client *c = cmdq->client, *c0; |
struct client *c = cmdq->client, *c0; |
struct session *s, *groupwith; |
struct session *s, *groupwith; |
struct window *w; |
struct window *w; |
struct environ env; |
struct environ *env; |
struct termios tio, *tiop; |
struct termios tio, *tiop; |
const char *newname, *target, *update, *errstr, *template; |
const char *newname, *target, *update, *errstr, *template; |
const char *path; |
const char *path; |
|
|
|
|
path = NULL; |
path = NULL; |
if (c != NULL && c->session == NULL) |
if (c != NULL && c->session == NULL) |
envent = environ_find(&c->environ, "PATH"); |
envent = environ_find(c->environ, "PATH"); |
else |
else |
envent = environ_find(&global_environ, "PATH"); |
envent = environ_find(global_environ, "PATH"); |
if (envent != NULL) |
if (envent != NULL) |
path = envent->value; |
path = envent->value; |
|
|
/* Construct the environment. */ |
/* Construct the environment. */ |
environ_init(&env); |
env = environ_create(); |
if (c != NULL && !args_has(args, 'E')) { |
if (c != NULL && !args_has(args, 'E')) { |
update = options_get_string(global_s_options, |
update = options_get_string(global_s_options, |
"update-environment"); |
"update-environment"); |
environ_update(update, &c->environ, &env); |
environ_update(update, c->environ, env); |
} |
} |
|
|
/* Create the new session. */ |
/* Create the new session. */ |
idx = -1 - options_get_number(global_s_options, "base-index"); |
idx = -1 - options_get_number(global_s_options, "base-index"); |
s = session_create(newname, argc, argv, path, cwd, &env, tiop, idx, sx, |
s = session_create(newname, argc, argv, path, cwd, env, tiop, idx, sx, |
sy, &cause); |
sy, &cause); |
|
environ_free(env); |
if (s == NULL) { |
if (s == NULL) { |
cmdq_error(cmdq, "create session failed: %s", cause); |
cmdq_error(cmdq, "create session failed: %s", cause); |
free(cause); |
free(cause); |
goto error; |
goto error; |
} |
} |
environ_free(&env); |
|
|
|
/* Set the initial window name if one given. */ |
/* Set the initial window name if one given. */ |
if (argc >= 0 && args_has(args, 'n')) { |
if (argc >= 0 && args_has(args, 'n')) { |