Subject: bin/18823: systat io/numbers micalculates how many drives per row
To: None <gnats-bugs@gnats.netbsd.org>
From: Paul Shupak <paul@fsrv.plectere.com>
List: netbsd-bugs
Date: 10/26/2002 20:31:35
>Number:         18823
>Category:       bin
>Synopsis:       systat io/numbers micalculates how many drives per row
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 26 20:32:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul Shupak
>Release:        NetBSD 1.6J - today
>Organization:
>Environment:
System: NetBSD fsrv 1.6J NetBSD 1.6J (FSRV) #264: Sat Oct 26 17:03:28 PDT 2002 root@fsrv:/usr/src/sys/arch/i386/compile/FSRV i386
Architecture: i386
Machine: i386
>Description:
	The corner if the window is (0,0) based which gives us the "+1"
	instead of a "-1" AND we don't need a trailing space for the last
	column giving us "+2"
	e.g. if ( getmaxx(wnd) == 79 ) then wnd is 80 characters wide.
>How-To-Repeat:
	% systat io
	:number

	Test with at least three disks and window widths of 41, 42, and 43
	characters at least 20 lines ( xterm makes this easy to see ).
>Fix:
Index: iostat.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/systat/iostat.c,v
retrieving revision 1.22
diff -c -r1.22 iostat.c
*** iostat.c	2002/09/25 13:50:39	1.22
--- iostat.c	2002/10/27 03:28:37
***************
*** 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) + 2) / COLWIDTH)
  	for (ndrives = 0, i = 0; i < dk_ndrive; i++)
  		if (cur.dk_select[i])
  			ndrives++;
***************
>Release-Note:
>Audit-Trail:
>Unformatted: