diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-03-27 11:24:18 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-03-27 11:24:18 +0000 |
commit | 7f636587098593c6c0efd3feaecb970aa7170116 (patch) | |
tree | 093dc694d8fe475ef8a834ef9762af551f11d669 /tmux.c | |
parent | 5e4d9a3197a229ecb30d51f5b7e6756ef31dc1d2 (diff) | |
download | rtmux-7f636587098593c6c0efd3feaecb970aa7170116.tar.gz rtmux-7f636587098593c6c0efd3feaecb970aa7170116.tar.bz2 rtmux-7f636587098593c6c0efd3feaecb970aa7170116.zip |
Add TMUX_TMPDIR variable to put the socket directory outside
TMPDIR. From Ben Boeckel.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -164,10 +164,12 @@ makesocketpath(const char *label) u_int uid; uid = getuid(); - if ((s = getenv("TMPDIR")) == NULL || *s == '\0') - xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid); - else + if ((s = getenv("TMUX_TMPDIR")) != NULL && *s != '\0') + xsnprintf(base, sizeof base, "%s/", s); + else if ((s = getenv("TMPDIR")) != NULL && *s != '\0') xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid); + else + xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid); if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) return (NULL); @@ -244,15 +246,10 @@ main(int argc, char **argv) quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-'); - while ((opt = getopt(argc, argv, "28c:Cdf:lL:qS:uUv")) != -1) { + while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) { switch (opt) { case '2': flags |= IDENTIFY_256COLOURS; - flags &= ~IDENTIFY_88COLOURS; - break; - case '8': - flags |= IDENTIFY_88COLOURS; - flags &= ~IDENTIFY_256COLOURS; break; case 'c': free(shell_cmd); |