]> granicus.if.org Git - procps-ng/commitdiff
w: eliminate inappropriate cmdline padding with spaces
authorJim Warner <james.warner@comcast.net>
Sun, 6 Sep 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Mon, 7 Sep 2015 08:11:48 +0000 (18:11 +1000)
This commit is an outgrowth of the research into a bug
involving the recently added enum 'PROCPS_PIDS_extra'.

The WHAT portion of output is being padded with spaces
since the printf field width format specifier was used
in combination with a precision specifier. This commit
reduces the format string to just that precision part.

Signed-off-by: Jim Warner <james.warner@comcast.net>
w.c

diff --git a/w.c b/w.c
index 16828dd13f7649402557dbcba22a00b5b1a59159..2130ce1f2606ec54615c31d617866f00d6b0866a 100644 (file)
--- a/w.c
+++ b/w.c
@@ -488,7 +488,7 @@ static void showinfo(
         else
             print_time_ival7(idletime(tty), 0, stdout);
     }
-    printf(" %-*.*s\n", maxcmd, maxcmd, cmdline);
+    printf(" %.*s\n", maxcmd, cmdline);
 }
 
 static void __attribute__ ((__noreturn__))