summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-10 09:53:12 +1100
committerDamien Miller <djm@mindrot.org>2003-01-10 09:53:12 +1100
commita8ed44b79e6dd78d7871b0fb8149951b54662ef5 (patch)
treecca59d396ec59133ec1c42536eca25d087dcfcc7 /session.c
parent13b2e55c36ec316bd4ec15e830c9eae888d2cb68 (diff)
- (djm) Enable new setproctitle emulation for Linux, AIX and HP/UX. More
systems may be added later.
Diffstat (limited to 'session.c')
-rw-r--r--session.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/session.c b/session.c
index c16cdcc1..812681d0 100644
--- a/session.c
+++ b/session.c
@@ -2002,13 +2002,22 @@ session_tty_list(void)
{
static char buf[1024];
int i;
+ char *cp;
+
buf[0] = '\0';
for (i = 0; i < MAX_SESSIONS; i++) {
Session *s = &sessions[i];
if (s->used && s->ttyfd != -1) {
+
+ if (strncmp(s->tty, "/dev/", 5) != 0) {
+ cp = strrchr(s->tty, '/');
+ cp = (cp == NULL) ? s->tty : cp + 1;
+ } else
+ cp = s->tty + 5;
+
if (buf[0] != '\0')
strlcat(buf, ",", sizeof buf);
- strlcat(buf, strrchr(s->tty, '/') + 1, sizeof buf);
+ strlcat(buf, cp, sizeof buf);
}
}
if (buf[0] == '\0')