From owner-freebsd-bugs@FreeBSD.ORG Fri Dec 9 00:50:04 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2165916A41F for ; Fri, 9 Dec 2005 00:50:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2586743D77 for ; Fri, 9 Dec 2005 00:50:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jB90o3Df023123 for ; Fri, 9 Dec 2005 00:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jB90o35g023120; Fri, 9 Dec 2005 00:50:03 GMT (envelope-from gnats) Resent-Date: Fri, 9 Dec 2005 00:50:03 GMT Resent-Message-Id: <200512090050.jB90o35g023120@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Marius Nuennerich" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B1F516A41F for ; Fri, 9 Dec 2005 00:42:13 +0000 (GMT) (envelope-from marius.nuennerich@gmx.net) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id BDBC843D80 for ; Fri, 9 Dec 2005 00:42:11 +0000 (GMT) (envelope-from marius.nuennerich@gmx.net) Received: (qmail invoked by alias); 09 Dec 2005 00:42:09 -0000 Received: from p5083CC37.dip0.t-ipconnect.de (EHLO sol.hackerzberg.local) [80.131.204.55] by mail.gmx.net (mp028) with SMTP; 09 Dec 2005 01:42:09 +0100 Message-Id: <1134088929.0@sol.hackerzberg.local> Date: Fri, 9 Dec 2005 01:42:09 +0100 From: "Marius Nuennerich" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.4.6 Cc: marius.nuennerich@gmx.net Subject: bin/90130: [patch] sysctl(8): print temperature in celsius only when -h is specified X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2005 00:50:04 -0000 >Number: 90130 >Category: bin >Synopsis: [patch] sysctl(8): print temperature in celsius only when -h is specified >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 09 00:50:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Marius Nuennerich >Release: FreeBSD 7-CURRENT >Organization: >Environment: >Description: By defaul sysctl(8) prints values in human-readable format only if -h is specified and machine-readable format otherwise. IMO this should be true for temperature values also. >How-To-Repeat: >Fix: --- sysctl.diff begins here --- diff -ru current-20051202/sbin/sysctl/sysctl.c current/sbin/sysctl/sysctl.c --- current-20051202/sbin/sysctl/sysctl.c Fri Dec 2 21:52:57 2005 +++ current/sbin/sysctl/sysctl.c Tue Dec 6 14:52:18 2005 @@ -580,7 +580,7 @@ if(*fmt == 'U') printf(hflag ? "%'u" : "%u", *(unsigned int *)p); else if (*fmt == 'K') { - if (*(int *)p < 0) + if ((*(int *)p < 0) || !hflag) printf("%d", *(int *)p); else printf("%d.%dC", (*(int *)p - 2732) / 10, (*(int *)p - 2732) % 10); @@ -602,7 +602,7 @@ if(*fmt == 'U') printf(hflag ? "%'lu" : "%lu", *(unsigned long *)p); else if (*fmt == 'K') { - if (*(long *)p < 0) + if ((*(long *)p < 0) || !hflag) printf("%ld", *(long *)p); else printf("%ld.%ldC", (*(long *)p - 2732) / 10, (*(long *)p - 2732) % 10); --- sysctl.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: