Pick up cwd from environment,.

This commit is contained in:
Nicholas Marriott
2009-01-10 19:37:35 +00:00
parent 88ab74ac20
commit 4d71164826
13 changed files with 86 additions and 40 deletions

View File

@ -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);