Subject: bin/33712: top(1) print uptime twice on dump terminal (-current)
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <njoly@pasteur.fr>
List: netbsd-bugs
Date: 06/13/2006 08:05:00
>Number:         33712
>Category:       bin
>Synopsis:       top(1) print uptime twice on dump terminal (-current)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 13 08:05:00 +0000 2006
>Originator:     Nicolas Joly
>Release:        NetBSD 3.99.21
>Organization:
Institut Pasteur, Paris.
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 3.99.21 NetBSD 3.99.21 (LANFEUST) #1: Fri Jun 9 11:51:44 CEST 2006 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
I recently noticed that -current top(1) print duplicated uptime field on
dump terminal (it works fine on a smart one).

njoly@lanfeust [~]> top | head -n 1
load averages: 10.73, 10.68, 10.63    up 3 days, 21:52    up 3 days, 21:52   09:51:03

>How-To-Repeat:
top | head -n 1
>Fix:
With the following patch, output look better :
njoly@lanfeust [~]> top | head -n 1
load averages: 10.73, 10.70, 10.66    up 3 days, 22:01   09:59:21

Index: usr.bin/top/display.c
===================================================================
RCS file: /cvsroot/src/usr.bin/top/display.c,v
retrieving revision 1.14
diff -u -r1.14 display.c
--- usr.bin/top/display.c	3 Oct 2005 05:34:51 -0000	1.14
+++ usr.bin/top/display.c	13 Jun 2006 07:51:05 -0000
@@ -310,7 +310,7 @@
     }
     else
     {
-	fprintf(stdout, "    %s    ", up);
+	printf("    ");
     }
 #ifdef DEBUG
     {