| version 1.18, 2001/12/16 20:44:37 |
version 1.19, 2001/12/20 19:50:38 |
| Line 159 void cfg_free_context(const CFG_CONTEXT |
|
| Line 159 void cfg_free_context(const CFG_CONTEXT |
|
| * We can't call free_currents(con), because it is stacic method defined |
* We can't call free_currents(con), because it is stacic method defined |
| * in cmdline.c; but no problem, we will do the free-job ourself. |
* in cmdline.c; but no problem, we will do the free-job ourself. |
| |
|
| if (con->cur_opt != NULL) |
if (con->cur_opt != NULL) |
| free(con->cur_opt); |
free(con->cur_opt); |
| if (con->cur_arg != NULL) |
if (con->cur_arg != NULL) |
| free(con->cur_arg); |
free(con->cur_arg); |
| |
|
| con->cur_opt = con->cur_arg = NULL; |
con->cur_opt = con->cur_arg = NULL; |
| con->cur_opt_type = CFG_NONE_OPTION; |
con->cur_opt_type = CFG_NONE_OPTION; |
| */ |
*/ |
| |
|
| __cfg_free_currents(con); |
__cfg_free_currents(con); |
| Line 191 int main(int argc, char **argv) |
|
| Line 191 int main(int argc, char **argv) |
|
| int ret; |
int ret; |
| |
|
| int o_nice = 20, o_verbose = 0; |
int o_nice = 20, o_verbose = 0; |
| char *o_cfgfile = NULL; |
char *o_cfgfile = NULL, *o_string = NULL; |
| char **o_name = NULL, **o_string = NULL, **o_leftover = NULL; |
char **o_name = NULL, **o_leftover = NULL; |
| int o_boolean = 0; |
int o_boolean = 0; |
| int o_int = -33, **o_multi_int = NULL; |
int o_int = -33, **o_multi_int = NULL; |
| unsigned int o_uint = 33, **o_multi_uint = NULL; |
unsigned int o_uint = 33, **o_multi_uint = NULL; |
| Line 221 int main(int argc, char **argv) |
|
| Line 221 int main(int argc, char **argv) |
|
| {"multi_float",'F',"multi float",CFG_FLOAT+CFG_MULTI_SEPARATED,(void*)&o_multi_float,0}, |
{"multi_float",'F',"multi float",CFG_FLOAT+CFG_MULTI_SEPARATED,(void*)&o_multi_float,0}, |
| {"double", 'd', "double", CFG_DOUBLE, (void *) &o_double, 0 }, |
{"double", 'd', "double", CFG_DOUBLE, (void *) &o_double, 0 }, |
| {"multi_double",'D',"mdouble",CFG_DOUBLE+CFG_MULTI_SEPARATED,(void*)&o_multi_double,0}, |
{"multi_double",'D',"mdouble",CFG_DOUBLE+CFG_MULTI_SEPARATED,(void*)&o_multi_double,0}, |
| {"string", 's', "string", CFG_STRING + CFG_MULTI, (void *) &o_string, 0 }, |
{"string", 's', "string", CFG_STRING, (void *) &o_string, 0 }, |
| {NULL,'\0',"argv",CFG_STRING+CFG_MULTI_SEPARATED+CFG_LEFTOVER_ARGS,(void*)&o_leftover,0}, |
{NULL,'\0',"argv",CFG_STRING+CFG_MULTI_SEPARATED+CFG_LEFTOVER_ARGS,(void*)&o_leftover,0}, |
| CFG_END_OF_LIST |
CFG_END_OF_LIST |
| }; |
}; |
| Line 330 int main(int argc, char **argv) |
|
| Line 330 int main(int argc, char **argv) |
|
| printf("o_int = %d, o_uint = %u\n", o_int, o_uint); |
printf("o_int = %d, o_uint = %u\n", o_int, o_uint); |
| printf("o_long = %ld, o_ulong = %lu\n", o_long, o_ulong); |
printf("o_long = %ld, o_ulong = %lu\n", o_long, o_ulong); |
| printf("o_float = %f, o_double = %e\n", o_float, o_double); |
printf("o_float = %f, o_double = %e\n", o_float, o_double); |
| |
printf("o_string = <%s>\n", o_string); |
| |
|
| { |
{ |
| char *s; |
char *s; |
| Line 407 int main(int argc, char **argv) |
|
| Line 408 int main(int argc, char **argv) |
|
| else |
else |
| puts("o_name uninitialized"); |
puts("o_name uninitialized"); |
| |
|
| if (o_string != NULL) { |
|
| s = strdyn_implode_str(o_string, "]["); |
|
| printf("o_string = [%s]\n", s); |
|
| if (s != NULL) |
|
| free(s); |
|
| strdyn_free(o_string); |
|
| } |
|
| else |
|
| puts("o_string uninitialized"); |
|
| |
|
| if (o_leftover != NULL) { |
if (o_leftover != NULL) { |
| s = strdyn_implode_str(o_leftover, "]["); |
s = strdyn_implode_str(o_leftover, "]["); |
| printf("o_leftover = [%s]\n", s); |
printf("o_leftover = [%s]\n", s); |