Overview
Comment: | Updated man pages. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6861d15aace7dbe1ea5b0aba6c85c2d9 |
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: 0.1.0, trunk | |
Changes
Modified lc_geterrno.3.in from [85df2eb346] to [d002dd6251].
︙ | ︙ | |||
46 47 48 49 50 51 52 | .SH EXAMPLE .nf #include <libconfig.h> #include <stdlib.h> #include <stdio.h> | < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | .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'); |
︙ | ︙ | |||
82 83 84 85 86 87 88 | } .fi .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_register_callback (3), .BR lc_geterrstr (3), | | < | 81 82 83 84 85 86 87 88 | } .fi .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_register_callback (3), .BR lc_geterrstr (3), .BR lc_process (3) |
Modified lc_geterrstr.3.in from [e9149b39ec] to [5494e928ad].
︙ | ︙ | |||
49 50 51 52 53 54 55 | } .fi .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_register_callback (3), .BR lc_geterrno (3), | | < | 49 50 51 52 53 54 55 56 | } .fi .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_register_callback (3), .BR lc_geterrno (3), .BR lc_process (3) |
Modified lc_process.3.in from [da39a3ee5e] to [967a4267e5].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | .TH LC_PROCESS 3 "25 Oct 04" "@PACKAGE_STRING@" .SH NAME lc_process \- Begin processing configuration files. .SH SYNOPSIS .B #include <libconfig.h> .sp .BI "int lc_process(int " argc ", char **" argv ", const char *" appname ", lc_conf_type_t " type ", const char *" extra ");" .SH DESCRIPTION The .BR lc_process (3) function begins processing of the command line arguments, environment variables, and command line options. .SH "RETURN VALUE" On success 0 is returned, otherwise -1 is returned. .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); 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_geterrno (3), .BR lc_geterrstr (3) |
Modified lc_register_callback.3.in from [d1718088de] to [43854d99e9].
1 2 3 4 5 6 7 | .TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "@PACKAGE_STRING@" .SH NAME lc_register_callback \- Register a function for callback in config processing. .SH SYNOPSIS .B #include <libconfig.h> .sp | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | .TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "@PACKAGE_STRING@" .SH NAME lc_register_callback \- Register a function for callback in config processing. .SH SYNOPSIS .B #include <libconfig.h> .sp .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 ");" .SH DESCRIPTION The .BR lc_register_callback (3) function registers a function to be called when .IR var is encounted in a configuration file, command line, or environment variable. |
︙ | ︙ | |||
152 153 154 155 156 157 158 | .TP LC_CBRET_ERROR 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 .BR lc_process (3) 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. | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | .TP LC_CBRET_ERROR 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 .BR lc_process (3) 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. .SH "RETURN VALUE" On success 0 is returned, otherwise -1 is returned. .SH EXAMPLE .nf #include <libconfig.h> #include <strings.h> #include <stdlib.h> |
︙ | ︙ | |||
221 222 223 224 225 226 227 | .B ENOMEM Memory could not be allocated to create the needed internal structures. .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_geterrno (3), .BR lc_geterrstr (3), | | < | 221 222 223 224 225 226 227 228 | .B ENOMEM Memory could not be allocated to create the needed internal structures. .SH "SEE ALSO" .BR lc_register_var (3), .BR lc_geterrno (3), .BR lc_geterrstr (3), .BR lc_process (3) |
Modified lc_register_var.3.in from [da39a3ee5e] to [33f89d18c6].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | .TH LC_REGISTER_VAR 3 "25 Oct 04" "@PACKAGE_STRING@" .SH NAME lc_register_var \- Register a variable for automatic processing. .SH SYNOPSIS .B #include <libconfig.h> .sp .BI "int lc_register_var(const char *" var ", lc_var_type_t " type ", void *" data ", char " opt ");" .SH DESCRIPTION The .BR lc_register_var (3) function registers a variable for automatic processing. The .IR var parameter specifies the variable name for processing. This name can exist in a configuration file, an environment variable, or on the command line. The .IR opt 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 .IR data parameter. A value of '\0' can be specified for no short option. The .IR type parameter is of type .IR lc_var_type_t which specifies the type of the .IR data parameter. Valid values for .IR type are: .TP LC_VAR_STRING 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. .TP LC_VAR_LONG_LONG For a "long long" integer type variable. The data passed should be of type "long long *". .TP LC_VAR_LONG For a "long" integer type variable. The data passed should be of type "long *". .TP LC_VAR_INT For a "int" integer type variable. The data passed should be of type "int *". .TP LC_VAR_SHORT For a "short" integer type variable. The data passed should be of type "short *". .TP LC_VAR_BOOL 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. .TP LC_VAR_FILENAME Not implemented. .TP LC_VAR_DIRECTORY Not implemented. .TP LC_VAR_SIZE_LONG_LONG 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 *". .TP LC_VAR_SIZE_LONG 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 *". .TP LC_VAR_SIZE_INT 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 *". .TP LC_VAR_SIZE_SHORT 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 *". .TP LC_VAR_TIME Not implemented. .TP LC_VAR_DATE Not implemented. .TP LC_VAR_BOOL_BY_EXISTANCE 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 *". .SH "RETURN VALUE" On success 0 is returned, otherwise -1 is returned. .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; long int counter = -1; lc_rv_ret = lc_register_var("Begin", LC_VAR_LONG, &counter, 'c'); if (lc_rv_ret != 0) { fprintf(stderr, "Error registering variable: %i.\\n", lc_geterrno()); return(EXIT_FAILURE); } 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); 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"); } if (counter != -1) { printf("Counter was specified as: %ld\\n", counter); } else { printf("Counter was not specified.\\n"); } return(EXIT_SUCCESS); } .fi .SH "SEE ALSO" .BR lc_register_callback (3), .BR lc_geterrno (3), .BR lc_geterrstr (3), .BR lc_process (3) |