summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-18 15:20:36 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-18 15:20:36 -0500
commit23b17abd7a9f00894f820eeba824623940d26a38 (patch)
treeb5c5d87e8878c1e25b489d534d72866737872d88
parentb7d33bdc3cc3d60cd23410372f908a8fb5b5a728 (diff)
downloadscreen-23b17abd7a9f00894f820eeba824623940d26a38.tar.gz
Exclude the PID when expanding $STY.
Excluding the PID from the expansion of $STY makes it possible to do, e.g. 'source screenrc-$STY' to load session-specific commands. If the PID is desired, for some reason, then '$PID.$STY' should be used instead.
-rw-r--r--src/process.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c
index 3ea86cb..e131384 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4694,7 +4694,12 @@ int bufl, *argl;
else if (!strcmp(ps, "PID"))
sprintf(xbuf, "%d", getpid());
else if (!strcmp(ps, "STY"))
- v = SockName;
+ {
+ if ((v = strchr(SockName, '.'))) /* Skip the PID */
+ v++;
+ else
+ v = SockName;
+ }
else
v = getenv(ps);
}