diff options
author | Karel Kočí <cynerd@email.cz> | 2015-05-14 15:20:34 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-05-14 15:20:34 +0200 |
commit | cf271a82276a19917638de856a9d10f3b1ceb488 (patch) | |
tree | a7bad80c1300e0504cd69885269ac81b642c33f9 /scripts/permute/dotconf.c | |
parent | 71ffeac967944bfd4f61d1f5724c8aed9d6d35a3 (diff) | |
download | linux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.tar.gz linux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.tar.bz2 linux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.zip |
Fix problems with permute
Permute should now reading and loading configurations right.
In case of configuration change, forces save.
Diffstat (limited to 'scripts/permute/dotconf.c')
-rw-r--r-- | scripts/permute/dotconf.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/scripts/permute/dotconf.c b/scripts/permute/dotconf.c index aba607e..bf8e067 100644 --- a/scripts/permute/dotconf.c +++ b/scripts/permute/dotconf.c @@ -1,23 +1,28 @@ #include "dotconf.h" -bool dotconfig_read(void) { +void dotconfig_read(bool * reqsave) { FILE *f; f = fopen(DOTCONFIG_FILE, "r"); - if (f == NULL) - return false; + 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] == '#') { - } else { + 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) @@ -68,8 +73,6 @@ bool dotconfig_read(void) { if (wmenu == NULL && stack_pos > 0) wmenu = stack[--stack_pos]; } - - return true; } void dotconfig_write(void) { @@ -81,8 +84,8 @@ void dotconfig_write(void) { int i; unsigned variable = 0, fixed = 0; for_all_symbols(i, sym) - if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) - && sym->name != NULL) { + 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) { @@ -92,8 +95,9 @@ void dotconfig_write(void) { break; } else { variable++; - printf("%s\n=%s\n", sym->name, - sym_get_tristate_value(sym) == no ? "n" : "y"); + if (verbose_level > 1) + printf("%s=%s\n", sym->name, + sym_get_tristate_value(sym) == no ? "n" : "y"); } } } |