Subject: bin/30680: [patch] iostat - always show header in extended mode
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Peter Schuller <peter.schuller@infidyne.com>
List: netbsd-bugs
Date: 07/06/2005 21:49:00
>Number:         30680
>Category:       bin
>Synopsis:       iostat - always show header in extended mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 06 21:49:00 +0000 2005
>Originator:     Peter Schuller <peter.schuller@infidyne.com>
>Release:        NetBSD 2.0.2_BETA
>Organization:
	
>Environment:
	
	
System: NetBSD scode.mine.nu 2.0.2_BETA NetBSD 2.0.2_BETA (PROMETHEUS) #2: Thu Mar 24 21:18:12 CET 2005 toor@prometheus.scode.org:/usr/obj/sys/arch/i386/compile/PROMETHEUS i386
Architecture: i386
Machine: i386
>Description:
	'iostat -x' is very nice when monitoring many disks, but the output
        would be a lot more 'pleasing' to the eye if it would print the
        header at each update instead of just when deemed necessary. Currently
        there is a tendency to constantly have to search for the header
        when monitoring continously. This becomes distracting with many disks
        because the location of the header on screen becomes quite erradic.
>How-To-Repeat:

>Fix:

I propose the following patch to make iostat print headers for each update when
running in extended mode.

Index: iostat.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/iostat/iostat.c,v
retrieving revision 1.42
diff -u -r1.42 iostat.c
--- iostat.c	25 Feb 2004 03:39:14 -0000	1.42
+++ iostat.c	6 Jul 2005 21:39:26 -0000
@@ -214,7 +214,9 @@
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
-		if (do_header || ((hdrcnt -= lines) <= 0)) {
+		if (do_header ||
+		    ((hdrcnt -= lines) <= 0) ||
+		    ISSET(todo, SHOW_STATS_X)) {
 			do_header = 0;
 			header();
 			if ((hdrcnt -= lines) <= 0)

>Unformatted: