Commit 6aca83ed authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement skip_eol, use it in parse_option.

parent 490d6ef6
...@@ -75,6 +75,17 @@ skip_to_eol(int c, gnc_t gnc, void *closure) ...@@ -75,6 +75,17 @@ skip_to_eol(int c, gnc_t gnc, void *closure)
return c; return c;
} }
static int
skip_eol(int c, gnc_t gnc, void *closure)
{
c = skip_whitespace(c, gnc, closure);
if(c < 0 || c == '\n' || c == '#') {
c = skip_to_eol(c, gnc, closure);
return c;
}
return -2;
}
static int static int
getword(int c, char **token_r, gnc_t gnc, void *closure) getword(int c, char **token_r, gnc_t gnc, void *closure)
{ {
...@@ -803,13 +814,7 @@ parse_option(int c, gnc_t gnc, void *closure, char *token) ...@@ -803,13 +814,7 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
goto error; goto error;
} }
c = skip_whitespace(c, gnc, closure); return skip_eol(c, gnc, closure);
if(c < 0 || c == '\n' || c == '#') {
c = skip_to_eol(c, gnc, closure);
return c;
}
/* Fall through */
error: error:
return -2; return -2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment