| version 1.21, 2002/02/17 15:18:45 |
version 1.22, 2002/02/18 21:34:56 |
| Line 137 void cfg_set_cmdline_context( |
|
| Line 137 void cfg_set_cmdline_context( |
|
| |
|
| con->cur_idx_tmp = con->flags & CFG_PROCESS_FIRST ? 0 : 1; |
con->cur_idx_tmp = con->flags & CFG_PROCESS_FIRST ? 0 : 1; |
| con->cur_idx = 0; |
con->cur_idx = 0; |
| |
|
| con->used_opt_idx = NULL; |
|
| } |
} |
| |
|
| void cfg_set_cfgfile_context( |
void cfg_set_cfgfile_context( |
| Line 150 void cfg_set_cfgfile_context( |
|
| Line 148 void cfg_set_cfgfile_context( |
|
| { |
{ |
| cfg_reset_context(con); |
cfg_reset_context(con); |
| |
|
| |
if (filename == NULL) { |
| |
if (begin_pos > 0 && con->fhandle != NULL) |
| |
fseek(con->fhandle, begin_pos, SEEK_SET); |
| |
} |
| |
|
| con->type = CFG_CFGFILE; |
con->type = CFG_CFGFILE; |
| |
|
| con->begin_pos = begin_pos; |
con->begin_pos = begin_pos; |
| con->end_pos = end_pos; |
con->end_pos = end_pos; |
| |
|
| /* TODO: filename copying? (if yes than don't forget memory freeing) */ |
/* TODO: filename copying? (if yes than don't forget memory freeing) */ |
| con->filename = (char *) filename; |
if (filename != NULL) |
| |
con->filename = (char *) filename; |
| |
|
| con->fhandle = NULL; |
con->fhandle = NULL; |
| } |
} |
| Line 173 void cfg_reset_context(const CFG_CONTEXT |
|
| Line 177 void cfg_reset_context(const CFG_CONTEXT |
|
| |
|
| __cfg_free_currents(con); |
__cfg_free_currents(con); |
| |
|
| if (con->fhandle != NULL) { |
/* |
| fclose(con->fhandle); |
if (con->fhandle != NULL) { |
| con->fhandle = NULL; |
fclose(con->fhandle); |
| } |
con->fhandle = NULL; |
| |
} |
| |
*/ |
| } |
} |
| |
|
| void cfg_free_context(const CFG_CONTEXT con) |
void cfg_free_context(const CFG_CONTEXT con) |
| Line 219 void ar_print(char *name, char *format, |
|
| Line 225 void ar_print(char *name, char *format, |
|
| printf("%s: ", name); |
printf("%s: ", name); |
| for (i = 0; vals[i] != NULL; i++) { |
for (i = 0; vals[i] != NULL; i++) { |
| |
|
| |
|
| if (! strcmp(format, "%e") || ! strcmp(format, "%f")) |
if (! strcmp(format, "%e") || ! strcmp(format, "%f")) |
| printf(format, *(((float **) vals)[i])); |
printf(format, *(((float **) vals)[i])); |
| else |
else |
| Line 288 int main(int argc, char **argv) |
|
| Line 293 int main(int argc, char **argv) |
|
| |
|
| con = cfg_get_cmdline_context(argc, argv, options); |
con = cfg_get_cmdline_context(argc, argv, options); |
| |
|
| /* Deprecated and obsolote context flags initialization. */ |
|
| /* cfg_set_context_flags(con, con->flags + CFG_ADVANCED_LEFTOVERS); */ |
|
| |
|
| /* This is powerful testing stuff :) |
/* This is powerful testing stuff :) |
| |
|
| printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS)); |
printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS)); |