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

10
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.90 2009-01-10 19:35:40 nicm Exp $ */
/* $Id: tmux.c,v 1.91 2009-01-10 19:37:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -178,7 +178,7 @@ main(int argc, char **argv)
const char *shell;
struct passwd *pw;
char *path, *cause, *home;
char rpath[MAXPATHLEN];
char rpath[MAXPATHLEN], cwd[MAXPATHLEN];
int n, opt, flags;
flags = 0;
@ -305,6 +305,12 @@ main(int argc, char **argv)
&global_options, "default-command", "exec %s", shell);
if (getcwd(cwd, sizeof cwd) == NULL) {
log_warn("getcwd");
exit(1);
}
options_set_string(&global_options, "default-path", "%s", cwd);
if (argc == 0) {
cmd = xmalloc(sizeof *cmd);
cmd->entry = &cmd_new_session_entry;