version 1.40, 2013/10/10 11:58:24 |
version 1.41, 2013/10/10 12:26:36 |
|
|
|
|
/* Create a new session. */ |
/* Create a new session. */ |
struct session * |
struct session * |
session_create(const char *name, const char *cmd, const char *cwd, |
session_create(const char *name, const char *cmd, int cwd, struct environ *env, |
struct environ *env, struct termios *tio, int idx, u_int sx, u_int sy, |
struct termios *tio, int idx, u_int sx, u_int sy, char **cause) |
char **cause) |
|
{ |
{ |
struct session *s; |
struct session *s; |
|
|
|
|
fatal("gettimeofday failed"); |
fatal("gettimeofday failed"); |
session_update_activity(s); |
session_update_activity(s); |
|
|
s->cwd = xstrdup(cwd); |
s->cwd = dup(cwd); |
|
|
s->curw = NULL; |
s->curw = NULL; |
TAILQ_INIT(&s->lastw); |
TAILQ_INIT(&s->lastw); |
|
|
winlink_remove(&s->windows, wl); |
winlink_remove(&s->windows, wl); |
} |
} |
|
|
free(s->cwd); |
close(s->cwd); |
|
|
RB_INSERT(sessions, &dead_sessions, s); |
RB_INSERT(sessions, &dead_sessions, s); |
} |
} |
|
|
|
|
/* Create a new window on a session. */ |
/* Create a new window on a session. */ |
struct winlink * |
struct winlink * |
session_new(struct session *s, |
session_new(struct session *s, const char *name, const char *cmd, int cwd, |
const char *name, const char *cmd, const char *cwd, int idx, char **cause) |
int idx, char **cause) |
{ |
{ |
struct window *w; |
struct window *w; |
struct winlink *wl; |
struct winlink *wl; |
|
|
shell = _PATH_BSHELL; |
shell = _PATH_BSHELL; |
|
|
hlimit = options_get_number(&s->options, "history-limit"); |
hlimit = options_get_number(&s->options, "history-limit"); |
w = window_create( |
w = window_create(name, cmd, shell, cwd, &env, s->tio, s->sx, s->sy, |
name, cmd, shell, cwd, &env, s->tio, s->sx, s->sy, hlimit, cause); |
hlimit, cause); |
if (w == NULL) { |
if (w == NULL) { |
winlink_remove(&s->windows, wl); |
winlink_remove(&s->windows, wl); |
environ_free(&env); |
environ_free(&env); |