| version 1.11, 2002/10/07 10:54:40 |
version 1.12, 2003/08/16 14:06:06 |
|
|
| <!-- $Platon: usage.error-codes.sgml,v 1.9 2002/09/02 15:01:06 nepto Exp $ --> |
<!-- $Platon: libcfg+/doc/sgml/usage.error-codes.sgml,v 1.11 2002/10/07 10:54:40 rajo Exp $ --> |
| |
|
| <!-- MAN: |
<!-- MAN: |
| <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ |
|
|
| <!-- MAN: <refsect1><title>SYNOPSIS</title> --> |
<!-- MAN: <refsect1><title>SYNOPSIS</title> --> |
| <para> |
<para> |
| |
|
| These functions are used for manipulation with &name; errors. Parsing context |
The information about the last occurred error is stored within the context in |
| (<structname>cfg_context</structname>) itself remembers last occured error in |
the <structname>CFG_CONTEXT</structname> structure. The following functions |
| internal data structures. |
provide a convenient interface for interpreting, querying and printing that |
| |
information. |
| |
|
| <funcsynopsis> |
<funcsynopsis> |
| <funcsynopsisinfo><![CDATA[#include <cfg+.h>]]></funcsynopsisinfo> |
<funcsynopsisinfo><![CDATA[#include <cfg+.h>]]></funcsynopsisinfo> |
| Line 62 internal data structures. |
|
| Line 63 internal data structures. |
|
| <!-- MAN: </refsect1><refsect1><title>DESCRIPTION</title> --> |
<!-- MAN: </refsect1><refsect1><title>DESCRIPTION</title> --> |
| <para> |
<para> |
| |
|
| Function <function>cfg_print_error()</function> prints error message of last |
The function <function>cfg_print_error()</function> prints an error message |
| occured error. Similar function <function>cfg_fprint_error()</function> prints |
describing the last error. To print the message to the specified stream, use |
| error message to specified stream, which must be passed as second parameter |
<function>cfg_fprint_error()</function>, which takes a stream pointer |
| <parameter>fh</parameter>. |
<parameter>fh</parameter> as its second argument. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| The last error manipulating function, <function>cfg_get_error_str()</function>, |
Lastly, <function>cfg_get_error_str()</function>, returns an error message in |
| returns error message string. String is dynamically allocated. It is |
a dynamically allocated string. Be sure to free the memory taken by the string |
| <constant>NULL</constant> terminated array of characters filled with error |
when you do not need it anymore. |
| message. Returned pointer must be freed using <function>free()</function> system |
|
| call. |
|
| |
|
| <!-- DEPRECATED! |
<!-- DEPRECATED! |
| Second function returns pointer to local static buffer with error message. |
Second function returns pointer to local static buffer with error message. |
|
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| In following <xref linkend="usage.error-codes.table" |
The following <xref linkend="usage.error-codes.table" |
| endterm="usage.error-codes.table.title"> table are defined possible error |
endterm="usage.error-codes.table.title"> table describes the error constants |
| constants returned by parsing function, which has been described in <xref |
used by the parsing functions. See <xref linkend="usage.parsing" |
| linkend="usage.parsing" endterm="usage.parsing.title"> chapter. |
endterm="usage.parsing.title"> section for reference. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| Line 104 linkend="usage.parsing" endterm="usage.p |
|
| Line 103 linkend="usage.parsing" endterm="usage.p |
|
| </thead> |
</thead> |
| <tbody> |
<tbody> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_OK</constant></entry> |
| <constant>CFG_OK</constant> |
<entry>Everything is OK</entry> |
| </entry> |
|
| <entry>OK, all is right</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_NOARG</constant></entry> |
| <constant>CFG_ERROR_NOARG</constant> |
<entry>An argument is missing for the option</entry> |
| </entry> |
|
| <entry>An argument is missing for an option</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_NOTALLOWEDARG</constant></entry> |
| <constant>CFG_ERROR_NOTALLOWEDARG</constant> |
<entry>An argument is not allowed for the option</entry> |
| </entry> |
|
| <entry>An argument is not allowed for an option</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_BADOPT</constant></entry> |
| <constant>CFG_ERROR_BADOPT</constant> |
<entry>The option's argument could not be parsed</entry> |
| </entry> |
|
| <entry>An option's argument could not be parsed</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_BADQUOTE</constant></entry> |
| <constant>CFG_ERROR_BADQUOTE</constant> |
|
| </entry> |
|
| <entry>Error in quotations</entry> |
<entry>Error in quotations</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_BADNUMBER</constant></entry> |
| <constant>CFG_ERROR_BADNUMBER</constant> |
<entry>The option could not be converted to an appropriate numeric type</entry> |
| </entry> |
|
| <entry>An option could not be converted to appropriate numeric type</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_OVERFLOW</constant></entry> |
| <constant>CFG_ERROR_OVERFLOW</constant> |
<entry>A given numeric value was too big or too small</entry> |
| </entry> |
|
| <entry>A given number was too big or too small</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_MULTI</constant></entry> |
| <constant>CFG_ERROR_MULTI</constant> |
<entry>Multiple arguments used for an option that takes only one argument</entry> |
| </entry> |
|
| <entry>Multiple arguments used for single option</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_NOMEM</constant></entry> |
| <constant>CFG_ERROR_NOMEM</constant> |
|
| </entry> |
|
| <entry>Not enough memory</entry> |
<entry>Not enough memory</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry> |
| <constant>CFG_ERROR_STOP_STR</constant>, |
<constant>CFG_ERROR_STOP_STR</constant>, |
| <constant>CFG_ERROR_STOP_STR_FOUND</constant> |
<constant>CFG_ERROR_STOP_STR_FOUND</constant> |
| </entry> |
</entry> |
| <entry>Stop string was found</entry> |
<entry>Stop string was found</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_NOEQUAL</constant></entry> |
| <constant>CFG_ERROR_NOEQUAL</constant> |
<entry>Equal sign expected on the line, but no one was found</entry> |
| </entry> |
|
| <entry>No equal sign on the line</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_UNKNOWN</constant></entry> |
| <constant>CFG_ERROR_UNKNOWN</constant> |
|
| </entry> |
|
| <entry>An unknown option</entry> |
<entry>An unknown option</entry> |
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_FILE_NOT_FOUND</constant></entry> |
| <constant>CFG_ERROR_FILE_NOT_FOUND</constant> |
<entry>File not found</entry> |
| </entry> |
|
| <entry>File not found error</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_SEEK_ERROR</constant></entry> |
| <constant>CFG_ERROR_SEEK_ERROR</constant> |
<entry>Seek error (<function>fseek()</function> failure)</entry> |
| </entry> |
|
| <entry>Seek error (fseek() failure)</entry> |
|
| </row> |
</row> |
| <row> |
<row> |
| <entry> |
<entry><constant>CFG_ERROR_INTERNAL</constant></entry> |
| <constant>CFG_ERROR_INTERNAL</constant> |
|
| </entry> |
|
| <entry>Internal error</entry> |
<entry>Internal error</entry> |
| </row> |
</row> |
| </tbody> |
</tbody> |
| Line 201 linkend="usage.parsing" endterm="usage.p |
|
| Line 172 linkend="usage.parsing" endterm="usage.p |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| All constants exist also in their shorter forms. Use <constant>_ERR_</constant> |
All of the constants have an alternative, short form, which can be derived by |
| substring in constant name instead <constant>_ERROR_</constant> substring. So |
replacing <constant>_ERROR_</constant> with <constant>_ERR_</constant> in the |
| for example you can use <constant>CFG_ERR_BADOPT</constant> as a substitution |
name of the constant. So for example you can use |
| for <constant>CFG_ERROR_BADOPT</constant>. |
<constant>CFG_ERR_BADOPT</constant> as a substitution for |
| |
<constant>CFG_ERROR_BADOPT</constant>. |
| |
|
| </para> |
</para> |
| |
|
| </sect1> |
</sect1> |
| <!-- MAN: </refsect1></refentry> --> |
<!-- MAN: </refsect1></refentry> --> |
| |
|