diff options
author | Karel Kočí <cynerd@email.cz> | 2015-07-22 11:47:51 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-07-22 11:47:51 +0200 |
commit | ad1a1dd1f2fb8be0c37a31d0c9a53932ec824812 (patch) | |
tree | f180482e1c05f15958063057bcec71efcc0633c9 /scripts/permute_conf/dotconf.c | |
parent | e291e4e7c831f34238bbcda1c39659826f04191c (diff) | |
download | linux-conf-perf-ad1a1dd1f2fb8be0c37a31d0c9a53932ec824812.tar.gz linux-conf-perf-ad1a1dd1f2fb8be0c37a31d0c9a53932ec824812.tar.bz2 linux-conf-perf-ad1a1dd1f2fb8be0c37a31d0c9a53932ec824812.zip |
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.
Diffstat (limited to 'scripts/permute_conf/dotconf.c')
-rw-r--r-- | scripts/permute_conf/dotconf.c | 108 |
1 files changed, 0 insertions, 108 deletions
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); -} |