sources: turn select options into flags

This will allow adding new options for source selection which can be
combined with others.
This commit is contained in:
Miroslav Lichvar
2015-12-18 16:18:53 +01:00
parent 62d61de93d
commit fa15fb3d53
11 changed files with 34 additions and 58 deletions

View File

@@ -63,7 +63,7 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
src->params.max_sources = SRC_DEFAULT_MAXSOURCES;
src->params.min_samples = SRC_DEFAULT_MINSAMPLES;
src->params.max_samples = SRC_DEFAULT_MAXSAMPLES;
src->params.sel_option = SRC_SelectNormal;
src->params.sel_options = 0;
result = CPS_Success;
@@ -165,10 +165,10 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
}
} else if (!strcasecmp(cmd, "noselect")) {
src->params.sel_option = SRC_SelectNoselect;
src->params.sel_options |= SRC_SELECT_NOSELECT;
} else if (!strcasecmp(cmd, "prefer")) {
src->params.sel_option = SRC_SelectPrefer;
src->params.sel_options |= SRC_SELECT_PREFER;
} else if (!strcasecmp(cmd, "version")) {
if (sscanf(line, "%d%n", &src->params.version, &n) != 1) {