aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-10 19:37:35 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-10 19:37:35 +0000
commit4d711648263372e06928d1c495efb220c7b804d3 (patch)
treeba1fd7a3ce506332abad9d3e4101fd03b5e69b9d /tmux.c
parent88ab74ac20ad96771a9f06667da666bf85cd3f23 (diff)
downloadrtmux-4d711648263372e06928d1c495efb220c7b804d3.tar.gz
rtmux-4d711648263372e06928d1c495efb220c7b804d3.tar.bz2
rtmux-4d711648263372e06928d1c495efb220c7b804d3.zip
Pick up cwd from environment,.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tmux.c b/tmux.c
index ada0bb4a..64d50743 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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;