src/config.c
changeset 83 c8e2dac08207
child 100 cfb7776bd6f0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/config.c	Fri Mar 27 17:22:43 2009 +0200
@@ -0,0 +1,21 @@
+#include "config.h"
+
+#include <string.h>
+
+err_t config_apply (struct config_option *options, void *ctx, const char *name, char *value, struct error_info *err)
+{
+    struct config_option *option;
+
+    // find the matching config opt
+    for (option = options; option->name && option->type; option++) {
+        if (strcmp(option->name, name) == 0)
+            break;
+    }
+
+    // no matching option found?
+    if (!option)
+        RETURN_SET_ERROR_STR(err, ERR_CONFIG_NAME, name);
+
+    // call the handler
+    return option->func(ctx, value, err);
+}