diff options
author | njl <njl@FreeBSD.org> | 2006-07-25 02:28:43 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2006-07-25 02:28:43 +0000 |
commit | bfbd4eba2ca39d4edbffc1e9d71be57e2cf46997 (patch) | |
tree | 1d3872b2bd925248324c9d565ccfe20765aef05a /sbin | |
parent | 7a331053aa4454cffac4492b604af2b7b1faf60f (diff) | |
download | FreeBSD-src-bfbd4eba2ca39d4edbffc1e9d71be57e2cf46997.zip FreeBSD-src-bfbd4eba2ca39d4edbffc1e9d71be57e2cf46997.tar.gz |
Fix printing of negative decimal values in Kelvin to Celsius conversion.
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 = " "; |