diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-10 19:37:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-10 19:37:35 +0000 |
commit | 4d711648263372e06928d1c495efb220c7b804d3 (patch) | |
tree | ba1fd7a3ce506332abad9d3e4101fd03b5e69b9d /cmd-new-session.c | |
parent | 88ab74ac20ad96771a9f06667da666bf85cd3f23 (diff) |
Pick up cwd from environment,.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index 32bb94b4..711e0776 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-session.c,v 1.32 2008-12-10 20:25:41 nicm Exp $ */ +/* $Id: cmd-new-session.c,v 1.33 2009-01-10 19:37:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -113,7 +113,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_new_session_data *data = self->data; struct client *c = ctx->cmdclient; struct session *s; - char *cmd, *cause; + char *cmd, *cwd, *cause; u_int sx, sy; if (ctx->curclient != NULL) @@ -138,6 +138,10 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) cmd = data->cmd; if (cmd == NULL) cmd = options_get_string(&global_options, "default-command"); + if (c == NULL || c->cwd == NULL) + cwd = options_get_string(&global_options, "default-path"); + else + cwd = c->cwd; sx = 80; sy = 25; @@ -160,8 +164,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) } - if ((s = session_create(data->newname, cmd, sx, sy)) == NULL) - fatalx("session_create failed"); + if ((s = session_create(data->newname, cmd, cwd, sx, sy)) == NULL) + fatalx("session_create failed"); if (data->winname != NULL) { xfree(s->curw->window->name); s->curw->window->name = xstrdup(data->winname); |