]> granicus.if.org Git - procps-ng/commitdiff
Remove trailing - from w from column
authorCraig Small <csmall@enc.com.au>
Wed, 25 Apr 2012 00:21:07 +0000 (10:21 +1000)
committerCraig Small <csmall@enc.com.au>
Wed, 25 Apr 2012 00:21:07 +0000 (10:21 +1000)
Jaromir Capik discovered that the from column for w would print
a trailing - for some types of hosts.

w.c

diff --git a/w.c b/w.c
index 03cf983f4e9b7eaee806a86fe7cf060188c7b6ea..4ca84debcd13008f6360542849e83630fd90e557 100644 (file)
--- a/w.c
+++ b/w.c
@@ -82,6 +82,7 @@ static void print_host(const char *restrict host, int len, const int fromlen)
                len = fromlen;
        last = host + len;
        for (; host < last; host++) {
+           if (*host == '\0') break;
                if (isprint(*host) && *host != ' ') {
                        fputc(*host, stdout);
                        ++width;