
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@20 7dcaeef0-15fb-0310-b436-a5af3365683c
94 строки
2.1 KiB
Groff
94 строки
2.1 KiB
Groff
.TH LC_GETERRNO 3 "25 Oct 04" "libconfig 0.1.16"
|
|
.SH NAME
|
|
lc_geterrno \- Retrieve a numeric error code.
|
|
|
|
.SH SYNOPSIS
|
|
.B #include <libconfig.h>
|
|
.sp
|
|
.BI "lc_err_t lc_geterrno(void);"
|
|
|
|
.SH DESCRIPTION
|
|
The
|
|
.BR lc_geterrno (3)
|
|
function returns the last numeric error code set as an
|
|
.IR "lc_err_t"
|
|
which is an enumerated type and can be cast to any integer type.
|
|
|
|
The
|
|
.IR lc_err_t
|
|
type specifies the following defined values:
|
|
.TP
|
|
LC_ERR_NONE
|
|
No error was found. Success.
|
|
.TP
|
|
LC_ERR_INVCMD
|
|
A command was specified for which there was no handler.
|
|
.TP
|
|
LC_ERR_INVSECTION
|
|
A section was specified for which there was no handler.
|
|
.TP
|
|
LC_ERR_INVDATA
|
|
A value that does not make sense was specified, such as a non-existant type to the
|
|
.BR lc_process_file (3)
|
|
function.
|
|
.TP
|
|
LC_ERR_BADFORMAT
|
|
An invalid format was detected, such as no argument where on was expected, or a value passed to a boolean-specified variable whose value was not one of: enable, true, yes, on, y, 1, disable, false, off, no, n, 0.
|
|
.TP
|
|
LC_ERR_CANTOPEN
|
|
Unable to open a specified file.
|
|
.TP
|
|
LC_ERR_CALLBACK
|
|
A callback function returned an error (LC_CBRET_ERROR).
|
|
.TP
|
|
LC_ERR_ENOMEM
|
|
Memory could not be allocated for internal structures.
|
|
|
|
.SH EXAMPLE
|
|
.nf
|
|
#include <libconfig.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
int lc_p_ret, lc_rv_ret;
|
|
char *filename = NULL;
|
|
|
|
lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
|
|
&filename, 'f');
|
|
|
|
if (lc_rv_ret != 0) {
|
|
fprintf(stderr, "Error registering variable: %i.\\n",
|
|
lc_geterrno());
|
|
return(EXIT_FAILURE);
|
|
}
|
|
|
|
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
|
|
NULL);
|
|
|
|
lc_cleanup();
|
|
|
|
if (lc_p_ret != 0) {
|
|
fprintf(stderr, "Error processing configuration: \\
|
|
%s\\n", lc_geterrstr());
|
|
return(EXIT_FAILURE);
|
|
}
|
|
|
|
if (filename != NULL) {
|
|
printf("File specified was: %s\\n", filename);
|
|
} else {
|
|
printf("No filename specified.\\n");
|
|
}
|
|
|
|
return(EXIT_SUCCESS);
|
|
}
|
|
.fi
|
|
|
|
.SH "SEE ALSO"
|
|
.BR lc_register_var (3),
|
|
.BR lc_register_callback (3),
|
|
.BR lc_geterrstr (3),
|
|
.BR lc_cleanup (3),
|
|
.BR lc_process_file (3),
|
|
.BR lc_process (3)
|