Diff

Differences From Artifact [d1718088de]:

To Artifact [43854d99e9]:


1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







.TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "@PACKAGE_STRING@"
.SH NAME
lc_register_callback \- Register a function for callback in config processing.

.SH SYNOPSIS
.B #include <libconfig.h>
.sp
.BI "int lc_register_callback(const char *" var ", char " opt ", lc_var_type_t " type ", int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *" extra);
.BI "int lc_register_callback(const char *" var ", char " opt ", lc_var_type_t " type ", int (*" callback ")(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *" extra ");"

.SH DESCRIPTION
The
.BR lc_register_callback (3)
function registers a function to be called when
.IR var
is encounted in a configuration file, command line, or environment variable.
152
153
154
155
156
157
158
159

160
161
162
163
164
165
166
152
153
154
155
156
157
158

159
160
161
162
163
164
165
166







-
+







.TP
LC_CBRET_ERROR
Returnning LC_CBRET_ERROR from a callback indicates that the command failed for some reason, the error will be passed back down the chain back to the
.BR lc_process (3)
call that began processing the configuration data.  If LC_CBRET_ERROR is returned from a callback that begins a section, the entire section is ignored.


 "RETURN VALUE"
.SH "RETURN VALUE"
On success 0 is returned, otherwise -1 is returned.

.SH EXAMPLE
.nf
#include <libconfig.h>
#include <strings.h>
#include <stdlib.h>
221
222
223
224
225
226
227
228

229
221
222
223
224
225
226
227

228








-
+
-
.B ENOMEM
Memory could not be allocated to create the needed internal structures.

.SH "SEE ALSO"
.BR lc_register_var (3),
.BR lc_geterrno (3),
.BR lc_geterrstr (3),
.BR lc_process (3),
.BR lc_process (3)
.BR lc_register_var (3)