summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/config.h b/config.h
index 9993680..5dbc531 100644
--- a/config.h
+++ b/config.h
@@ -2,17 +2,18 @@
#define CONFIG_H
typedef struct config_opt config_opt;
+typedef union config_val config_val;
typedef enum config_type config_type;
-typedef void (*config_func)(config_opt *, void *);
+typedef void (*config_func)(config_opt *, config_val);
enum config_type {
TYPE_INT,
TYPE_STRING,
TYPE_FLOAT,
TYPE_BOOL,
+ TYPE_NONE,
};
-
struct config_opt {
const char *name; /* Name of the config option. */
const char *desc; /* Description of the config option. */
@@ -20,6 +21,13 @@ struct config_opt {
config_func func; /* Function of the config option. */
};
+union config_val {
+ int i; /* Integer. */
+ char *str; /* String. */
+ float f; /* Float. */
+ int b : 1; /* Bool. */
+};
+
static const config_opt config_opts[] = {
/* {"name", "desc", type, &func} */
{"git-root", "Root of git server (can also be a url).", TYPE_STRING, &get_git_root},