version 1.51, 2013/10/10 12:00:21 |
version 1.52, 2013/10/10 12:07:36 |
|
|
|
|
const struct cmd_entry cmd_new_session_entry = { |
const struct cmd_entry cmd_new_session_entry = { |
"new-session", "new", |
"new-session", "new", |
"AdDF:n:Ps:t:x:y:", 0, 1, |
"Ac:dDF:n:Ps:t:x:y:", 0, 1, |
"[-AdDP] [-F format] [-n window-name] [-s session-name] " |
"[-AdDP] [-c start-directory] [-F format] [-n window-name] " |
CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]", |
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] [-y height] " |
|
"[command]", |
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, |
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, |
NULL, |
NULL, |
cmd_new_session_exec |
cmd_new_session_exec |
|
|
struct environ env; |
struct environ env; |
struct termios tio, *tiop; |
struct termios tio, *tiop; |
struct passwd *pw; |
struct passwd *pw; |
const char *newname, *target, *update, *cwd, *errstr; |
const char *newname, *target, *update, *base, *cwd; |
const char *template; |
const char *errstr, *template; |
char *cmd, *cause, *cp; |
char *cmd, *cause, *cp; |
int detached, idx; |
int detached, idx; |
u_int sx, sy; |
u_int sx, sy; |
|
|
|
|
/* Get the new session working directory. */ |
/* Get the new session working directory. */ |
if (c != NULL && c->cwd != NULL) |
if (c != NULL && c->cwd != NULL) |
cwd = c->cwd; |
base = c->cwd; |
else { |
else { |
pw = getpwuid(getuid()); |
pw = getpwuid(getuid()); |
if (pw->pw_dir != NULL && *pw->pw_dir != '\0') |
if (pw->pw_dir != NULL && *pw->pw_dir != '\0') |
cwd = pw->pw_dir; |
base = pw->pw_dir; |
else |
else |
cwd = "/"; |
base = "/"; |
} |
} |
|
if (args_has(args, 'c')) |
|
cwd = args_get(args, 'c'); |
|
else |
|
cwd = options_get_string(&global_s_options, "default-path"); |
|
cwd = cmd_default_path(base, base, cwd); |
|
|
/* Find new session size. */ |
/* Find new session size. */ |
if (c != NULL) { |
if (c != NULL) { |