allow comments starting with # or cvs diff

ulab-original
jsorg71 19 years ago
parent 63b03920ee
commit c3d93235b1

@ -88,9 +88,11 @@ int APP_CC
file_read_line(struct stream* s, char* text) file_read_line(struct stream* s, char* text)
{ {
int i; int i;
int skip_to_end;
char c; char c;
char* hold; char* hold;
skip_to_end = 0;
if (!s_check(s)) if (!s_check(s))
{ {
return 1; return 1;
@ -100,8 +102,15 @@ file_read_line(struct stream* s, char* text)
in_uint8(s, c); in_uint8(s, c);
while (c != 10 && c != 13 && s_check(s)) while (c != 10 && c != 13 && s_check(s))
{ {
text[i] = c; if (c == '#' || c == '!')
i++; {
skip_to_end = 1;
}
if (!skip_to_end)
{
text[i] = c;
i++;
}
in_uint8(s, c); in_uint8(s, c);
} }
if (c == 10 || c == 13) if (c == 10 || c == 13)
@ -118,7 +127,7 @@ file_read_line(struct stream* s, char* text)
s->p = hold; s->p = hold;
return 1; return 1;
} }
if (g_strlen(text) > 0) if (s_check(s))
{ {
return 0; return 0;
} }
@ -208,9 +217,12 @@ file_read_section(int fd, char* section, struct list* names,
file_read_line(s, text); file_read_line(s, text);
while (file_read_line(s, text) == 0) while (file_read_line(s, text) == 0)
{ {
file_split_name_value(text, name, value); if (g_strlen(text) > 0)
list_add_item(names, (long)g_strdup(name)); {
list_add_item(values, (long)g_strdup(value)); file_split_name_value(text, name, value);
list_add_item(names, (long)g_strdup(name));
list_add_item(values, (long)g_strdup(value));
}
} }
free_stream(s); free_stream(s);
return 0; return 0;

Loading…
Cancel
Save