]> granicus.if.org Git - procps-ng/commitdiff
w: fixing missing '-' in the FROM field when empty
authorJaromir Capik <jcapik@redhat.com>
Mon, 2 Mar 2015 17:41:07 +0000 (18:41 +0100)
committerJaromir Capik <jcapik@redhat.com>
Mon, 2 Mar 2015 17:41:07 +0000 (18:41 +0100)
With 99bebff06a058f1ebf794fca1b358d0df73fdd35 a configurable
width of the FROM column was introduced. Unfortunately this
caused a regression in the dash printing. Hopefully fixed
with this commit.

w.c

diff --git a/w.c b/w.c
index e04137d35138b7920b6f122b045ad514191bce8e..4c8a6193d929319e66b732bc5430706975ef9ef3 100644 (file)
--- a/w.c
+++ b/w.c
@@ -100,6 +100,10 @@ static void print_host(const char *restrict host, int len, const int fromlen)
         * space-fill, and a '-' too if needed to ensure the
         * column exists
         */
+       if (!width) {
+               fputc('-', stdout);
+               ++width;
+       }
        while (width++ < fromlen)
                fputc(' ', stdout);
 }