Revision: 2654
          http://tmux.svn.sourceforge.net/tmux/?rev=2654&view=rev
Author:   tcunha
Date:     2011-12-30 14:21:02 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
Sync OpenBSD patchset 993:

Allow $HOME as default-path in tmux.conf so the same config file can be used
on different machines regardless of where the user's home directory is.
ok nicm

Modified Paths:
--------------
    trunk/cmd.c
    trunk/tmux.1

Modified: trunk/cmd.c
===================================================================
--- trunk/cmd.c 2011-12-30 14:19:21 UTC (rev 2653)
+++ trunk/cmd.c 2011-12-30 14:21:02 UTC (rev 2654)
@@ -1220,11 +1220,18 @@
        char                    *cwd;
        struct session          *s;
        struct window_pane      *wp;
+       struct environ_entry    *envent;
 
        if ((s = cmd_current_session(ctx, 0)) == NULL)
                return (NULL);
 
        cwd = options_get_string(&s->options, "default-path");
+       if ((cwd[0] == '~' && cwd[1] == '\0') || !strcmp(cwd, "$HOME")) {
+               envent = environ_find(&global_environ, "HOME");
+               if (envent != NULL && *envent->value != '\0')
+                       return envent->value;
+               cwd = "";
+       }
        if (*cwd == '\0') {
                if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
                        return (ctx->cmdclient->cwd);

Modified: trunk/tmux.1
===================================================================
--- trunk/tmux.1        2011-12-30 14:19:21 UTC (rev 2653)
+++ trunk/tmux.1        2011-12-30 14:21:02 UTC (rev 2654)
@@ -1849,6 +1849,11 @@
 If empty (the default), the working directory is determined from the process
 running in the active pane, from the command line environment or from the
 working directory where the session was created.
+If
+.Ar path
+is "$HOME" or "~", the value of the
+.Ev HOME
+environment variable is used.
 .It Ic default-shell Ar path
 Specify the default shell.
 This is used as the login shell for new windows when the

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to