Go to the documentation of this file.
36 #define CFG_END_OPTION { NULL, '\0', NULL, CFG_END, NULL, 0 }
37 #define CFG_END_OF_LIST CFG_END_OPTION
61 CFG_ERROR_NOTALLOWEDARG = -2,
65 CFG_ERROR_BADOPT = -3,
69 CFG_ERROR_BADQUOTE = -4,
73 CFG_ERROR_BADNUMBER = -5,
77 CFG_ERROR_OVERFLOW = -6,
89 CFG_ERR_STOP_STR_FOUND = -9,
90 CFG_ERROR_STOP_STR = -9,
91 CFG_ERROR_STOP_STR_FOUND = -9,
95 CFG_ERROR_NOEQUAL = -10,
99 CFG_ERROR_UNKNOWN = -11,
103 CFG_ERROR_FILE_NOT_FOUND = -12,
107 CFG_ERROR_SEEK_ERROR = -13,
111 CFG_ERROR_INTERNAL = -20
195 CFG_UNSIGNED_INT = 3,
202 CFG_UNSIGNED_LONG = 5,
227 CFG_MULTI_ARRAY = 32,
228 CFG_MULTI_SEPARATED = 32 + 64,
235 CFG_LAST_ARGUMENTS = 128,
236 CFG_LEFTOVER_ARGS = 128,
237 CFG_LEFTOVER_ARGUMENTS = 128
348 #define CFG_EOT CFG_N_PROPS
349 #define CFG_END_TYPE CFG_N_PROPS
542 #define cfg_get_cmdline_context_pos(begin_pos, end_pos, argv, options) \
543 cfg_get_cmdline_context( \
545 end_pos - begin_pos + 1, \
578 #define cfg_get_cfgfile_context_pos(begin_pos, end_pos, argv, options) \
579 cfg_get_cfgfile_context( \
581 end_pos - begin_pos + 1, \
596 const CFG_CONTEXT con,
601 #define cfg_set_cmdline_context_pos(con, begin_pos, end_pos, argv) \
602 cfg_get_cmdline_context( \
605 end_pos - begin_pos + 1, \
617 const CFG_CONTEXT con,
632 const CFG_CONTEXT con,
637 #define cfg_set_cfgfile_context_pos(con, begin_pos, end_pos, argv) \
638 cfg_get_cfgfile_context( \
641 end_pos - begin_pos + 1, \
694 #define cfg_is_context_flag(con, flag) cfg_get_context_flag(con, flag)
int parsing_started Flag to detect if parsing already started. Definition: cfg+.h:478
Config file quote prefix & postfix. Definition: cfg+.h:307
cfg_context_type Context type. Definition: cfg+.h:362
Line type position usage in file. Definition: cfg+.h:156
Float. Definition: cfg+.h:205
void cfg_set_cfgfile_context(const CFG_CONTEXT con, long begin_pos, long size, char *filename) Set context to configuration file.
enum cfg_option_type type Option type. Definition: cfg+.h:415
Data type mask (used internally) Definition: cfg+.h:218
long size Number of elements (array arguments, bytes or lines) to parse (value of -1 means infinite) ... Definition: cfg+.h:448
Array of strings which forces to stop command line parsing. Definition: cfg+.h:308
File not found error. Definition: cfg+.h:102
Config file context type. Definition: cfg+.h:372
Strict leftover arguments initialization in file. Definition: cfg+.h:150
Config file multi values separator. Definition: cfg+.h:299
Array of strings prefixes which forces to stop config file parsing. Definition: cfg+.h:283
Unsigned int. Definition: cfg+.h:193
Integer. Definition: cfg+.h:189
const struct cfg_option * options Options table. Definition: cfg+.h:441
Error in quotations. Definition: cfg+.h:68
Command line quote prefix & postfix. Definition: cfg+.h:278
int cfg_get_context_flags(const CFG_CONTEXT con) Get all context flags.
An unknown option. Definition: cfg+.h:98
Normal leftover arguments initialization in file. Definition: cfg+.h:146
int cfg_add_properties_type(const CFG_CONTEXT con, enum cfg_property_type type, char *str,...) Add multiple strings to one property.
void cfg_set_cmdline_context_argc(const CFG_CONTEXT con, int argc, char **argv) Set context to command line by argc and argv passed to main()
int cfg_parse(const CFG_CONTEXT con) Parse context.
FILE * fhandle Pointer to FILE* structure of parsed file. Definition: cfg+.h:494
Seek error (fseek() failure). Definition: cfg+.h:106
const char * cfgfile_name Config file name (may be NULL) Definition: cfg+.h:411
CFG_CONTEXT cfg_get_cmdline_context_argc(int argc, char **argv, struct cfg_option *options) Initialize command line context by argc and argv passed to main()
long cur_idx Currents. Definition: cfg+.h:460
File quote prefix & postfix. Definition: cfg+.h:329
int * used_opt_idx Array of used options indexes. Definition: cfg+.h:451
An argument is missing for an option. Definition: cfg+.h:56
Multiple arguments used for single option. Definition: cfg+.h:80
int cfg_remove_property(const CFG_CONTEXT con, enum cfg_property_type type, char *str) Remove string from property.
int cfg_remove_properties_str(const CFG_CONTEXT con, char *str, enum cfg_property_type type,...) Remove string from multiple properties.
char ** argv NULL terminated array of argument. Definition: cfg+.h:481
int cfg_add_properties_str(const CFG_CONTEXT con, char *str, enum cfg_property_type type,...) Add string to multiple properties.
Command line multi values leftover arguments separator. Definition: cfg+.h:274
Structure for defining one config option. Definition: cfg+.h:405
char ** prop[CFG_N_PROPS] Special properties. Definition: cfg+.h:457
Single, multi or multi separated. Definition: cfg+.h:225
String. Definition: cfg+.h:211
int cfg_clear_properties(const CFG_CONTEXT con, enum cfg_property_type type,...) Clear all strings of property.
const char * cmdline_long_name Command line long name (may be NULL) Definition: cfg+.h:407
cfg_line_option_type Command line option type. Definition: cfg+.h:381
OK, all is right. Definition: cfg+.h:50
int val Return value (set to 0 for not return) Definition: cfg+.h:421
File quote prefix & postfix. Definition: cfg+.h:328
Special properties count. Definition: cfg+.h:317
Array of strings which forces to stop command line parsing. Definition: cfg+.h:254
Array of string prefixes which mark comment line. Definition: cfg+.h:287
File quote prefix & postfix. Definition: cfg+.h:334
Posixly correct leftover arguments. Definition: cfg+.h:139
Ignore multiple arguments for single option. Definition: cfg+.h:127
Command line context type. Definition: cfg+.h:368
File quote prefix & postfix. Definition: cfg+.h:326
char * cfg_get_error_str(const CFG_CONTEXT con) Get error string; error string is dynamically allocated, it needs to be freed after use...
Array of strings which forces to stop command line parsing. Definition: cfg+.h:279
Command line long option prefix. Definition: cfg+.h:262
enum cfg_context_type type Context type (command line or config file) Definition: cfg+.h:435
Double. Definition: cfg+.h:208
CFG_CONTEXT cfg_get_cfgfile_context(long begin_pos, long size, char *filename, struct cfg_option *options) Initialize configuration file context.
Command line option argument separator. Definition: cfg+.h:266
int cfg_get_next_opt(const CFG_CONTEXT con) Parse next option(s) and return its value (if non-zero) or error code.
File quote prefix & postfix. Definition: cfg+.h:337
Byte type position usage in file. Definition: cfg+.h:153
CFG_CONTEXT cfg_get_context(struct cfg_option *options) Initialize core context.
long cur_idx_tmp Context type (command line or config file) Definition: cfg+.h:461
Short command line options. Definition: cfg+.h:393
Command line multi values leftover arguments separator. Definition: cfg+.h:303
int cfg_add_properties(const CFG_CONTEXT con, enum cfg_property_type type, char *str,...) Add multiple strings to particular properties.
int cfg_get_cur_idx(const CFG_CONTEXT con) Return currently processed option index (argv index in command line context, file byte position or li...
Long. Definition: cfg+.h:198
Short command line option. Definition: cfg+.h:387
Not enough memory. Definition: cfg+.h:84
An argument is not allowed for an option. Definition: cfg+.h:60
OK, all is right. Definition: cfg+.h:51
Option argument separator. Definition: cfg+.h:340
void * value Pointer where to store value of option. Definition: cfg+.h:418
struct cfg_context * CFG_CONTEXT Context data type. Definition: cfg+.h:502
File quote prefix & postfix. Definition: cfg+.h:327
char * cfg_get_cur_opt(const CFG_CONTEXT con) Return currently processed option name.
Unsigned long. Definition: cfg+.h:201
Long command line option argument initialized without separator (default) Definition: cfg+.h:399
void cfg_reset_context(const CFG_CONTEXT con) Reinitialize popt context.
File quote prefix & postfix. Definition: cfg+.h:335
Internal error. Definition: cfg+.h:110
int cfg_remove_properties(const CFG_CONTEXT con, enum cfg_property_type type, char *str,...) Remove multiple strings from particular properties.
long begin_pos Starting parsing position. Definition: cfg+.h:444
int cfg_remove_properties_type(const CFG_CONTEXT con, enum cfg_property_type type, char *str,...) Remove multiple strings from one property.
File quote prefix & postfix. Definition: cfg+.h:336
Not long and not short option. Definition: cfg+.h:384
cfg_property_type Terminators of variable number arguments in functions cfg_add_properties(), cfg_set_properties(), cfg_get_properties() and similar. Definition: cfg+.h:245
void cfg_clear_context_flag(const CFG_CONTEXT con, int flag) Clear context flag.
File quote prefix & postfix. Definition: cfg+.h:330
Boolean. Definition: cfg+.h:185
char * cur_arg Current option argument. Definition: cfg+.h:468
Ignore unknown options. Definition: cfg+.h:130
Stop string was found. Definition: cfg+.h:88
int cfg_clear_property(const CFG_CONTEXT con, enum cfg_property_type type) Clear all strings of property.
An option's argument could not be parsed. Definition: cfg+.h:64
Config file option argument separator. Definition: cfg+.h:295
void cfg_set_context_flag(const CFG_CONTEXT con, int flag) Set context flag.
Skip processing of the first argument on command line. Definition: cfg+.h:136
cfg_flag By default are CFG_PROCESS_FIRST, CFG_POSIXLY_LEFTOVERS and CFG_NORMAL_LEFTOVERS initialized. Definition: cfg+.h:124
cfg_option_type Possible types of options. Definition: cfg+.h:182
A given number was too big or too small. Definition: cfg+.h:76
char * cur_opt Current option string. Definition: cfg+.h:465
void cfg_print_error(const CFG_CONTEXT con) Print error string to stderr.
CFG_CONTEXT cfg_get_cmdline_context(long begin_pos, long size, char **argv, struct cfg_option *options) Initialize command line context.
int cfg_get_context_flag(const CFG_CONTEXT con, int flag) Get context flag.
Advanced leftover arguments. Definition: cfg+.h:142
enum cfg_error error_code Error code of last occured error. Definition: cfg+.h:454
char * filename Filename (name of file) Definition: cfg+.h:491
An option could not be converted to appropriate numeric type. Definition: cfg+.h:72
Leftover arguments specification. Definition: cfg+.h:234
No equal sign on the line. Definition: cfg+.h:94
Main structure for defining context. Definition: cfg+.h:427
Long command line option. Definition: cfg+.h:390
Array of string postfixes to determine multi lines. Definition: cfg+.h:291
Multi values separator. Definition: cfg+.h:333
Command line multi values separator. Definition: cfg+.h:270
void cfg_set_cmdline_context(const CFG_CONTEXT con, long begin_pos, long size, char **argv) Set context to command line.
void cfg_set_context_flags(const CFG_CONTEXT con, int flags) Overwrite context flags.
int flags Flags. Definition: cfg+.h:438
const char cmdline_short_name Command line short name (may be '\0') Definition: cfg+.h:409
Process also the first argument on command line. Definition: cfg+.h:133
char * cfg_get_static_error_str(const int errorcode) Get static error string.
OK, all is right. Definition: cfg+.h:52
int cur_opt_type Context type (command line or config file) Definition: cfg+.h:462
char * cfg_get_cur_arg(const CFG_CONTEXT con) Return currently processed option argument.
int cfg_add_property(const CFG_CONTEXT con, enum cfg_property_type type, char *str) Add string to property.
cfg_error Possible return values returned by parsing functions. Definition: cfg+.h:46
void cfg_fprint_error(const CFG_CONTEXT con, FILE *fh) Print error string to stream.
End (to mark last item in list) Definition: cfg+.h:215
void cfg_free_context(const CFG_CONTEXT con) Destroy context.
Command line short option prefix. Definition: cfg+.h:258
Long command line option argument initialized with separator. Definition: cfg+.h:396
No context. Definition: cfg+.h:365
libcfg+ developer documentation generated by
Doxygen
|
|