config: convert 'use_syslog' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-13 22:28:40 +02:00
parent caaf72c5ec
commit f5f77b182c
3 changed files with 3 additions and 13 deletions

View File

@ -99,6 +99,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
PORT_ITEM_INT("udp_ttl", 1, 1, 255), PORT_ITEM_INT("udp_ttl", 1, 1, 255),
GLOB_ITEM_INT("use_syslog", 1, 0, 1),
}; };
static struct config_item *config_section_item(struct config *cfg, static struct config_item *config_section_item(struct config *cfg,
@ -631,13 +632,6 @@ static enum parser_result parse_global_setting(const char *option,
if (!(cfg_ignore & CFG_IGNORE_VERBOSE)) if (!(cfg_ignore & CFG_IGNORE_VERBOSE))
cfg->verbose = val; cfg->verbose = val;
} else if (!strcmp(option, "use_syslog")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
if (!(cfg_ignore & CFG_IGNORE_USE_SYSLOG))
cfg->use_syslog = val;
} else if (!strcmp(option, "time_stamping")) { } else if (!strcmp(option, "time_stamping")) {
if (!(cfg_ignore & CFG_IGNORE_TIMESTAMPING)) { if (!(cfg_ignore & CFG_IGNORE_TIMESTAMPING)) {
if (0 == strcasecmp("hardware", value)) if (0 == strcasecmp("hardware", value))

View File

@ -49,7 +49,6 @@ struct interface {
#define CFG_IGNORE_TRANSPORT (1 << 1) #define CFG_IGNORE_TRANSPORT (1 << 1)
#define CFG_IGNORE_TIMESTAMPING (1 << 2) #define CFG_IGNORE_TIMESTAMPING (1 << 2)
#define CFG_IGNORE_SLAVEONLY (1 << 3) #define CFG_IGNORE_SLAVEONLY (1 << 3)
#define CFG_IGNORE_USE_SYSLOG (1 << 5)
#define CFG_IGNORE_VERBOSE (1 << 6) #define CFG_IGNORE_VERBOSE (1 << 6)
struct config { struct config {
@ -86,7 +85,6 @@ struct config {
unsigned char *udp6_scope; unsigned char *udp6_scope;
char *uds_address; char *uds_address;
int use_syslog;
int verbose; int verbose;
}; };

View File

@ -118,7 +118,6 @@ static struct config cfg_settings = {
.udp6_scope = &udp6_scope, .udp6_scope = &udp6_scope,
.uds_address = uds_path, .uds_address = uds_path,
.use_syslog = 1,
.verbose = 0, .verbose = 0,
.cfg_ignore = 0, .cfg_ignore = 0,
@ -249,8 +248,7 @@ int main(int argc, char *argv[])
*cfg_ignore |= CFG_IGNORE_VERBOSE; *cfg_ignore |= CFG_IGNORE_VERBOSE;
break; break;
case 'q': case 'q':
cfg_settings.use_syslog = 0; config_set_int(cfg, "use_syslog", 0);
*cfg_ignore |= CFG_IGNORE_USE_SYSLOG;
break; break;
case 'v': case 'v':
version_show(stdout); version_show(stdout);
@ -292,7 +290,7 @@ int main(int argc, char *argv[])
print_set_progname(progname); print_set_progname(progname);
print_set_verbose(cfg_settings.verbose); print_set_verbose(cfg_settings.verbose);
print_set_syslog(cfg_settings.use_syslog); print_set_syslog(config_get_int(cfg, NULL, "use_syslog"));
print_set_level(config_get_int(cfg, NULL, "logging_level")); print_set_level(config_get_int(cfg, NULL, "logging_level"));
if (STAILQ_EMPTY(&cfg_settings.interfaces)) { if (STAILQ_EMPTY(&cfg_settings.interfaces)) {