Subject: bin/16911: systat -iostat w/ :numbers options has annoying layout errors
To: None <gnats-bugs@gnats.netbsd.org>
From: None <paul@plectere.com>
List: netbsd-bugs
Date: 05/19/2002 16:06:40
>Number:         16911
>Category:       bin
>Synopsis:       systat -iostat w/ :numbers options has annoying layout errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 19 16:08:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul Shupak
>Release:        NetBSD 1.5ZC today, and for many years back
>Organization:
>Environment:
System: NetBSD fsrv 1.5ZC NetBSD 1.5ZC (FSRV) #94: Sat May 18 10:57:22 PDT 2002 root@fsrv:/usr/src/sys/arch/i386/compile/FSRV i386
Architecture: i386
Machine: i386
>Description:
	The calculation of drive information per line of output is different
for the code which draws the headers and the code which draws the numbers,
and is actually incorrect for both!
>How-To-Repeat:
	% systat -iostat
	:numbers^M
	On any system with enough devices to give two or more 'rows' (as
	the variable is used in the code) of output ( i.e. you can also
	use a narrow xterm or other terminal emulator to test with just
	a few drives ).
>Fix:
	Change the three incorrect lines.

*** iostat.c	Sun May 19 15:47:15 2002
--- iostat.c-ORIG	Mon Jan 28 05:20:43 2002
***************
*** 129,135 ****
  	int i, col, regions, ndrives;
  
  #define COLWIDTH	14
! #define DRIVESPERLINE	((getmaxx(wnd) + 1) / COLWIDTH)
  	for (ndrives = 0, i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i])
  			ndrives++;
--- 129,135 ----
  	int i, col, regions, ndrives;
  
  #define COLWIDTH	14
! #define DRIVESPERLINE	((getmaxx(wnd) - INSET) / COLWIDTH)
  	for (ndrives = 0, i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i])
  			ndrives++;
***************
*** 147,153 ****
  	col = 0;
  	for (i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH > getmaxx(wnd) ) {
  				col = 0, row += linesperregion + 1;
  				if (row > getmaxy(wnd) - (linesperregion + 1))
  					break;
--- 147,153 ----
  	col = 0;
  	for (i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH >= getmaxx(wnd) - INSET) {
  				col = 0, row += linesperregion + 1;
  				if (row > getmaxy(wnd) - (linesperregion + 1))
  					break;
***************
*** 221,227 ****
  	winsertln(wnd);
  	for (i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH > getmaxx(wnd)) {
  				col = 0, row += linesperregion + 1;
  				if (row > getmaxy(wnd) - (linesperregion + 1))
  					break;
--- 221,227 ----
  	winsertln(wnd);
  	for (i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
! 			if (col + COLWIDTH >= getmaxx(wnd)) {
  				col = 0, row += linesperregion + 1;
  				if (row > getmaxy(wnd) - (linesperregion + 1))
  					break;
>Release-Note:
>Audit-Trail:
>Unformatted: