From bfbd4eba2ca39d4edbffc1e9d71be57e2cf46997 Mon Sep 17 00:00:00 2001 From: njl Date: Tue, 25 Jul 2006 02:28:43 +0000 Subject: Fix printing of negative decimal values in Kelvin to Celsius conversion. MFC after: 3 days --- sbin/sysctl/sysctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sbin/sysctl') diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index aaffc19..a1ef11c 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -583,7 +583,9 @@ show_var(int *oid, int nlen) if (*(int *)p < 0) printf("%d", *(int *)p); else - printf("%d.%dC", (*(int *)p - 2732) / 10, (*(int *)p - 2732) % 10); + printf("%d.%dC", + (*(int *)p - 2732) / 10, + abs((*(int *)p - 2732) % 10)); } else printf(hflag ? "%'d" : "%d", *(int *)p); val = " "; @@ -605,7 +607,9 @@ show_var(int *oid, int nlen) if (*(long *)p < 0) printf("%ld", *(long *)p); else - printf("%ld.%ldC", (*(long *)p - 2732) / 10, (*(long *)p - 2732) % 10); + printf("%ld.%ldC", + (*(long *)p - 2732) / 10, + abs((*(long *)p - 2732) % 10)); } else printf(hflag ? "%'ld" : "%ld", *(long *)p); val = " "; -- cgit v1.1