| version 1.7, 2002/02/17 15:18:45 |
version 1.8, 2002/02/18 21:34:56 |
| Line 35 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| Line 35 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| register int ret; |
register int ret; |
| |
|
| if (con->fhandle == NULL) { |
if (con->fhandle == NULL) { |
| con->fhandle = fopen(con->filename, "r"); |
con->fhandle = con->filename != NULL |
| |
? fopen(con->filename, "r") |
| |
: NULL; |
| if (con->fhandle == NULL) |
if (con->fhandle == NULL) |
| return CFG_ERROR_FILE_NOT_FOUND; |
return CFG_ERROR_FILE_NOT_FOUND; |
| |
|
| Line 54 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| Line 56 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| return ret; |
return ret; |
| } |
} |
| |
|
| |
if (buf != NULL && con->file_stop_prefix != NULL) { |
| |
if (buf == strdyn_str2(buf, con->file_stop_prefix, NULL)) { |
| |
__cfg_free_currents(con); |
| |
con->cur_opt = buf; |
| |
return CFG_ERR_STOP_STR; |
| |
} |
| |
} |
| |
|
| if (feof(con->fhandle)) { |
if (feof(con->fhandle)) { |
| if (buf != NULL) |
if (buf != NULL) |
| free(buf); |
free(buf); |
| Line 61 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| Line 71 int cfg_cfgfile_get_next_opt(const CFG_C |
|
| return CFG_OK; |
return CFG_OK; |
| } |
} |
| |
|
| #if 0 && defined(DEBUG) && DEBUG |
|
| printf("read_multi_line<%s>\n", buf); |
|
| #endif |
|
| __cfg_free_currents(con); |
__cfg_free_currents(con); |
| |
|
| if (__cfg_cfgfile_set_currents(con, buf) == 0) |
if (__cfg_cfgfile_set_currents(con, buf) == 0) |
| Line 110 static int get_multi_line(const CFG_CONT |
|
| Line 117 static int get_multi_line(const CFG_CONT |
|
| if (my_buf != NULL) |
if (my_buf != NULL) |
| free(my_buf); |
free(my_buf); |
| |
|
| |
con->cur_idx = ftell(con->fhandle); // not neccessary stuff |
| my_buf = dynamic_fgets(con->fhandle); |
my_buf = dynamic_fgets(con->fhandle); |
| if (my_buf == NULL) { |
if (my_buf == NULL) { |
| if (feof(con->fhandle)) |
if (feof(con->fhandle)) |
| Line 118 static int get_multi_line(const CFG_CONT |
|
| Line 126 static int get_multi_line(const CFG_CONT |
|
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| } |
} |
| |
|
| str_trim(my_buf); |
{ // not neccessary stuff |
| |
int my_buf_size = strlen(my_buf); |
| |
str_left_trim(my_buf); |
| |
con->cur_idx += my_buf_size - strlen(my_buf); |
| |
|
| |
str_right_trim(my_buf); |
| |
} |
| |
|
| if (strlen(my_buf) == 0 |
if (strlen(my_buf) == 0 |
| || strdyn_str(my_buf, con->comment_prefix) == my_buf) { |
|| strdyn_str(my_buf, con->comment_prefix) == my_buf) { |