version 1.84, 2016/01/19 15:59:12 |
version 1.85, 2016/01/31 09:52:01 |
|
|
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, *cwd, *to_free; |
const char *path, *cwd, *to_free = NULL; |
char **argv, *cmd, *cause, *cp; |
char **argv, *cmd, *cause, *cp; |
int detached, already_attached, idx, argc; |
int detached, already_attached, idx, argc; |
u_int sx, sy; |
u_int sx, sy; |
|
|
} |
} |
} |
} |
|
|
if ((target = args_get(args, 't')) == NULL) |
if ((target = args_get(args, 't')) != NULL) { |
|
if (groupwith == NULL) { |
|
cmdq_error(cmdq, "no such session: %s", target); |
|
goto error; |
|
} |
|
} else |
groupwith = NULL; |
groupwith = NULL; |
|
|
/* Set -d if no client. */ |
/* Set -d if no client. */ |
|
|
already_attached = 1; |
already_attached = 1; |
|
|
/* Get the new session working directory. */ |
/* Get the new session working directory. */ |
to_free = NULL; |
|
if (args_has(args, 'c')) { |
if (args_has(args, 'c')) { |
ft = format_create(cmdq, 0); |
ft = format_create(cmdq, 0); |
format_defaults(ft, c, NULL, NULL, NULL); |
format_defaults(ft, c, NULL, NULL, NULL); |
|
|
if (!args_has(args, 't') && args->argc != 0) { |
if (!args_has(args, 't') && args->argc != 0) { |
argc = args->argc; |
argc = args->argc; |
argv = args->argv; |
argv = args->argv; |
} else if (target == NULL) { |
} else if (groupwith == NULL) { |
cmd = options_get_string(global_s_options, "default-command"); |
cmd = options_get_string(global_s_options, "default-command"); |
if (cmd != NULL && *cmd != '\0') { |
if (cmd != NULL && *cmd != '\0') { |
argc = 1; |
argc = 1; |
|
|
* If a target session is given, this is to be part of a session group, |
* If a target session is given, this is to be part of a session group, |
* so add it to the group and synchronize. |
* so add it to the group and synchronize. |
*/ |
*/ |
if (args_has(args, 't')) { |
if (groupwith != NULL) { |
session_group_add(groupwith, s); |
session_group_add(groupwith, s); |
session_group_synchronize_to(s); |
session_group_synchronize_to(s); |
session_select(s, RB_MIN(winlinks, &s->windows)->idx); |
session_select(s, RB_MIN(winlinks, &s->windows)->idx); |