Changes To Manual
            1  +<H2>NAME</H2>
            2  +libconfig - Consistent configuration library.
            3  +<P>
            4  +<A NAME="lbAC">&nbsp;</A>
            5  +<H2>SYNOPSIS</H2>
            6  +<B>#include &lt;<A HREF="artifact/7c61a9805e664fde7943807af8d5e164e7cebdb6">libconfig.h</A>&gt;</B>
            7  +<P>
            8  +<B>int lc_register_callback(const char *</B><I>var</I><B>, char </B><I>opt</I><B>, lc_var_type_t </B><I>type</I><B>, int (*</B><I>callback</I><B>)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *</B><I>extra</I><B>);</B>
            9  +<P>
           10  +<B>int lc_register_var(const char *</B><I>var</I><B>, lc_var_type_t </B><I>type</I><B>, void *</B><I>data</I><B>, char </B><I>opt</I><B>);</B>
           11  +<P>
           12  +<B>int lc_process(int </B><I>argc</I><B>, char **</B><I>argv</I><B>, const char *</B><I>appname</I><B>, lc_conf_type_t </B><I>type</I><B>, const char *</B><I>extra</I><B>);</B>
           13  +<P>
           14  +<B>lc_err_t lc_geterrno(void);</B>
           15  +<P>
           16  +<B>char *lc_geterrstr(void);</B>
           17  +<P>
           18  +<B>void lc_seterrstr(const char *</B><I>errstr</I><B>);</B>
           19  +<P>
           20  +<B>int lc_handle_type(lc_var_type_t </B><I>type</I><B>, const char *</B><I>value</I><B>, void *</B><I>data</I><B>);</B>
           21  +<P>
           22  +<B>void lc_cleanup(void);</B>
           23  +<P>
           24  +<A NAME="lbAD">&nbsp;</A>
           25  +<H2>DESCRIPTION</H2>
           26  +Libconfig is a library to provide easy access to configuration data in a consistent and logical manner.  Variables (registered through
           27  +<B><A HREF="wiki/Manual for lc_register_var">lc_register_var</A></B>(3)
           28  +or
           29  +<B><A HREF="wiki/Manual for lc_register_callback">lc_register_callback</A></B>(3))
           30  +are processed with the
           31  +<B><A HREF="wiki/Manual for lc_process">lc_process</A></B>(3)
           32  +and
           33  +<B><A HREF="wiki/Manual for lc_process_file">lc_process_file</A></B>(3)
           34  +functions.  Errors can be examined through
           35  +<B><A HREF="wiki/Manual for lc_geterrno">lc_geterrno</A></B>(3)
           36  +and
           37  +<B><A HREF="wiki/Manual for lc_geterrstr">lc_geterrstr</A></B>(3).
           38  +Clean-up may be performed using the
           39  +<B><A HREF="wiki/Manual for lc_cleanup">lc_cleanup</A></B>(3)
           40  +function.
           41  +<P>
           42  +<A NAME="lbAE">&nbsp;</A>
           43  +<H2>EXAMPLE</H2>
           44  +<PRE>
           45  +#include &lt;<A HREF="artifact/7c61a9805e664fde7943807af8d5e164e7cebdb6">libconfig.h</A>&gt;
           46  +#include &lt;<A HREF="file:/usr/include/stdlib.h">stdlib.h</A>&gt;
           47  +#include &lt;<A HREF="file:/usr/include/stdio.h">stdio.h</A>&gt;
           48  +int main(int argc, char **argv) {
           49  +        int lc_p_ret, lc_rv_ret;
           50  +        char *filename = NULL;
           51  +        lc_rv_ret = lc_register_var(&quot;File&quot;, LC_VAR_STRING,
           52  +                                    &amp;filename, 'f');
           53  +        if (lc_rv_ret != 0) {
           54  +                fprintf(stderr, &quot;Error registering variable: %i.\n&quot;,
           55  +                        lc_geterrno());
           56  +                return(EXIT_FAILURE);
           57  +        }
           58  +        lc_p_ret = lc_process(argc, argv, &quot;example&quot;, LC_CONF_APACHE,
           59  +                              NULL);
           60  +        lc_cleanup();
           61  +        if (lc_p_ret != 0) {
           62  +                fprintf(stderr, &quot;Error processing configuration: \
           63  +                        %s\n&quot;, lc_geterrstr());
           64  +                return(EXIT_FAILURE);
           65  +        }
           66  +        if (filename != NULL) {
           67  +                printf(&quot;File specified was: %s\n&quot;, filename);
           68  +        } else {
           69  +                printf(&quot;No filename specified.\n&quot;);
           70  +        }
           71  +        return(EXIT_SUCCESS);
           72  +}
           73  +</PRE>
           74  +<P>
           75  +<A NAME="lbAF">&nbsp;</A>
           76  +<H2>SEE ALSO</H2>
           77  +<B><A HREF="wiki/Manual for lc_register_var">lc_register_var</A></B>(3),
           78  +<B><A HREF="wiki/Manual for lc_register_callback">lc_register_callback</A></B>(3),
           79  +<B><A HREF="wiki/Manual for lc_geterrno">lc_geterrno</A></B>(3),
           80  +<B><A HREF="wiki/Manual for lc_geterrstr">lc_geterrstr</A></B>(3),
           81  +<B><A HREF="wiki/Manual for lc_seterrstr">lc_seterrstr</A></B>(3),
           82  +<B><A HREF="wiki/Manual for lc_handle_type">lc_handle_type</A></B>(3),
           83  +<B><A HREF="wiki/Manual for lc_process">lc_process</A></B>(3),
           84  +<B><A HREF="wiki/Manual for lc_process_file">lc_process_file</A></B>(3),
           85  +<B><A HREF="wiki/Manual for lc_cleanup">lc_cleanup</A></B>(3)
           86  +<P>