Commit 79e67b88 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement getbool.

parent 75084871
......@@ -129,6 +129,29 @@ getint(int c, int *int_r, gnc_t gnc, void *closure)
return c;
}
static int
getbool(int c, int *int_r, gnc_t gnc, void *closure)
{
char *t;
int i;
c = getword(c, &t, gnc, closure);
if(c < -1)
return c;
if(strcmp(t, "true") == 0 || strcmp(t, "yes") == 0)
i = CONFIG_YES;
else if(strcmp(t, "false") == 0 || strcmp(t, "no") == 0)
i = CONFIG_NO;
else if(strcmp(t, "default") == 0)
i = CONFIG_DEFAULT;
else {
free(t);
return -2;
}
free(t);
*int_r = i;
return c;
}
static int
getip(int c, unsigned char **ip_r, int *af_r, gnc_t gnc, void *closure)
{
......
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