From: Alberto Leiva Popper Date: Tue, 8 Feb 2022 19:46:28 +0000 (-0600) Subject: Configuration: Print deprecated message on http.idle-timeout X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Frrdp-refactor;p=thirdparty%2FFORT-validator.git Configuration: Print deprecated message on http.idle-timeout --- diff --git a/src/config.c b/src/config.c index 879e9321..70998d05 100644 --- a/src/config.c +++ b/src/config.c @@ -545,7 +545,7 @@ static const struct option_field options[] = { }, { .id = 9007, .name = "http.idle-timeout", /* TODO Deprecated. */ - .type = >_uint, + .type = >_uint_deprecated, .offset = offsetof(struct rpki_config, http.low_speed_time), .doc = "Deprecated; currently an alias for --http.low-speed-time. Use --http.low-speed-time instead.", .min = 0, diff --git a/src/config/uint.c b/src/config/uint.c index 3534109a..551105a8 100644 --- a/src/config/uint.c +++ b/src/config/uint.c @@ -72,3 +72,28 @@ const struct global_type gt_uint = { .parse.json = parse_json_uint, .arg_doc = "", }; + +static int +parse_argv_uint_deprecated(struct option_field const *field, char const *str, + void *result) +{ + pr_op_warn("Warning: Option '%s' is deprecated.", field->name); + return parse_argv_uint(field, str, result); +} + +static int +parse_json_uint_deprecated(struct option_field const *opt, json_t *json, + void *result) +{ + pr_op_warn("Warning: Option '%s' is deprecated.", opt->name); + return parse_json_uint(opt, json, result); +} + +const struct global_type gt_uint_deprecated = { + .has_arg = required_argument, + .size = sizeof(unsigned int), + .print = print_uint, + .parse.argv = parse_argv_uint_deprecated, + .parse.json = parse_json_uint_deprecated, + .arg_doc = "", +}; diff --git a/src/config/uint.h b/src/config/uint.h index 61c79358..e5dccc8d 100644 --- a/src/config/uint.h +++ b/src/config/uint.h @@ -4,6 +4,7 @@ #include "config/types.h" extern const struct global_type gt_uint; +extern const struct global_type gt_uint_deprecated; void print_uint(struct option_field const *, void *); int parse_argv_uint(struct option_field const *, char const *, void *);