Module Name: src
Committed By: njoly
Date: Tue Jul 27 12:40:49 UTC 2010
Modified Files:
src/bin/ps: print.c
Log Message:
Make %cpu drop the decimal part when reaching 100%, to stay in the 5
expected columns.
To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/bin/ps/print.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.113 src/bin/ps/print.c:1.114
--- src/bin/ps/print.c:1.113 Mon May 31 03:18:33 2010
+++ src/bin/ps/print.c Tue Jul 27 12:40:48 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.113 2010/05/31 03:18:33 rmind Exp $ */
+/* $NetBSD: print.c,v 1.114 2010/07/27 12:40:48 njoly Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-__RCSID("$NetBSD: print.c,v 1.113 2010/05/31 03:18:33 rmind Exp $");
+__RCSID("$NetBSD: print.c,v 1.114 2010/07/27 12:40:48 njoly Exp $");
#endif
#endif /* not lint */
@@ -1087,10 +1087,12 @@
{
struct kinfo_proc2 *k;
VAR *v;
+ double dbl;
k = arg;
v = ve->var;
- doubleprintorsetwidth(v, getpcpu(k), 1, mode);
+ dbl = getpcpu(k);
+ doubleprintorsetwidth(v, dbl, (dbl >= 100.0) ? 0 : 1, mode);
}
double