summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authornicm <nicm>2013-10-10 12:29:35 +0000
committernicm <nicm>2013-10-10 12:29:35 +0000
commitc1ccefc62d2a70c91ac31cff141031d61cc0a12c (patch)
tree924a96d6a8d0f1fe0e98e1ad8c6bb9af6bf2be27 /tmux.c
parent6ac7abe8f038c21c1cf33d50a02e970f0de81c09 (diff)
We accidentally haven't been using $TMUX to work out the session for a
while and in fact it is less useful that using the client ttyname. So don't bother and don't pass it from the client. If we need it in future it is in c->environ.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/tmux.c b/tmux.c
index a78746ae..74d827a5 100644
--- a/tmux.c
+++ b/tmux.c
@@ -49,11 +49,8 @@ time_t start_time;
char socket_path[MAXPATHLEN];
int login_shell;
char *environ_path;
-pid_t environ_pid = -1;
-int environ_session_id = -1;
__dead void usage(void);
-void parseenvironment(void);
char *makesocketpath(const char *);
__dead void
@@ -124,23 +121,6 @@ areshell(const char *shell)
return (0);
}
-void
-parseenvironment(void)
-{
- char *env, path[256];
- long pid;
- int id;
-
- if ((env = getenv("TMUX")) == NULL)
- return;
-
- if (sscanf(env, "%255[^,],%ld,%d", path, &pid, &id) != 3)
- return;
- environ_path = xstrdup(path);
- environ_pid = pid;
- environ_session_id = id;
-}
-
char *
makesocketpath(const char *label)
{
@@ -223,7 +203,9 @@ main(int argc, char **argv)
{
struct passwd *pw;
char *s, *path, *label, *home, **var, tmp[MAXPATHLEN];
- int opt, flags, quiet, keys;
+ char in[256];
+ long long pid;
+ int opt, flags, quiet, keys, session;
#ifdef DEBUG
malloc_options = (char *) "AFGJPX";
@@ -351,11 +333,15 @@ main(int argc, char **argv)
}
}
+ /* Get path from environment. */
+ s = getenv("TMUX");
+ if (s != NULL && sscanf(s, "%255[^,],%lld,%d", in, &pid, &session) == 3)
+ environ_path = xstrdup(in);
+
/*
* Figure out the socket path. If specified on the command-line with -S
* or -L, use it, otherwise try $TMUX or assume -L default.
*/
- parseenvironment();
if (path == NULL) {
/* If no -L, use the environment. */
if (label == NULL) {