Date: Wed, 9 May 2007 22:56:12 GMT From: Ighighi<ighighi@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/112556: [patch]: [bin]: sysctl(8) needs to fix multi-lineal descriptions Message-ID: <200705092256.l49MuCps029435@www.freebsd.org> Resent-Message-ID: <200705092310.l49NA3ut089804@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 112556
>Category: bin
>Synopsis: [patch]: [bin]: sysctl(8) needs to fix multi-lineal descriptions
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed May 09 23:10:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Ighighi
>Release: 6.2-STABLE
>Organization:
>Environment:
FreeBSD orion 6.2-STABLE FreeBSD 6.2-STABLE #1: Sat May 5 10:13:59 VET 2007 root@orion:/usr/obj/usr/src/sys/CUSTOM i386
>Description:
This patch to sysctl(8) makes it handle multi-lineal descriptions (currently found in hw.pci.enable_io_modes, hw.pci.do_power_nodriver, hw.pci.host_mem_start & hw.pci.irq_override_mask) so they appear on just one line. A patch to the PCI files available upon request but other modules that I didn't load could have multi-line descriptions as well, so patching sysctl(8) is necessary.
>How-To-Repeat:
/sbin/sysctl -d hw.pci.enable_io_modes hw.pci.do_power_nodriver hw.pci.host_mem_start hw.pci.irq_override_mask
>Fix:
Attached patch available.
Patch attached with submission follows:
--- sbin/sysctl/sysctl.c.orig Wed Mar 21 21:27:09 2007
+++ sbin/sysctl/sysctl.c Sat May 5 09:21:16 2007
@@ -568,11 +568,16 @@
sep = ": ";
if (dflag) { /* just print description */
+ char *s = buf;
+
qoid[1] = 5;
j = sizeof(buf);
i = sysctl(qoid, nlen + 2, buf, &j, 0, 0);
if (!nflag)
printf("%s%s", name, sep);
+ /* fix multilineal descriptions */
+ while ((s = strchr(s, '\n')) != NULL)
+ *s++ = ' ';
printf("%s", buf);
return (0);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705092256.l49MuCps029435>
