Subject: bin/3431: bugfix for systat (swap.c)
To: None <gnats-bugs@gnats.netbsd.org>
From: Paul Boven <paul@wit387304.student.utwente.nl>
List: netbsd-bugs
Date: 04/01/1997 16:26:42
>Number:         3431
>Category:       bin
>Synopsis:       The swap-usage-bar would only go up, not down.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr  1 06:35:01 1997
>Last-Modified:
>Originator:     Paul Boven
>Organization:
----------------------------------------------------------------------
Paul Boven, <e.p.boven@student.utwente.nl>  PE1NUT  QRV 145.575 JO32KF
          Lynx users have a "Right to follow a link", too!
----------------------------------------------------------------------
>Release:        NetBSD-current usr.bin/systat/swap.c 1-apr-97
>Environment:
System: NetBSD wit387304.student.utwente.nl 1.2C NetBSD 1.2C (ELC) #12: Thu Feb 27 09:09:06 CET 1997 paul@wit387304.student.utwente.nl:/usr/src/sys/arch/sparc/compile/ELC sparc

>Description:
When using the swap display of systat to monitor VM-usage, the XXX-bar will
only grow, but not decrease again. The numeric values are reported correctly,
though. This problem occurs because the line on which the bar is drawn is
not cleared before it's redrawn again. Although a shorter bar is printed,
the remainder of previous (longer) bars is not overwritten.
>How-To-Repeat:
Start systat in the swap mode (either by entering :swap or giving swap as 
argument when starting systat). Start some VM-hungry applications. The
XXX-bar will increase. End those applications again: the numbers for VM-
usage will decrease again, but the bar will stay at it's maximum length.
>Fix:
Clear the line with the bar on it before redrawing the bar.

*** swap.c.orig	Tue Apr  1 16:13:17 1997
--- swap.c	Tue Apr  1 15:52:46 1997
***************
*** 242,247 ****
--- 242,248 ----
  		xfree = perdev[i];
  		used = xsize - xfree;
  		mvwprintw(wnd, i + 1, col, "%9d  ", used / div);
+ 		wclrtoeol(wnd);
  		for (j = (100 * used / xsize + 1) / 2; j > 0; j--)
  			waddch(wnd, 'X');
  		npfree++;
>Audit-Trail:
>Unformatted: