]> git.pond.sub.org Git - empserver/commitdiff
(set_option, delete_option): Gripe about unknown options. If multiple
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 11 Mar 2004 10:07:38 +0000 (10:07 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 11 Mar 2004 10:07:38 +0000 (10:07 +0000)
options have identical names in Options[], all but the first are
ignored.  This should never happen.

src/lib/gen/emp_config.c

index 135aa5114c406e2590146c460a2ec6d04f4f5d83..3c1b50f01938dfb112b4f318d934cb2895162338 100644 (file)
@@ -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 */