Date: Tue, 2 Nov 2010 12:40:13 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214673 - head/share/man/man9 Message-ID: <201011021240.oA2CeD0l045636@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Nov 2 12:40:13 2010 New Revision: 214673 URL: http://svn.freebsd.org/changeset/base/214673 Log: Fix a few typos and style nits in the example code. Submitted by: Arnaud Lacombe lacombar of gmail MFC after: 3 days Modified: head/share/man/man9/sysctl_ctx_init.9 Modified: head/share/man/man9/sysctl_ctx_init.9 ============================================================================== --- head/share/man/man9/sysctl_ctx_init.9 Tue Nov 2 09:31:24 2010 (r214672) +++ head/share/man/man9/sysctl_ctx_init.9 Tue Nov 2 12:40:13 2010 (r214673) @@ -188,27 +188,27 @@ This example uses contexts to keep track struct sysctl_ctx_list clist; struct sysctl_oid *oidp; int a_int; -char *string = "dynamic sysctl"; +const char *string = "dynamic sysctl"; ... sysctl_ctx_init(&clist); -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new top level tree"); -oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp), +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(/* tree top */), + OID_AUTO, "newtree", CTLFLAG_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"); ... -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_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"); +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(_debug), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug"); +oidp = SYSCTL_ADD_STRING(&clist, SYSCTL_CHILDREN(oidp), + OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf"); ... /* Now we can free up the oids */ -if(sysctl_ctx_free(&clist)) { +if (sysctl_ctx_free(&clist)) { printf("can't free this context - other oids depend on it"); - return(ENOTEMPTY); + return (ENOTEMPTY); } else { - printf("Success!\\n"): - return(0); + printf("Success!\\n"); + return (0); } .Ed .Pp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011021240.oA2CeD0l045636>