diff options
author | peter <peter@FreeBSD.org> | 2004-08-30 22:42:10 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-08-30 22:42:10 +0000 |
commit | 78508cab2611f6e60cfba0bb7d5314c1fd36f4b3 (patch) | |
tree | fd875ecd0f029e04db0d14f296346ccddb9c183a /sbin/sysctl | |
parent | 5d5c60a5a5df72be519b696ae8824430d1560d72 (diff) | |
download | FreeBSD-src-78508cab2611f6e60cfba0bb7d5314c1fd36f4b3.zip FreeBSD-src-78508cab2611f6e60cfba0bb7d5314c1fd36f4b3.tar.gz |
Add a suffix descriptor for the acpi thermal values as a hint for the userland
sysctl tool to print a more readable value for temperatures.
Diffstat (limited to 'sbin/sysctl')
-rw-r--r-- | sbin/sysctl/sysctl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index efa8825..85621e0 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -563,7 +563,12 @@ show_var(int *oid, int nlen) fputs(val, stdout); if(*fmt == 'U') printf(hflag ? "%'u" : "%u", *(unsigned int *)p); - else + else if (*fmt == 'K') { + if (*(int *)p < 0) + printf("%d", *(int *)p); + else + printf("%d.%dC", (*(int *)p - 2732) / 10, (*(int *)p - 2732) % 10); + } else printf(hflag ? "%'d" : "%d", *(int *)p); val = " "; len -= sizeof(int); @@ -580,7 +585,12 @@ show_var(int *oid, int nlen) fputs(val, stdout); if(*fmt == 'U') printf(hflag ? "%'lu" : "%lu", *(unsigned long *)p); - else + else if (*fmt == 'K') { + if (*(long *)p < 0) + printf("%ld", *(long *)p); + else + printf("%ld.%ldC", (*(long *)p - 2732) / 10, (*(long *)p - 2732) % 10); + } else printf(hflag ? "%'ld" : "%ld", *(long *)p); val = " "; len -= sizeof(long); |