diff options
author | jhb <jhb@FreeBSD.org> | 2010-11-02 12:40:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-11-02 12:40:13 +0000 |
commit | 8c8cb8e58a701769f45596db89749c030b743514 (patch) | |
tree | 3d6151d88047e476fd6d842875bde189436bc899 /share/man/man9/sysctl_ctx_init.9 | |
parent | 5eb5cf6b6a4fe590f978f0826411ad225294e6eb (diff) | |
download | FreeBSD-src-8c8cb8e58a701769f45596db89749c030b743514.zip FreeBSD-src-8c8cb8e58a701769f45596db89749c030b743514.tar.gz |
Fix a few typos and style nits in the example code.
Submitted by: Arnaud Lacombe lacombar of gmail
MFC after: 3 days
Diffstat (limited to 'share/man/man9/sysctl_ctx_init.9')
-rw-r--r-- | share/man/man9/sysctl_ctx_init.9 | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/share/man/man9/sysctl_ctx_init.9 b/share/man/man9/sysctl_ctx_init.9 index ba8c7f2..f17ca3a 100644 --- a/share/man/man9/sysctl_ctx_init.9 +++ b/share/man/man9/sysctl_ctx_init.9 @@ -188,27 +188,27 @@ This example uses contexts to keep track of the oids. 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 |