Check-in [6861d15aac]
Overview
Comment:Updated man pages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6861d15aace7dbe1ea5b0aba6c85c2d94cfab550
User & Date: rkeene on 2004-10-29 16:17:59
Other Links: manifest | tags
Context
2004-10-29
16:33
Updated manual pages. The "extraconfig" files are now processed before the /etc ones. check-in: 304f4b8d4a user: rkeene tags: trunk
16:17
Updated man pages. check-in: 6861d15aac user: rkeene tags: trunk
04:02
Updated documentation added INSTALL document libconfig 0.1.0 check-in: 1bde205ce1 user: rkeene tags: trunk, 0.1.0
Changes

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

    46     46   
    47     47   .SH EXAMPLE
    48     48   .nf
    49     49   #include <libconfig.h>
    50     50   #include <stdlib.h>
    51     51   #include <stdio.h>
    52     52   
    53         -
    54     53   int main(int argc, char **argv) {
    55     54   	int lc_p_ret, lc_rv_ret;
    56     55   	char *filename = NULL;
    57     56   
    58     57   	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
    59     58   	                            &filename, 'f');
    60     59   
................................................................................
    82     81   }
    83     82   .fi
    84     83   
    85     84   .SH "SEE ALSO"
    86     85   .BR lc_register_var (3),
    87     86   .BR lc_register_callback (3),
    88     87   .BR lc_geterrstr (3),
    89         -.BR lc_process (3),
    90         -.BR lc_register_var (3)
           88  +.BR lc_process (3)

Modified lc_geterrstr.3.in from [e9149b39ec] to [5494e928ad].

    49     49   }
    50     50   .fi
    51     51   
    52     52   .SH "SEE ALSO"
    53     53   .BR lc_register_var (3),
    54     54   .BR lc_register_callback (3),
    55     55   .BR lc_geterrno (3),
    56         -.BR lc_process (3),
    57         -.BR lc_register_var (3)
           56  +.BR lc_process (3)

Modified lc_process.3.in from [da39a3ee5e] to [967a4267e5].

            1  +.TH LC_PROCESS 3 "25 Oct 04" "@PACKAGE_STRING@"
            2  +.SH NAME
            3  +lc_process \- Begin processing configuration files.
            4  +
            5  +.SH SYNOPSIS
            6  +.B #include <libconfig.h>
            7  +.sp
            8  +.BI "int lc_process(int " argc ", char **" argv ", const char *" appname ", lc_conf_type_t " type ", const char *" extra ");"
            9  +
           10  +.SH DESCRIPTION
           11  +The
           12  +.BR lc_process (3)
           13  +function begins processing of the command line arguments, environment variables, and command line options.
           14  +
           15  +.SH "RETURN VALUE"
           16  +On success 0 is returned, otherwise -1 is returned.
           17  +
           18  +.SH EXAMPLE
           19  +.nf
           20  +#include <libconfig.h>
           21  +#include <stdlib.h>
           22  +#include <stdio.h>
           23  +
           24  +int main(int argc, char **argv) {
           25  +	int lc_p_ret, lc_rv_ret;
           26  +	char *filename = NULL;
           27  +
           28  +	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
           29  +	                            &filename, 'f');
           30  +	if (lc_rv_ret != 0) {
           31  +		fprintf(stderr, "Error registering variable: %i.\\n",
           32  +		        lc_geterrno());
           33  +		return(EXIT_FAILURE);
           34  +	}
           35  +
           36  +	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
           37  +	                      NULL);
           38  +	if (lc_p_ret != 0) {
           39  +		fprintf(stderr, "Error processing configuration: \\
           40  +		        %s\\n", lc_geterrstr());
           41  +		return(EXIT_FAILURE);
           42  +	}
           43  +
           44  +	if (filename != NULL) {
           45  +		printf("File specified was: %s\\n", filename);
           46  +	} else {
           47  +		printf("No filename specified.\\n");
           48  +	}
           49  +
           50  +	return(EXIT_SUCCESS);
           51  +}
           52  +.fi
           53  +
           54  +.SH "SEE ALSO"
           55  +.BR lc_register_var (3),
           56  +.BR lc_register_callback (3),
           57  +.BR lc_geterrno (3),
           58  +.BR lc_geterrstr (3)

Modified lc_register_callback.3.in from [d1718088de] to [43854d99e9].

     1      1   .TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "@PACKAGE_STRING@"
     2      2   .SH NAME
     3      3   lc_register_callback \- Register a function for callback in config processing.
     4      4   
     5      5   .SH SYNOPSIS
     6      6   .B #include <libconfig.h>
     7      7   .sp
     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);
            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     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.
................................................................................
   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    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         - "RETURN VALUE"
          159  +.SH "RETURN VALUE"
   160    160   On success 0 is returned, otherwise -1 is returned.
   161    161   
   162    162   .SH EXAMPLE
   163    163   .nf
   164    164   #include <libconfig.h>
   165    165   #include <strings.h>
   166    166   #include <stdlib.h>
................................................................................
   221    221   .B ENOMEM
   222    222   Memory could not be allocated to create the needed internal structures.
   223    223   
   224    224   .SH "SEE ALSO"
   225    225   .BR lc_register_var (3),
   226    226   .BR lc_geterrno (3),
   227    227   .BR lc_geterrstr (3),
   228         -.BR lc_process (3),
   229         -.BR lc_register_var (3)
          228  +.BR lc_process (3)

