From 65b9aeb33707e9663ac594b872ab33b9a78d7daa Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 4 Mar 2009 17:24:07 +0000 Subject: Put socket path in $TMUX. --- server-fn.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index a1e0c714..c2bb00f1 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.55 2009-02-27 16:01:31 nicm Exp $ */ +/* $Id: server-fn.c,v 1.56 2009-03-04 17:24:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -26,6 +26,23 @@ int server_lock_callback(void *, const char *); +const char ** +server_fill_environ(struct session *s) +{ + static const char *env[] = { NULL /* TMUX= */, "TERM=screen", NULL }; + static char *tmuxvar[MAXPATHLEN + 256]; + u_int idx; + + if (session_index(s, &idx) != 0) + fatalx("session not found"); + + xsnprintf(tmuxvar, sizeof tmuxvar, + "TMUX=%s,%ld,%u", socket_path, (long) getpid(), idx); + env[0] = tmuxvar; + + return (env); +} + void server_write_client( struct client *c, enum hdrtype type, const void *buf, size_t len) -- cgit