version 1.3, 2009/08/08 21:52:43 |
version 1.4, 2009/08/13 19:04:00 |
|
|
/* 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, const char *cwd, |
struct environ *env, u_int sx, u_int sy, char **cause) |
struct environ *env, struct termios *tio, u_int sx, u_int sy, char **cause) |
{ |
{ |
struct session *s; |
struct session *s; |
u_int i; |
u_int i; |
|
|
environ_init(&s->environ); |
environ_init(&s->environ); |
if (env != NULL) |
if (env != NULL) |
environ_copy(env, &s->environ); |
environ_copy(env, &s->environ); |
|
memcpy(&s->tio, tio, sizeof s->tio); |
|
|
s->sx = sx; |
s->sx = sx; |
s->sy = sy; |
s->sy = sy; |
|
|
|
|
/* 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, const char *cwd, int idx, char **cause) |
const char *name, const char *cmd, const char *cwd, int idx, char **cause) |
{ |
{ |
struct window *w; |
struct window *w; |
|
|
server_fill_environ(s, &env); |
server_fill_environ(s, &env); |
|
|
hlimit = options_get_number(&s->options, "history-limit"); |
hlimit = options_get_number(&s->options, "history-limit"); |
w = window_create(name, cmd, cwd, &env, s->sx, s->sy, hlimit, cause); |
w = window_create( |
|
name, cmd, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause); |
if (w == NULL) { |
if (w == NULL) { |
environ_free(&env); |
environ_free(&env); |
return (NULL); |
return (NULL); |