From f5f77b182c35787320010a8435f4abf6416ffab6 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Thu, 13 Aug 2015 22:28:40 +0200 Subject: [PATCH] config: convert 'use_syslog' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 8 +------- config.h | 2 -- ptp4l.c | 6 ++---- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/config.c b/config.c index 143d9db..90d7659 100644 --- a/config.c +++ b/config.c @@ -99,6 +99,7 @@ struct config_item config_tab[] = { GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), 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, @@ -631,13 +632,6 @@ static enum parser_result parse_global_setting(const char *option, if (!(cfg_ignore & CFG_IGNORE_VERBOSE)) 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")) { if (!(cfg_ignore & CFG_IGNORE_TIMESTAMPING)) { if (0 == strcasecmp("hardware", value)) diff --git a/config.h b/config.h index 0b7c291..c456ea0 100644 --- a/config.h +++ b/config.h @@ -49,7 +49,6 @@ struct interface { #define CFG_IGNORE_TRANSPORT (1 << 1) #define CFG_IGNORE_TIMESTAMPING (1 << 2) #define CFG_IGNORE_SLAVEONLY (1 << 3) -#define CFG_IGNORE_USE_SYSLOG (1 << 5) #define CFG_IGNORE_VERBOSE (1 << 6) struct config { @@ -86,7 +85,6 @@ struct config { unsigned char *udp6_scope; char *uds_address; - int use_syslog; int verbose; }; diff --git a/ptp4l.c b/ptp4l.c index 068b1f3..3e34079 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -118,7 +118,6 @@ static struct config cfg_settings = { .udp6_scope = &udp6_scope, .uds_address = uds_path, - .use_syslog = 1, .verbose = 0, .cfg_ignore = 0, @@ -249,8 +248,7 @@ int main(int argc, char *argv[]) *cfg_ignore |= CFG_IGNORE_VERBOSE; break; case 'q': - cfg_settings.use_syslog = 0; - *cfg_ignore |= CFG_IGNORE_USE_SYSLOG; + config_set_int(cfg, "use_syslog", 0); break; case 'v': version_show(stdout); @@ -292,7 +290,7 @@ int main(int argc, char *argv[]) print_set_progname(progname); 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")); if (STAILQ_EMPTY(&cfg_settings.interfaces)) {