bin/112556: [patch]: [bin]: sysctl(8) needs to fix multi-lineal descriptions

Ighighi ighighi at gmail.com
Wed May 9 23:10:04 UTC 2007


>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 at 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:


More information about the freebsd-bugs mailing list