Commit 1055d869 authored by Davide Ciminaghi's avatar Davide Ciminaghi Committed by Alessandro Rubini

conf.c: add an f_simple_int() config handler

Signed-off-by: Davide Ciminaghi's avatarDavide Ciminaghi <ciminaghi@gnudd.com>
parent 3e86c0a8
......@@ -319,6 +319,8 @@ extern struct pp_argline pp_ext_arglines[];
/* Note: config_string modifies the string it receives */
extern int pp_config_string(struct pp_globals *ppg, char *s);
extern int pp_config_file(struct pp_globals *ppg, int force, char *fname);
extern int f_simple_int(struct pp_argline *l, int lineno,
struct pp_globals *ppg, union pp_cfg_arg *arg);
#define PPSI_PROTO_RAW 0
#define PPSI_PROTO_UDP 1
......
......@@ -63,6 +63,24 @@ static int f_port(struct pp_argline *l, int lineno, struct pp_globals *ppg,
return -1; \
}})
static inline void ASSIGN_INT_FIELD(struct pp_argline *l,
struct pp_globals *ppg,
int v)
{
if (l->needs_port)
*(int *)(((void *)CUR_PPI(ppg)) + l->field_offset) = v;
else
*(int *)(((void *)GOPTS(ppg)) + l->field_offset) = v;
}
int f_simple_int(struct pp_argline *l, int lineno,
struct pp_globals *ppg, union pp_cfg_arg *arg)
{
CHECK_PPI(l->needs_port);
ASSIGN_INT_FIELD(l, ppg, arg->i);
return 0;
}
static int f_if(struct pp_argline *l, int lineno, struct pp_globals *ppg,
union pp_cfg_arg *arg)
{
......
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