From ad1a1dd1f2fb8be0c37a31d0c9a53932ec824812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 22 Jul 2015 11:47:51 +0200 Subject: Remove permute_conf permute_conf was only temporally program for generating dot_config file. Its main function now has program allconfig. This program has also some text interface, but it wasn't optimal and in the end wasn't used at all. --- scripts/permute_conf/dotconf.c | 108 ----------------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 scripts/permute_conf/dotconf.c (limited to 'scripts/permute_conf/dotconf.c') diff --git a/scripts/permute_conf/dotconf.c b/scripts/permute_conf/dotconf.c deleted file mode 100644 index bf8e067..0000000 --- a/scripts/permute_conf/dotconf.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "dotconf.h" - -void dotconfig_read(bool * reqsave) { - FILE *f; - f = fopen(DOTCONFIG_FILE, "r"); - if (f == NULL) { - *reqsave = true; - return; - } - - char buffer[READBUFFER_SIZE]; - while (fgets(buffer, READBUFFER_SIZE, f) != NULL) { - if (buffer[0] == '\0' || buffer[1] == '\0') - continue; - if (buffer[0] != '#') { - char *wstr = buffer + 7; - char *end = strchr(wstr, '='); - *end = '\0'; - struct symbol *sym = sym_find(wstr); - if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) - continue; - if ((sym_get_tristate_value(sym) == yes && *(end + 1) != 'y') - || (sym_get_tristate_value(sym) == no - && *(end + 1) != 'n')) - *reqsave = true; - struct property *prop; - for_all_prompts(sym, prop) { - if (prop->menu->data == NULL) - prop->menu->data = menudata_new(); - } - } - } - - fclose(f); - - struct menu *wmenu; - struct menu **stack; - size_t stack_size = 2, stack_pos = 0; - stack = malloc(stack_size * sizeof(struct menu *)); - wmenu = rootmenu.list; - while (wmenu != NULL) { - if (wmenu->list != NULL) { - if (stack_pos >= stack_size) { - stack_size *= 2; - stack = realloc(stack, stack_size * sizeof(struct menu *)); - } - stack[stack_pos++] = wmenu->list; - } - if (wmenu->data == NULL) { - if (wmenu->sym == NULL || wmenu->sym->name == NULL) { - wmenu->data = menudata_new(); - } else { - wmenu->data = menudata_new(); - menudata_set_permute(wmenu, true); - } - } - wmenu = wmenu->next; - if (wmenu == NULL && stack_pos > 0) - wmenu = stack[--stack_pos]; - } - while (wmenu != NULL) { - if (wmenu->list != NULL) - stack[stack_pos++] = wmenu->list; - if (wmenu->data == NULL) { - if (wmenu->sym == NULL || wmenu->sym->name == NULL) { - wmenu->data = menudata_new(); - } else { - wmenu->data = menudata_new(); - menudata_set_permute(wmenu, true); - } - } - wmenu = wmenu->next; - if (wmenu == NULL && stack_pos > 0) - wmenu = stack[--stack_pos]; - } -} - -void dotconfig_write(void) { - FILE *f; - f = fopen(DOTCONFIG_FILE, "w"); - - struct symbol *sym; - struct property *prop; - int i; - unsigned variable = 0, fixed = 0; - for_all_symbols(i, sym) - if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) - && sym->name != NULL) { - for_all_prompts(sym, prop) { - if (prop->menu->data == NULL - || !((struct menudata *) prop->menu->data)->permute) { - fprintf(f, "CONFIG_%s=%s\n", sym->name, - sym_get_tristate_value(sym) == no ? "n" : "y"); - fixed++; - break; - } else { - variable++; - if (verbose_level > 1) - printf("%s=%s\n", sym->name, - sym_get_tristate_value(sym) == no ? "n" : "y"); - } - } - } - - printf("Variable: %d, Fixed: %d\n", variable, fixed); - - fclose(f); -} -- cgit v1.2.3