Check-in [660883b103]
Overview
Comment:Additional man pages created, and cleaned up
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:660883b103b7e76ece436fc09155407aecbf8ab6
User & Date: rkeene on 2004-10-28 23:18:03
Other Links: manifest | tags
Context
2004-10-28
23:55
Updated the way configure looks for how to build shared objects. libconfig version 0.0.4 check-in: affd29c5ef user: rkeene tags: trunk
23:18
Additional man pages created, and cleaned up check-in: 660883b103 user: rkeene tags: trunk
22:39
Added an environment parser. Cleaned up some memory leaks. Made lc_process() cleanup, so calling lc_process() twice will do nothing. check-in: d7ae2bcb59 user: rkeene tags: trunk
Changes

Modified lc_geterrno.3.in from [da39a3ee5e] to [85df2eb346].

            1  +.TH LC_GETERRNO 3 "25 Oct 04" "@PACKAGE_STRING@"
            2  +.SH NAME
            3  +lc_geterrno \- Retrieve a numeric error code.
            4  +
            5  +.SH SYNOPSIS
            6  +.B #include <libconfig.h>
            7  +.sp
            8  +.BI "lc_err_t lc_geterrno(void);"
            9  +
           10  +.SH DESCRIPTION
           11  +The
           12  +.BR lc_geterrno (3)
           13  +function returns the last numeric error code set as an
           14  +.IR "lc_err_t"
           15  +which is an enumerated type and can be cast to any integer type.
           16  +
           17  +The
           18  +.IR lc_err_t
           19  +type specifies the following defined values:
           20  +.TP
           21  +LC_ERR_NONE
           22  +No error was found.  Success.
           23  +.TP
           24  +LC_ERR_INVCMD
           25  +A command was specified for which there was no handler.
           26  +.TP
           27  +LC_ERR_INVSECTION
           28  +A section was specified for which there was no handler.
           29  +.TP
           30  +LC_ERR_INVDATA
           31  +A value that does not make sense was specified, such as a non-existant type to the
           32  +.BR lc_process_file (3)
           33  +function.
           34  +.TP
           35  +LC_ERR_BADFORMAT
           36  +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.
           37  +.TP
           38  +LC_ERR_CANTOPEN
           39  +Unable to open a specified file.
           40  +.TP
           41  +LC_ERR_CALLBACK
           42  +A callback function returned an error (LC_CBRET_ERROR).
           43  +.TP
           44  +LC_ERR_ENOMEM
           45  +Memory could not be allocated for internal structures.
           46  +
           47  +.SH EXAMPLE
           48  +.nf
           49  +#include <libconfig.h>
           50  +#include <stdlib.h>
           51  +#include <stdio.h>
           52  +
           53  +
           54  +int main(int argc, char **argv) {
           55  +	int lc_p_ret, lc_rv_ret;
           56  +	char *filename = NULL;
           57  +
           58  +	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
           59  +	                            &filename, 'f');
           60  +
           61  +	if (lc_rv_ret != 0) {
           62  +		fprintf(stderr, "Error registering variable: %i.\\n",
           63  +		        lc_geterrno());
           64  +		return(EXIT_FAILURE);
           65  +	}
           66  +
           67  +	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
           68  +	                      NULL);
           69  +	if (lc_p_ret != 0) {
           70  +		fprintf(stderr, "Error processing configuration: \\
           71  +		        %s\\n", lc_geterrstr());
           72  +		return(EXIT_FAILURE);
           73  +	}
           74  +
           75  +	if (filename != NULL) {
           76  +		printf("File specified was: %s\\n", filename);
           77  +	} else {
           78  +		printf("No filename specified.\\n");
           79  +	}
           80  +
           81  +	return(EXIT_SUCCESS);
           82  +}
           83  +.fi
           84  +
           85  +.SH "SEE ALSO"
           86  +.BR lc_register_var (3),
           87  +.BR lc_register_callback (3),
           88  +.BR lc_geterrstr (3),
           89  +.BR lc_process (3),
           90  +.BR lc_register_var (3)

Modified lc_geterrstr.3.in from [da39a3ee5e] to [e9149b39ec].

            1  +.TH LC_GETERRSTR 3 "25 Oct 04" "@PACKAGE_STRING@"
            2  +.SH NAME
            3  +lc_geterrstr \- Retrieve a human readable error message.
            4  +
            5  +.SH SYNOPSIS
            6  +.B #include <libconfig.h>
            7  +.sp
            8  +.BI "char *lc_geterrstr(void);"
            9  +
           10  +.SH DESCRIPTION
           11  +The
           12  +.BR lc_geterrstr (3)
           13  +function returns a string describing the last error code set.
           14  +
           15  +.SH EXAMPLE
           16  +.nf
           17  +#include <libconfig.h>
           18  +#include <stdlib.h>
           19  +#include <stdio.h>
           20  +
           21  +int main(int argc, char **argv) {
           22  +	int lc_p_ret, lc_rv_ret;
           23  +	char *filename = NULL;
           24  +
           25  +	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
           26  +	                            &filename, 'f');
           27  +
           28  +	if (lc_rv_ret != 0) {
           29  +		fprintf(stderr, "Error registering variable: %s.\\n",
           30  +		        lc_geterrstr());
           31  +		return(EXIT_FAILURE);
           32  +	}
           33  +
           34  +	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
           35  +	                      NULL);
           36  +	if (lc_p_ret != 0) {
           37  +		fprintf(stderr, "Error processing configuration: \\
           38  +		        %s\\n", lc_geterrstr());
           39  +		return(EXIT_FAILURE);
           40  +	}
           41  +
           42  +	if (filename != NULL) {
           43  +		printf("File specified was: %s\\n", filename);
           44  +	} else {
           45  +		printf("No filename specified.\\n");
           46  +	}
           47  +
           48  +	return(EXIT_SUCCESS);
           49  +}
           50  +.fi
           51  +
           52  +.SH "SEE ALSO"
           53  +.BR lc_register_var (3),
           54  +.BR lc_register_callback (3),
           55  +.BR lc_geterrno (3),
           56  +.BR lc_process (3),
           57  +.BR lc_register_var (3)

