Commit dff43b05 authored by Davide Ciminaghi's avatar Davide Ciminaghi Committed by Alessandro Rubini

conf: add ARG_INT2 arg type

This get things ready for introducing the servo-pi config option, which
takes two comma separated integers.
Signed-off-by: Davide Ciminaghi's avatarDavide Ciminaghi <ciminaghi@gnudd.com>
parent dd0e6972
...@@ -278,6 +278,7 @@ struct pp_cfg_time { ...@@ -278,6 +278,7 @@ struct pp_cfg_time {
* added inside here, without redefining cfg_handler prototype */ * added inside here, without redefining cfg_handler prototype */
union pp_cfg_arg { union pp_cfg_arg {
int i; int i;
int i2[2];
char *s; char *s;
struct pp_cfg_time ts; struct pp_cfg_time ts;
}; };
...@@ -295,6 +296,7 @@ struct pp_argname { ...@@ -295,6 +296,7 @@ struct pp_argname {
enum pp_argtype { enum pp_argtype {
ARG_NONE, ARG_NONE,
ARG_INT, ARG_INT,
ARG_INT2,
ARG_STR, ARG_STR,
ARG_NAMES, ARG_NAMES,
ARG_TIME, ARG_TIME,
......
...@@ -380,6 +380,14 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno) ...@@ -380,6 +380,14 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno)
} }
break; break;
case ARG_INT2:
if (sscanf(line, "%i,%i", cfg_arg.i2, &cfg_arg.i2[1]) < 0) {
pp_diag(NULL, config, 1, "line %i: wrong arg \"%s\""
" for \"%s\"\n", lineno, line, word);
return -1;
}
break;
case ARG_STR: case ARG_STR:
while (*line && blank(*line)) while (*line && blank(*line))
line++; line++;
......
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