18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
.SH DESCRIPTION
Libconfig is a library to provide easy access to configuration data in a consistent and logical manner. Variables (registered through
.BR lc_register_var (3)
or
.BR lc_register_callback (3))
are processed with the
.BR lc_process (3)
function. Errors can be examined through
.BR lc_geterrno (3)
and
.BR lc_geterrstr (3).
.SH EXAMPLE
.nf
#include <libconfig.h>
#include <stdlib.h>
#include <stdio.h>
|
>
>
|
>
>
>
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
.SH DESCRIPTION
Libconfig is a library to provide easy access to configuration data in a consistent and logical manner. Variables (registered through
.BR lc_register_var (3)
or
.BR lc_register_callback (3))
are processed with the
.BR lc_process (3)
and
.BR lc_process_file (3)
functions. Errors can be examined through
.BR lc_geterrno (3)
and
.BR lc_geterrstr (3).
Clean-up may be performed using the
.BR lc_cleanup (3)
function.
.SH EXAMPLE
.nf
#include <libconfig.h>
#include <stdlib.h>
#include <stdio.h>
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
fprintf(stderr, "Error registering variable: %i.\\n",
lc_geterrno());
return(EXIT_FAILURE);
}
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
NULL);
if (lc_p_ret != 0) {
fprintf(stderr, "Error processing configuration: \\
%s\\n", lc_geterrstr());
return(EXIT_FAILURE);
}
if (filename != NULL) {
|
>
>
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
fprintf(stderr, "Error registering variable: %i.\\n",
lc_geterrno());
return(EXIT_FAILURE);
}
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
NULL);
lc_cleanup();
if (lc_p_ret != 0) {
fprintf(stderr, "Error processing configuration: \\
%s\\n", lc_geterrstr());
return(EXIT_FAILURE);
}
if (filename != NULL) {
|
65
66
67
68
69
70
71
72
|
.fi
.SH "SEE ALSO"
.BR lc_register_var (3),
.BR lc_register_callback (3),
.BR lc_geterr (3),
.BR lc_geterrstr (3),
.BR lc_process (3)
|
>
|
>
|
72
73
74
75
76
77
78
79
80
81
|
.fi
.SH "SEE ALSO"
.BR lc_register_var (3),
.BR lc_register_callback (3),
.BR lc_geterr (3),
.BR lc_geterrstr (3),
.BR lc_cleanup (3),
.BR lc_process (3),
.BR lc_process_file (3)
|