| verzia 1.2, 2001/10/04 11:55:04 |
verzia 1.3, 2001/10/09 15:07:41 |
| Riadok 40 enum cfg_error { |
|
| Riadok 40 enum cfg_error { |
|
| CFG_ERR_UNKNOWN = -7, |
CFG_ERR_UNKNOWN = -7, |
| CFG_ERROR_UNKNOWN = -7, |
CFG_ERROR_UNKNOWN = -7, |
| |
|
| |
/* Stop string was found. */ |
| |
CFG_ERR_STOP_STR = -8, |
| |
CFG_ERR_STOP_STR_FOUND = -8, |
| |
CFG_ERROR_STOP_STR = -8, |
| |
CFG_ERROR_STOP_STR_FOUND = -8, |
| |
|
| |
/* No equal sign on the line. */ |
| |
CFG_ERR_NOEQUAL = -9, |
| |
CFG_ERROR_NOEQUAL = -9, |
| |
|
| /* Internal error. */ |
/* Internal error. */ |
| CFG_ERR_INTERNAL = -20, |
CFG_ERR_INTERNAL = -20, |
| CFG_ERROR_INTERNAL = -20 |
CFG_ERROR_INTERNAL = -20 |
| Riadok 135 struct cfg_option { |
|
| Riadok 145 struct cfg_option { |
|
| |
|
| |
|
| struct cfg_context { |
struct cfg_context { |
| |
|
| /* |
/* |
| * Shared properties. |
* Shared properties. |
| */ |
*/ |
| Riadok 145 struct cfg_context { |
|
| Riadok 155 struct cfg_context { |
|
| |
|
| /* Flags. */ |
/* Flags. */ |
| int flags; |
int flags; |
| |
|
| /* Options table. */ |
/* Options table. */ |
| const struct cfg_option *options; |
const struct cfg_option *options; |
| |
|
| /* |
/* |
| * Command line specific properties. |
* Command line specific properties. |
| */ |
*/ |
| |
|
| int argc; |
int argc; |
| const char **argv; |
const char **argv; |
| |
|
| Riadok 169 struct cfg_context { |
|
| Riadok 179 struct cfg_context { |
|
| char **long_option_prefix; /* default: "--" */ |
char **long_option_prefix; /* default: "--" */ |
| char **option_arg_separator; /* default: "=" */ |
char **option_arg_separator; /* default: "=" */ |
| |
|
| /* |
/* |
| * Config file specific properties. |
* Config file specific properties. |
| */ |
*/ |
| |
|
| int begin_pos; |
int begin_pos; |
| int end_pos; |
int end_pos; |
| char *filename; |
char *filename; |
| Riadok 189 typedef struct cfg_context* CFG_CONTEXT; |
|
| Riadok 199 typedef struct cfg_context* CFG_CONTEXT; |
|
| /* Getting & modifying context functions. */ |
/* Getting & modifying context functions. */ |
| |
|
| CFG_CONTEXT cfg_get_context( |
CFG_CONTEXT cfg_get_context( |
| const struct cfg_option *options |
const struct cfg_option *options |
| ); |
); |
| |
|
| CFG_CONTEXT cfg_get_cmdline_context( |
CFG_CONTEXT cfg_get_cmdline_context( |
| const int argc, |
const int argc, |
| const char **argv, |
const char **argv, |
| const struct cfg_option *options |
const struct cfg_option *options |
| ); |
); |
| |
|
| CFG_CONTEXT cfg_get_cfgfile_context( |
CFG_CONTEXT cfg_get_cfgfile_context( |
| const int begin_line, |
const int begin_pos, |
| const int end_line, |
const int end_pos, |
| const char *filename, |
const char *filename, |
| const struct cfg_option *options |
const struct cfg_option *options |
| ); |
); |
| |
|
| void cfg_set_cmdline_context( |
void cfg_set_cmdline_context( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const int argc, |
const int argc, |
| const char **argv |
const char **argv |
| ); |
); |
| |
|
| void cfg_set_cfgfile_context( |
void cfg_set_cfgfile_context( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const int begin_line, |
const int begin_line, |
| const int end_line, |
const int end_line, |
| const char *filename |
const char *filename |
| ); |
); |
| |
|
| /* Context flags & special properties manipulation. */ |
/* Context flags & special properties manipulation. */ |
| |
|
| void cfg_set_context_flags( |
void cfg_set_context_flags( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| int flags |
int flags |
| ); |
); |
| |
|
| void cfg_clear_cmdline_stop_str( |
void cfg_clear_cmdline_stop_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| void cfg_add_cmdline_stop_str( |
void cfg_add_cmdline_stop_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| void cfg_clear_cfgfile_stop_str( |
void cfg_clear_cfgfile_stop_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| void cfg_add_cfgfile_stop_str( |
void cfg_add_cfgfile_stop_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| void cfg_clear_cfgfile_comment_str( |
void cfg_clear_cfgfile_comment_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| void cfg_add_cfgfile_comment_str( |
void cfg_add_cfgfile_comment_str( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| const char *str |
const char *str |
| ); |
); |
| |
|
| /* Processing context options. */ |
/* Processing context options. */ |
| |
|
| int cfg_parse( |
int cfg_parse( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ); |
); |
| |
|
| int cfg_get_next_opt( |
int cfg_get_next_opt( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ); |
); |
| |
|
| int cfg_get_opt_arg( |
int cfg_get_opt_arg( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ); |
); |
| |
|
| /* Reseting context. */ |
/* Reseting context. */ |
| |
|
| void cfg_reset_context( |
void cfg_reset_context( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ); |
); |
| |
|
| /* Freeing context. */ |
/* Freeing context. */ |
| |
|
| void cfg_free_context( |
void cfg_free_context( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ); |
); |
| |
|
| #endif /* _CFG_H */ |
#endif /* _CFG_H */ |
| |
|