fix pasto: don't print the critcap when the warncap was asked. Also off by

one in length. From Anon-Ymous.
XXX: Should pull up to 5.0
This commit is contained in:
christos 2009-04-04 18:43:01 +00:00
parent 88ada6d2b7
commit 9587268219

View File

@ -1,4 +1,4 @@
/* $NetBSD: envstat.c,v 1.71 2009/02/14 16:08:22 ahoka Exp $ */ /* $NetBSD: envstat.c,v 1.72 2009/04/04 18:43:01 christos Exp $ */
/*- /*-
* Copyright (c) 2007, 2008 Juan Romero Pardines. * Copyright (c) 2007, 2008 Juan Romero Pardines.
@ -27,7 +27,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: envstat.c,v 1.71 2009/02/14 16:08:22 ahoka Exp $"); __RCSID("$NetBSD: envstat.c,v 1.72 2009/04/04 18:43:01 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdio.h> #include <stdio.h>
@ -990,9 +990,9 @@ do { \
ilen = 16 + 1; ilen = 16 + 1;
} }
if (sensor->warncap_value) { if (sensor->warncap_value) {
ilen = 24 + 2; ilen = 24 + 2 - 1;
(void)printf("%*.2f%% ", (int)ilen, (void)printf("%*.2f%% ", (int)ilen,
(sensor->critcap_value * 100.0) / (sensor->warncap_value * 100.0) /
sensor->max_value); sensor->max_value);
ilen = 8; ilen = 8;
} }
@ -1015,7 +1015,7 @@ do { \
} }
if (sensor->critcap_value) { if (sensor->critcap_value) {
ilen = 24 + 2; ilen = 24 + 2 - 1;
(void)printf("%*.2f%% ", (int)ilen, (void)printf("%*.2f%% ", (int)ilen,
(sensor->critcap_value * 100.0) / (sensor->critcap_value * 100.0) /
sensor->max_value); sensor->max_value);