Bug 63198

Summary: sysctl_ctx_init.9 example code: 'name' parameters not quoted
Product: Documentation Reporter: Rebecca Cran <bcran>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Rebecca Cran freebsd_committer freebsd_triage 2004-02-22 00:50:33 UTC
The sysctl_ctx_init man page has an example which won't compile,
because the newtree, newint and newstring parameters should be strings, but are
used without quotation marks.

Fix: 

sysctl_ctx_init(&clist);
 oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */),
-       OID_AUTO, newtree, CTFLAG_RW, 0, "new top level tree");
+       OID_AUTO, "newtree", CTFLAG_RW, 0, "new top level tree");
 oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp),
-       OID_AUTO, newint, CTLFLAG_RW, &a_int, 0, "new int leaf");
+       OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf");
  ...
 oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_debug),
-       OID_AUTO, newtree, CTFLAG_RW, 0, "new tree under debug");
+       OID_AUTO, "newtree", CTFLAG_RW, 0, "new tree under debug");
 oidp = SYSCTL_ADD_STRING( &clist, SYSCTL_CHILDREN(oidp),
-       OID_AUTO, newstring, CTLFLAG_R, string, 0, "new string leaf");
+       OID_AUTO, "newstring", CTLFLAG_R, string, 0, "new string leaf");
  ...
 /* Now we can free up the oids */
 if(sysctl_ctx_free(&clist)) {--ejhTRlc87VjTN1BDmZVOxTwiEXgE4es1jQcut6WHhkmE2lxo
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- /usr/src/share/man/man9/sysctl_ctx_init.9   Wed Jan  9 11:43:48 2002
+++ sysctl_ctx_init.9   Sun Feb 22 00:35:20 2004
@@ -192,14 +192,14 @@
How-To-Repeat: 'man sysctl_ctx_init'
Comment 1 Peter Pentchev freebsd_committer freebsd_triage 2004-06-03 11:21:06 UTC
State Changed
From-To: open->closed

This was actually fixed by Mark Murray in rev. 1.11 of sysctl_ctx_init.9. 
Still, thanks for the problem report!