Skip to content
Extraits de code Groupes Projets
Vérifiée Valider d72f3a1d rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Can now print default config

parent 3619b53f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!93Config rewrite
......@@ -3,6 +3,7 @@
#include <common/common.h>
#include <stddef.h>
#include <sqlite3.h>
#include <stdio.h>
/* Forward definition of the lkt_state structure */
struct lkt_state;
......@@ -34,3 +35,6 @@ int config_new(volatile sqlite3 *db, const char *conf);
type is done, it is up to the user to check if the structure passed as a
`void*` is the right structure. */
int load_module_by_name(struct lkt_state *srv, const char *name, void *mod);
/* Prints the default config file. */
void config_default(FILE *output);
......@@ -248,16 +248,27 @@ int
config_new(volatile sqlite3 *db, const char *conf)
{
if (ini_parse(conf, handler, db)) {
LOG_ERROR("Failed to parse file %s", conf);
return 1;
LOG_ERROR_SCT("CONFIG", "Failed to parse file %s", conf);
goto error;
}
if (validate_conf(db)) {
LOG_ERROR("Configuration file %s is incomplete", conf);
return 1;
LOG_ERROR_SCT("CONFIG", "Configuration file %s is incomplete", conf);
goto error;
}
return 0;
error:
LOG_ERROR_SCT("CONFIG", "%s", "Errors detected in config, here is a default config:");
config_default(stdout);
return 1;
}
void
config_default(FILE *output)
{
fwrite(lkt_default_config_file, sizeof(char),
strlen(lkt_default_config_file), output);
}
int
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter