version 1.1.1.1, 2017/01/24 14:48:55
|
version 1.1.1.2, 2021/03/17 00:49:17
|
Line 1
|
Line 1
|
<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>8. Functions</title><link rel="stylesheet" type="text/css" href="tutorial.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="libConfuse tutorial" /><link rel="up" href="index.html" title="libConfuse tutorial" /><link rel="prev" href="ar01s07.html" title="7. Value parsing callback" /><link rel="next" href="ar01s09.html" title="9. Saving configuration files" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8. Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s09.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="idm138"></a>8. Functions</h2></div></div></div><p> |
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>8. Functions</title><link rel="stylesheet" href="tutorial.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="libConfuse tutorial" /><link rel="up" href="index.html" title="libConfuse tutorial" /><link rel="prev" href="ar01s07.html" title="7. Value parsing callback" /><link rel="next" href="ar01s09.html" title="9. Saving configuration files" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8. Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s09.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="8. Functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id442474"></a>8. Functions</h2></div></div></div><p> | |
libConfuse supports functions to parse options that does not fit |
libConfuse supports functions to parse options that does not fit |
well in the general syntax. Functions can be called with a variable |
well in the general syntax. Functions can be called with a variable |
number of arguments. No data from the function or any arguments are |
number of arguments. No data from the function or any arguments are |
Line 14
|
Line 13
|
typedef int (*cfg_func_t)(cfg_t *cfg, cfg_opt_t *opt, |
typedef int (*cfg_func_t)(cfg_t *cfg, cfg_opt_t *opt, |
int argc, const char **argv); |
int argc, const char **argv); |
</pre><p> |
</pre><p> |
</p><div class="sect2" title="8.1. Predefined functions"><div class="titlepage"><div><div><h3 class="title"><a id="id442506"></a>8.1. Predefined functions</h3></div></div></div><p> | </p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="idm145"></a>8.1. Predefined functions</h3></div></div></div><p> |
Currently there is only one pre-defined function: |
Currently there is only one pre-defined function: |
<code class="function">cfg_include()</code>. This function includes |
<code class="function">cfg_include()</code>. This function includes |
another configuration file. Configuration data is immediately |
another configuration file. Configuration data is immediately |
Line 32 cfg_opt_t opts[] = {
|
Line 31 cfg_opt_t opts[] = {
|
In the configuration file, it is used in the following way: |
In the configuration file, it is used in the following way: |
</p><pre class="programlisting"> |
</p><pre class="programlisting"> |
include("included.conf") |
include("included.conf") |
</pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. Value parsing callback </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Saving configuration files</td></tr></table></div></body></html> | </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. Value parsing callback </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Saving configuration files</td></tr></table></div></body></html> |
|
|