diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -74,6 +74,7 @@ struct distrend_config cfg_t *mycfg; struct options_common *options; struct distrend_listen **listens; /*< Null terminated array of structs */ + char *datadir; }; @@ -451,36 +452,42 @@ void blendjob_remove(struct blendjob **h // Begin non-working framework? - int distrend_do_config(int argc, char *argv[], struct distrend_config **config) - { - cfg_opt_t myopts_listen[] = - { - CFG_SIMPLE_STR("type", NULL), - CFG_SIMPLE_STR("path", NULL), - CFG_SIMPLE_INT("port", NULL), - CFG_END() - }; - cfg_opt_t myopts[] = - { - CFG_SEC("listen", /* this must be imported into struct listens (which must still be declared) */ - myopts_listen - , - CFGF_MULTI), - CFG_END() - }; +int distrend_do_config(int argc, char *argv[], struct distrend_config **config) +{ + cfg_opt_t myopts_listen[] = + { + CFG_SIMPLE_STR("type", NULL), + CFG_SIMPLE_STR("path", NULL), + CFG_SIMPLE_INT("port", NULL), + CFG_END() + }; + cfg_opt_t myopts[] = + { + CFG_SEC("listen", /* this must be imported into struct listens (which must still be declared) */ + myopts_listen, + CFGF_MULTI), + CFG_SIMPLE_STR("datadir", NULL), + CFG_END() + }; + + fprintf(stderr, "%s:%d running config\n", __FILE__, __LINE__); - *config = malloc(sizeof(struct distrend_config)); - options_init(argc, argv, &(*config)->mycfg, myopts, "server", &(*config)->options); + *config = malloc(sizeof(struct distrend_config)); + myopts[1].simple_value = &(*config)->datadir; + + options_init(argc, argv, &(*config)->mycfg, myopts, "server", &(*config)->options); - return 0; - } - int distrend_config_free(struct distrend_config *config) - { - options_free(config->options); - free(config); - - return 0; - } + fprintf(stderr, "using %s as datadir\n", (*config)->datadir); + + return 0; +} +int distrend_config_free(struct distrend_config *config) +{ + options_free(config->options); + free(config); + + return 0; +} // End non-working framework? int main(int argc, char *argv[])