From 71411189b448ad0408aa79a5b2d47a5ce6b4cd71 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 11 Mar 2004 10:07:38 +0000 Subject: [PATCH] (set_option, delete_option): Gripe about unknown options. If multiple options have identical names in Options[], all but the first are ignored. This should never happen. --- src/lib/gen/emp_config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/gen/emp_config.c b/src/lib/gen/emp_config.c index 135aa511..3c1b50f0 100644 --- a/src/lib/gen/emp_config.c +++ b/src/lib/gen/emp_config.c @@ -580,9 +580,12 @@ set_option(const char *s) struct option_list *op; for (op = Options; op->opt_key; op++) { - if (strcmp(op->opt_key, s) == 0) + if (strcmp(op->opt_key, s) == 0) { *op->opt_valuep = 1; + return; + } } + fprintf(stderr, "Unknown option %s\n", s); } /* delete an option from the list */ @@ -592,9 +595,12 @@ delete_option(const char *s) struct option_list *op; for (op = Options; op->opt_key; op++) { - if (strcmp(op->opt_key, s) == 0) + if (strcmp(op->opt_key, s) == 0) { *op->opt_valuep = 0; + return; + } } + fprintf(stderr, "Unknown option %s\n", s); } /* config interface */