Modified lc_register_var.3.in from [da39a3ee5e] to [33f89d18c6].

            1  +.TH LC_REGISTER_VAR 3 "25 Oct 04" "@PACKAGE_STRING@"
            2  +.SH NAME
            3  +lc_register_var \- Register a variable for automatic processing.
            4  +
            5  +.SH SYNOPSIS
            6  +.B #include <libconfig.h>
            7  +.sp
            8  +.BI "int lc_register_var(const char *" var ", lc_var_type_t " type ", void *" data ", char " opt ");"
            9  +
           10  +.SH DESCRIPTION
           11  +The
           12  +.BR lc_register_var (3)
           13  +function registers a variable for automatic processing.
           14  +The
           15  +.IR var
           16  +parameter specifies the variable name for processing.  This name can exist in a configuration file, an environment variable, or on the command line.
           17  +The
           18  +.IR opt
           19  +parameter specifies the single letter short option that can be specified on the command line to change the value of the variable specified by the
           20  +.IR data
           21  +parameter.  A value of '\0' can be specified for no short option.
           22  +
           23  +The
           24  +.IR type 
           25  +parameter is of type
           26  +.IR lc_var_type_t
           27  +which specifies the type of the
           28  +.IR data
           29  +parameter.
           30  +Valid values for
           31  +.IR type
           32  +are:
           33  +.TP
           34  +LC_VAR_STRING
           35  +For a string type variable.  The data passed should be of type "char **".  The data will be set to a region of memory that has been allocated with malloc() and can be released be free()'d.
           36  +.TP
           37  +LC_VAR_LONG_LONG
           38  +For a "long long" integer type variable.  The data passed should be of type "long long *".
           39  +.TP
           40  +LC_VAR_LONG
           41  +For a "long" integer type variable.  The data passed should be of type "long *".
           42  +.TP
           43  +LC_VAR_INT
           44  +For a "int" integer type variable.  The data passed should be of type "int *".
           45  +.TP
           46  +LC_VAR_SHORT
           47  +For a "short" integer type variable.  The data passed should be of type "short *".
           48  +.TP
           49  +LC_VAR_BOOL
           50  +For a boolean type variable.  The data passed should be of type "int *".  When a true value is specified the variable is set to 1.  When a false value is specified the variable is set to 0.  Any other value sets the variable to -1.  Valid true values are: enable, true, yes, on, y, and 1.  Valid false values are: disable, false, off, no, n, and 0.
           51  +.TP
           52  +LC_VAR_FILENAME
           53  +Not implemented.
           54  +.TP
           55  +LC_VAR_DIRECTORY
           56  +Not implemented.
           57  +.TP
           58  +LC_VAR_SIZE_LONG_LONG
           59  +For a "long long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes.  The data passed should be of type "long long *".
           60  +.TP
           61  +LC_VAR_SIZE_LONG
           62  +For a "long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes.  The data passed should be of type "long *".
           63  +.TP
           64  +LC_VAR_SIZE_INT
           65  +For a "int" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes.  The data passed should be of type "int *".
           66  +.TP
           67  +LC_VAR_SIZE_SHORT
           68  +For a "short" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes.  The data passed should be of type "short *".
           69  +.TP
           70  +LC_VAR_TIME
           71  +Not implemented.
           72  +.TP
           73  +LC_VAR_DATE
           74  +Not implemented.
           75  +.TP
           76  +LC_VAR_BOOL_BY_EXISTANCE
           77  +This type of variable takes no arguments, it is set to true (1) by its existance in a configuration file, environment variable, or on the command line.  If it is not specified, the value of the data passed is not changed.  The data passed should be of type "int *".
           78  +
           79  +.SH "RETURN VALUE"
           80  +On success 0 is returned, otherwise -1 is returned.
           81  +
           82  +.SH EXAMPLE
           83  +.nf
           84  +#include <libconfig.h>
           85  +#include <stdlib.h>
           86  +#include <stdio.h>
           87  +
           88  +int main(int argc, char **argv) {
           89  +	int lc_p_ret, lc_rv_ret;
           90  +	char *filename = NULL;
           91  +	long int counter = -1;
           92  +
           93  +	lc_rv_ret = lc_register_var("Begin", LC_VAR_LONG,
           94  +	                            &counter, 'c');
           95  +	if (lc_rv_ret != 0) {
           96  +		fprintf(stderr, "Error registering variable: %i.\\n",
           97  +		        lc_geterrno());
           98  +		return(EXIT_FAILURE);
           99  +	}
          100  +
          101  +	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
          102  +	                            &filename, 'f');
          103  +	if (lc_rv_ret != 0) {
          104  +		fprintf(stderr, "Error registering variable: %i.\\n",
          105  +		        lc_geterrno());
          106  +		return(EXIT_FAILURE);
          107  +	}
          108  +
          109  +	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
          110  +	                      NULL);
          111  +	if (lc_p_ret != 0) {
          112  +		fprintf(stderr, "Error processing configuration: \\
          113  +		        %s\\n", lc_geterrstr());
          114  +		return(EXIT_FAILURE);
          115  +	}
          116  +
          117  +	if (filename != NULL) {
          118  +		printf("File specified was: %s\\n", filename);
          119  +	} else {
          120  +		printf("No filename specified.\\n");
          121  +	}
          122  +
          123  +	if (counter != -1) {
          124  +		printf("Counter was specified as: %ld\\n", counter);
          125  +	} else {
          126  +		printf("Counter was not specified.\\n");
          127  +	}
          128  +
          129  +	return(EXIT_SUCCESS);
          130  +}
          131  +.fi
          132  +
          133  +.SH "SEE ALSO"
          134  +.BR lc_register_callback (3),
          135  +.BR lc_geterrno (3),
          136  +.BR lc_geterrstr (3),
          137  +.BR lc_process (3)