From ef3645617753f62bdc5f10b6dca344db8f41bab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 8 Sep 2014 21:03:10 +0200 Subject: [PATCH] Do not display hostname suffix in session listing Trying to attach to an existing session with its hostname does not work, therefore avoid confusion and do not display it. --- abduco.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/abduco.c b/abduco.c index 4871e28..ef74e03 100644 --- a/abduco.c +++ b/abduco.c @@ -448,7 +448,7 @@ static int list_session() { int n = scandir(sockaddr.sun_path, &namelist, session_filter, session_comparator); if (n < 0) return 1; - puts("Active sessions"); + printf("Active sessions (on host %s)\n", server.host+1); while (n--) { struct stat sb; char buf[255]; if (stat(namelist[n]->d_name, &sb) == 0 && S_ISSOCK(sb.st_mode)) { @@ -458,6 +458,9 @@ static int list_session() { status = '*'; else if (sb.st_mode & S_IXGRP) status = '+'; + char *name = strstr(namelist[n]->d_name, server.host); + if (name) + *name = '\0'; printf("%c %s\t%s\n", status, buf, namelist[n]->d_name); } free(namelist[n]);