Subject: bin/5933: rup -d screws up output
To: None <gnats-bugs@gnats.netbsd.org>
From: Tim Rightnour <root@polaris.garbled.net>
List: netbsd-bugs
Date: 08/08/1998 08:26:03
>Number:         5933
>Category:       bin
>Synopsis:       rup -d screws up output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug  8 08:35:01 1998
>Last-Modified:
>Originator:     Tim Rightnour
>Organization:
Tim Rightnour    -  root@garbled.net
http://www.zynetwc.com/~garbled/garbled.html
>Release:        1.3<NetBSD-current source date>
>Environment:
	
System: NetBSD polaris 1.3 NetBSD 1.3 (POLARIS) #0: Thu Mar 26 13:17:18 MST 1998 root@polaris:/usr/src/sys/arch/i386/compile/POLARIS i386


>Description:
rup -d wraps on an 80 column screen width.  Seeing as this is pretty much
the standard with for screens out there.. this is highly annoying..

[/usr/src/pkgsrc/tim] polaris# rup
polaris                  up   2 days,   6:25,  load average: 1.21 1.26 1.44
[/usr/src/pkgsrc/tim] polaris# rup -d
polaris                   8:22am up   2 days,   6:32,  load average: 1.08 1.13 1.30

	
>How-To-Repeat:
invoke rup -d on a 80 column wide display.. Notice how the -d option makes
the output wrap around the screen in a very ugly fashion.
	
>Fix:
The below patch does not make the load average columns end at the same point
they do with the standard rup output.  The fix for that would be to change
HOST_WIDTH from 24 to 27, or discard this patch and change HOST_WIDTH to
20.

--- rup.c.orig	Sat Aug  8 08:12:47 1998
+++ rup.c	Sat Aug  8 08:17:43 1998
@@ -212,3 +212,6 @@
 
-	printf("%-*.*s", HOST_WIDTH, HOST_WIDTH, host);
+	if (printtime)
+		printf("%-*.*s", HOST_WIDTH-4, HOST_WIDTH-4, host);
+	else
+		printf("%-*.*s", HOST_WIDTH, HOST_WIDTH, host);
 


	
>Audit-Trail:
>Unformatted: