abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit ef3645617753f62bdc5f10b6dca344db8f41bab8
parent b2f2dc810d7078865c9e14fe019ddb3b7d024f49
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon,  8 Sep 2014 21:03:10 +0200

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.

Diffstat:
abduco.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 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]);