From 694f3a78473e12d36fe7fbd0395c8f2aa56a9d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 13 Apr 2015 11:37:27 +0200 Subject: Add first implementation of write_config write_config is application for default .config generation. It will be using default API from kconfig to generate it. Now implemented only symbol map loading. --- scripts/write_config/write.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 scripts/write_config/write.c (limited to 'scripts/write_config/write.c') diff --git a/scripts/write_config/write.c b/scripts/write_config/write.c new file mode 100644 index 0000000..f5a3181 --- /dev/null +++ b/scripts/write_config/write.c @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include "symlist.h" + +int verbose_level; +char *file, *folder; + +int main(int argc, char **argv) { + verbose_level = 1; + int i; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-v")) + verbose_level++; + else if (file == NULL) + file = argv[i]; + else if (folder == NULL) + folder = argv[i]; + else { + Eprintf("Unknown parameter: %s\n", argv[i]); + exit(1); + } + } + + if (file == NULL) { + Eprintf("No Kconfig input file specified\n"); + exit(2); + } + if (folder == NULL) { + Eprintf("No output folder specified\n"); + exit(3); + } + + char *rules_file, *symbol_map_file, *def_config_file; + asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); + asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); + asprintf(&def_config_file, "%s/%s", folder, DEFAULT_DEF_CONFIG_FILE); + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + conf_parse(file); + conf_read(def_config_file); + + FILE *f = fopen(symbol_map_file, "r"); + if (f == NULL) { + Eprintf("Can't open file: %s\n", symbol_map_file); + exit(1); + } + struct symlist *sl = symlist_read(f); + fclose(f); + + return 0; +} -- cgit v1.2.3