]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Configuration: Print deprecated message on http.idle-timeout rrdp-refactor
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 8 Feb 2022 19:46:28 +0000 (13:46 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 8 Feb 2022 19:47:04 +0000 (13:47 -0600)
src/config.c
src/config/uint.c
src/config/uint.h

index 879e93219ec09b59612d079111f48f32845b4564..70998d0540dfde0b911247c081eb692431af8022 100644 (file)
@@ -545,7 +545,7 @@ static const struct option_field options[] = {
        }, {
                .id = 9007,
                .name = "http.idle-timeout", /* TODO Deprecated. */
-               .type = &gt_uint,
+               .type = &gt_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,
index 3534109a36b5f7fa451c0ae1b60b7a3442de5a47..551105a887f48efd1650028e4af2c77f316467f6 100644 (file)
@@ -72,3 +72,28 @@ const struct global_type gt_uint = {
        .parse.json = parse_json_uint,
        .arg_doc = "<unsigned integer>",
 };
+
+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 = "<unsigned integer>",
+};
index 61c793588abd2f952c29cd8ccf6cec153cdf3591..e5dccc8de1b57af568583fcfc0285cc75e25dbfa 100644 (file)
@@ -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 *);