Diff for libcfg+/src/cfg+.c between version 1.2 and 1.3
| version 1.2, 2001/10/04 11:55:04 |
version 1.3, 2001/10/10 19:23:13 |
| Line 31 CFG_CONTEXT cfg_get_cmdline_context( |
|
| Line 31 CFG_CONTEXT cfg_get_cmdline_context( |
|
| if (con == NULL) |
if (con == NULL) |
| return NULL; |
return NULL; |
| |
|
| con->argc = argc; |
cfg_set_cmdline_context(con, argc, argv); |
| con->argv = argv; |
|
| |
|
| return con; |
return con; |
| } |
} |
| |
|
| CFG_CONTEXT cfg_get_cfgfile_context( |
CFG_CONTEXT cfg_get_cfgfile_context( |
| const long begin_pos, |
const int begin_pos, |
| const long end_pos, |
const int end_pos, |
| const char *filename, |
const char *filename, |
| const struct cfg_option *options |
const struct cfg_option *options |
| ) |
) |
| Line 50 CFG_CONTEXT cfg_get_cfgfile_context( |
|
| Line 49 CFG_CONTEXT cfg_get_cfgfile_context( |
|
| if (con == NULL) |
if (con == NULL) |
| return NULL; |
return NULL; |
| |
|
| con->begin_pos = begin_pos; |
cfg_set_cfgfile_context(con, begin_pos, end_pos, filename); |
| con->end_pos = end_pos; |
|
| con->filename = filename; |
|
| |
|
| return con; |
return con; |
| } |
} |
| |
|
| |
void cfg_set_cmdline_context( |
| |
const CFG_CONTEXT con, |
| |
const int argc, |
| |
const char **argv |
| |
) |
| |
{ |
| |
con->type = CFG_CMDLINE; |
| |
|
| |
con->argc = argc; |
| |
con->argv = argv; |
| |
} |
| |
|
| |
void cfg_set_cfgfile_context( |
| |
const CFG_CONTEXT con, |
| |
const int begin_pos, |
| |
const int end_pos, |
| |
const char *filename |
| |
) |
| |
{ |
| |
con->type = CFG_CFGFILE; |
| |
|
| |
con->begin_pos = begin_pos; |
| |
con->end_pos = end_pos; |
| |
con->filename = (char *) filename; |
| |
} |
| |
|
| void cfg_free_context( |
void cfg_free_context( |
| const CFG_CONTEXT con |
const CFG_CONTEXT con |
| ) |
) |
| Line 65 void cfg_free_context( |
|
| Line 88 void cfg_free_context( |
|
| free((void *) con); |
free((void *) con); |
| } |
} |
| |
|
| #if defined(SELFTEST) |
#if defined(SELF) || defined(SELFTEST) || defined(SELF_CFG) |
| |
|
| int main(void) { |
int main(void) { |
| |
|
| int nice; |
int nice; |
| |
|
| struct cfg_option options[2] = { |
struct cfg_option options[] = { |
| { "nice", 'n', "nice", CFG_INT, (void *) &nice, 0 }, |
{ "nice", 'n', "nice", CFG_INT, (void *) &nice, 0 }, |
| CFG_END_OF_LIST |
CFG_END_OF_LIST |
| }; |
}; |
Platon Group <platon@platon.org> http://platon.org/
|
|