CFG_PRINT_ERROR(3)

NAME
cfg_print_error, cfg_fprint_error, cfg_get_error_str - libcfg+ error handling

SYNOPSIS

The information about the last occurred error is stored within the context in the CFG_CONTEXT structure. The following functions provide a convenient interface for interpreting, querying and printing that information.

#include <cfg+.h>

void cfg_print_error (const CFG_CONTEXT con);

void cfg_fprint_error (const CFG_CONTEXT con, FILE *fh);

char *cfg_get_error_str (const CFG_CONTEXT con);

DESCRIPTION

The function cfg_print_error() prints an error message describing the last error. To print the message to the specified stream, use cfg_fprint_error(), which takes a stream pointer fh as its second argument.

Lastly, cfg_get_error_str(), returns an error message in a dynamically allocated string. Be sure to free the memory taken by the string when you do not need it anymore.

The following Error codes table describes the error constants used by the parsing functions. See Parsing section for reference.

"ERROR CODES"

CFG_OK
    Everything is OK

CFG_ERROR_NOARG
    An argument is missing for the option

CFG_ERROR_NOTALLOWEDARG
    An argument is not allowed for the option

CFG_ERROR_BADOPT
    The option's argument could not be parsed

CFG_ERROR_BADQUOTE
    Error in quotations

CFG_ERROR_BADNUMBER
    The option could not be converted to an appropriate numeric type

CFG_ERROR_OVERFLOW
    A given numeric value was too big or too small

CFG_ERROR_MULTI
    Multiple arguments used for an option that takes only one argument

CFG_ERROR_NOMEM
    Not enough memory

CFG_ERROR_STOP_STR, CFG_ERROR_STOP_STR_FOUND
    Stop string was found

CFG_ERROR_NOEQUAL
    Equal sign expected on the line, but no one was found

CFG_ERROR_UNKNOWN
    An unknown option

CFG_ERROR_FILE_NOT_FOUND
    File not found

CFG_ERROR_SEEK_ERROR
    Seek error (fseek() failure)

CFG_ERROR_INTERNAL
    Internal error

All of the constants have an alternative, short form, which can be derived by replacing _ERROR_ with _ERR_ in the name of the constant. So for example you can use CFG_ERR_BADOPT as a substitution for CFG_ERROR_BADOPT.

SEE ALSO
You can get library overview, table of contents and such additional information info from main libcfg+(3) manpage by typing "man libcfg+" on UNIX-based systems. Also use this command to get information about authors, homepage and license conditions.