| version 1.7, 2002/09/02 16:01:56 |
version 1.8, 2002/09/03 20:11:16 |
|
|
| |
|
| <programlisting> |
<programlisting> |
| struct <structname>cfg_option</structname> { |
struct <structname>cfg_option</structname> { |
| const char <structfield>*cmdline_long_name</structfield>; |
const char *<structfield>cmdline_long_name</structfield>; |
| const char <structfield>cmdline_short_name</structfield>; |
const char <structfield>cmdline_short_name</structfield>; |
| const char <structfield>*cfgfile_name</structfield>; |
const char *<structfield>cfgfile_name</structfield>; |
| const enum cfg_option_type <structfield>type</structfield>; |
const enum cfg_option_type <structfield>type</structfield>; |
| void <structfield>*value</structfield>; |
void <structfield>*value</structfield>; |
| int <structfield>val</structfield>; |
int <structfield>val</structfield>; |
| Line 48 struct <structname>cfg_option</structnam |
|
| Line 48 struct <structname>cfg_option</structnam |
|
| |
|
| First two members of <structname>cfg_option</structname> structure, |
First two members of <structname>cfg_option</structname> structure, |
| <structfield>cmdline_long_name</structfield> and |
<structfield>cmdline_long_name</structfield> and |
| <structfield>cmdline_short_name</structfield> concert to command line. They |
<structfield>cmdline_short_name</structfield> concern to command line. They |
| specify command line long name and short name. Configuration file option name |
specify command line long name and short name. Configuration file option name is |
| is specified by third structure member <structfield>cfgfile_name</structfield>. |
specified by third structure member <structfield>cfgfile_name</structfield>. |
| Fields <structfield>cmdline_long_name</structfield> and |
Fields <structfield>cmdline_long_name</structfield> and |
| <structfield>cfgfile_name</structfield> are strings (pointers to char) and may |
<structfield>cfgfile_name</structfield> are strings (pointers to char) and may |
| be <constant>NULL</constant>, what means undefined. Field |
be <constant>NULL</constant>, what means undefined. Field |
| Line 60 be <constant>NULL</constant>, what means |
|
| Line 60 be <constant>NULL</constant>, what means |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Next structure member <structfield>type</structfield> specify an option type |
Note that, any whitespace you will use in |
| |
<structfield>cmdline_long_name</structfield> or |
| |
<structfield>cfgfile_name</structfield> will match any non-zero amount of |
| |
whitespaces during parsing. For example if separator is one space, also tab will |
| |
match, two or more spaces too, etc. This is feature for icreasing simplicity of |
| |
your application confiration, because users must not pay attention to number of |
| |
spaces used in configurarion option. In example "debug level", "debug\tlevel" |
| |
and "debug \tlevel" will match the same configuration option. |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
Next structure member <structfield>type</structfield> defines an option type |
| with option type flags. They are summarized in the <xref |
with option type flags. They are summarized in the <xref |
| linkend="usage.option-types.table" endterm="usage.option-types.table.title"> |
linkend="usage.option-types.table" endterm="usage.option-types.table.title"> and |
| and <xref linkend="usage.option-type-flags.table" |
<xref linkend="usage.option-type-flags.table" |
| endterm="usage.option-type-flags.table.title"> tables. |
endterm="usage.option-type-flags.table.title"> tables. |
| |
|
| The <structfield>value</structfield> member tells the address where option |
The <structfield>value</structfield> member tells the address where option |
| Line 89 idea to keep these values positive to pr |
|
| Line 101 idea to keep these values positive to pr |
|
| <tbody> |
<tbody> |
| <row> |
<row> |
| <entry><constant>CFG_BOOL</constant>, <constant>CFG_BOOLEAN</constant></entry> |
<entry><constant>CFG_BOOL</constant>, <constant>CFG_BOOLEAN</constant></entry> |
| <entry>int</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> int</entry> |
| <entry>Boolean datatype with two states. No argument for an option is expected.</entry> |
<entry>No argument for an option is expected. Boolean datatype with two states.</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_INT</constant>, <constant>CFG_INTEGER</constant></entry> |
<entry><constant>CFG_INT</constant>, <constant>CFG_INTEGER</constant></entry> |
| <entry>int</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> int</entry> |
| <entry>Integer argument.</entry> |
<entry>Integer argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_UINT</constant>, <constant>CFG_UNSIGNED</constant>, |
<entry><constant>CFG_UINT</constant>, <constant>CFG_UNSIGNED</constant>, |
| <constant>CFG_UNSIGNED_INT</constant></entry> |
<constant>CFG_UNSIGNED_INT</constant></entry> |
| <entry>unsigned int</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> unsigned int</entry> |
| <entry>Unsigned integer argument.</entry> |
<entry>Unsigned integer argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_LONG</constant></entry> |
<entry><constant>CFG_LONG</constant></entry> |
| <entry>long int</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> long int</entry> |
| <entry>Long integer argument.</entry> |
<entry>Long integer argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_ULONG</constant>, |
<entry><constant>CFG_ULONG</constant>, |
| <constant>CFG_UNSIGNED_LONG</constant></entry> |
<constant>CFG_UNSIGNED_LONG</constant></entry> |
| <entry>unsigned long int</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> unsigned long int</entry> |
| <entry>Unsigned long integer argument.</entry> |
<entry>Unsigned long integer argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_FLOAT</constant></entry> |
<entry><constant>CFG_FLOAT</constant></entry> |
| <entry>float</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> float</entry> |
| <entry>Float argument.</entry> |
<entry>Float argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_DOUBLE</constant></entry> |
<entry><constant>CFG_DOUBLE</constant></entry> |
| <entry>double</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> double</entry> |
| <entry>Double argument.</entry> |
<entry>Double argument</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry><constant>CFG_STR</constant>, <constant>CFG_STRING</constant></entry> |
<entry><constant>CFG_STR</constant>, <constant>CFG_STRING</constant></entry> |
| <entry>char *</entry> |
<entry><!-- MAN: <structfield>value</structfield> type: --> char *</entry> |
| <entry>String argument.</entry> |
<entry>String argument</entry> |
| </row> |
</row> |
| </tbody> |
</tbody> |
| </tgroup> |
</tgroup> |