diff options
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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}, |