mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Fix a few typos and style nits in the example code.
Submitted by: Arnaud Lacombe lacombar of gmail MFC after: 3 days
This commit is contained in:
parent
82d2b37bc0
commit
bd19a23baa
1 changed files with 12 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue