Changes To Manual for lc_process_file

Changes to "Manual for lc_process_file" between 2014-11-24 20:10:46 and 2014-11-24 20:11:49

            1  +<H2>NAME</H2>
            2  +lc_process_file - Process a specific file
            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_process_file(const char *</B><I>appname</I><B>, const char *</B><I>pathname</I><B>, lc_conf_type_t </B><I>type</I><B>);</B>
            9  +<P>
           10  +<A NAME="lbAD">&nbsp;</A>
           11  +<H2>DESCRIPTION</H2>
           12  +The
           13  +<B><A HREF="wiki/Manual for lc_process_file">lc_process_file</A></B>(3)
           14  +function processes exactly one configuration file.  The file is specified by the
           15  +<I>pathname</I>
           16  +argument and should be in the format specified by the
           17  +<I>type</I>
           18  +argument.  The
           19  +<I>appname</I>
           20  +argument should be a reasonable form of the name of the application.
           21  +<P>
           22  +<A NAME="lbAE">&nbsp;</A>
           23  +<H2>RETURN VALUE</H2>
           24  +On success 0 is returned, otherwise -1 is returned.
           25  +<P>
           26  +<A NAME="lbAF">&nbsp;</A>
           27  +<H2>EXAMPLE</H2>
           28  +<PRE>
           29  +#include &lt;<A HREF="artifact/7c61a9805e664fde7943807af8d5e164e7cebdb6">libconfig.h</A>&gt;
           30  +#include &lt;<A HREF="file:/usr/include/stdlib.h">stdlib.h</A>&gt;
           31  +#include &lt;<A HREF="file:/usr/include/stdio.h">stdio.h</A>&gt;
           32  +int main(int argc, char **argv) {
           33  +        int lc_p_ret, lc_rv_ret;
           34  +        char *filename = NULL;
           35  +        lc_rv_ret = lc_register_var(&quot;File&quot;, LC_VAR_STRING,
           36  +                                    &amp;filename, 'f');
           37  +        if (lc_rv_ret != 0) {
           38  +                fprintf(stderr, &quot;Error registering variable: %i.\n&quot;,
           39  +                        lc_geterrno());
           40  +                return(EXIT_FAILURE);
           41  +        }
           42  +        lc_p_ret = lc_process_file(&quot;example&quot;, &quot;/data/extra.conf&quot;,
           43  +                                   LC_CONF_APACHE);
           44  +        lc_cleanup();
           45  +        if (lc_p_ret != 0) {
           46  +                fprintf(stderr, &quot;Error processing configuration file: \
           47  +                        %s\n&quot;, lc_geterrstr());
           48  +                return(EXIT_FAILURE);
           49  +        }
           50  +        if (filename != NULL) {
           51  +                printf(&quot;File specified was: %s\n&quot;, filename);
           52  +        } else {
           53  +                printf(&quot;No filename specified.\n&quot;);
           54  +        }
           55  +        return(EXIT_SUCCESS);
           56  +}
           57  +</PRE>
           58  +<P>
           59  +<A NAME="lbAG">&nbsp;</A>
           60  +<H2>SEE ALSO</H2>
           61  +<B><A HREF="wiki/Manual">libconfig</A></B>(3),
           62  +<B><A HREF="wiki/Manual for lc_register_var">lc_register_var</A></B>(3),
           63  +<B><A HREF="wiki/Manual for lc_register_callback">lc_register_callback</A></B>(3),
           64  +<B><A HREF="wiki/Manual for lc_geterrno">lc_geterrno</A></B>(3),
           65  +<B><A HREF="wiki/Manual for lc_geterrstr">lc_geterrstr</A></B>(3),
           66  +<B><A HREF="wiki/Manual for lc_seterrstr">lc_seterrstr</A></B>(3),
           67  +<B><A HREF="wiki/Manual for lc_handle_type">lc_handle_type</A></B>(3),
           68  +<B><A HREF="wiki/Manual for lc_process">lc_process</A></B>(3),
           69  +<B><A HREF="wiki/Manual for lc_cleanup">lc_cleanup</A></B>(3)
           70  +<P>