Modified lc_register_callback.3.in from [57f2b8a256] to [d1718088de].

     5      5   .SH SYNOPSIS
     6      6   .B #include <libconfig.h>
     7      7   .sp
     8      8   .BI "int lc_register_callback(const char *" var ", char " opt ", lc_var_type_t " type ", int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *" extra);
     9      9   
    10     10   .SH DESCRIPTION
    11     11   The
    12         -.B lc_register_callback
           12  +.BR lc_register_callback (3)
    13     13   function registers a function to be called when
    14     14   .IR var
    15     15   is encounted in a configuration file, command line, or environment variable.
    16     16   The parameters are as follows:
    17     17   .TP
    18     18   .IR "const char *var"
    19     19   .RS
................................................................................
    66     66   .I shortvar
    67     67   parameter is the local variable name, provided as a convience.  It is the portion of the variable name after the first "dot" (.) in the fully qualified variable name.  The "dot" (.) value in the fully qualified variable name indicates a section or subsection that the variable belongs to.
    68     68   This may be
    69     69   .B NULL
    70     70   if the
    71     71   .IR var
    72     72   parameter to
    73         -.BI lc_register_callback (3)
           73  +.BR lc_register_callback (3)
    74     74   was
    75     75   .B NULL
    76     76   too.
    77     77   .RE
    78     78   .TP
    79     79   .I "const char *var"
    80     80   .RS
................................................................................
    82     82   .I var
    83     83   parameter is the fully qualified variable name.  It includes in the prefix any sections and subsections that contain this variable.
    84     84   This may be
    85     85   .B NULL
    86     86   if the
    87     87   .IR var
    88     88   parameter to
    89         -.BI lc_register_callback (3)
           89  +.BR lc_register_callback (3)
    90     90   was
    91     91   .B NULL
    92     92   too.
    93     93   .RE
    94     94   .TP
    95     95   .I "const char *arguments"
    96     96   .RS
................................................................................
   108    108   .I value
   109    109   parameter provides the value of the variable specified.
   110    110   This may be
   111    111   .B NULL
   112    112   if no value was specified.  Values are required if the
   113    113   .IR type
   114    114   parameter to
   115         -.BI lc_register_callback (3)
          115  +.BR lc_register_callback (3)
   116    116   was not specified as one of LC_VAR_NONE, LC_VAR_SECTION, LC_VAR_SECTIONSTART, or LC_VAR_SECTIONEND.
   117    117   .RE
   118    118   .TP
   119    119   .I "lc_flags_t flags"
   120    120   .RS
   121    121   The flags parameter provides information about the type of command being called.  The valid values are:
   122    122   .IP LC_FLAGS_VAR
................................................................................
   132    132   .I "void *extra"
   133    133   .RS
   134    134   The
   135    135   .I extra
   136    136   parameter is just a copy of the
   137    137   .IR extra
   138    138   parameter passed to
   139         -.BI lc_register_callback (3)
          139  +.BR lc_register_callback (3)
   140    140   when the callback was registered.
   141    141   .RE
   142    142   
   143    143   The
   144    144   .IR callback
   145    145   function should return one of three values:
   146    146   .TP
................................................................................
   148    148   Returning LC_CBRET_IGNORESECTION from a callback that begins a section causes the entire section to be ignored without generating an error.
   149    149   .TP
   150    150   LC_CBRET_OKAY
   151    151   Returning LC_CBRET_OKAY from a callback indicates that all went well and further processing may continue.
   152    152   .TP
   153    153   LC_CBRET_ERROR
   154    154   Returnning LC_CBRET_ERROR from a callback indicates that the command failed for some reason, the error will be passed back down the chain back to the
   155         -.BI lc_process (3)
          155  +.BR lc_process (3)
   156    156   call that began processing the configuration data.  If LC_CBRET_ERROR is returned from a callback that begins a section, the entire section is ignored.
   157    157   
   158    158   
   159    159    "RETURN VALUE"
   160    160   On success 0 is returned, otherwise -1 is returned.
   161    161   
   162    162   .SH EXAMPLE