Commit ddc97cac authored by Roman Zippel's avatar Roman Zippel Committed by Sam Ravnborg

kconfig: improve config load/save output

During loading special case the first common case (.config), be silent about
it and otherwise mark it as a change that requires saving.  Instead output
that the file has been changed.  IOW if conf does nothing (special), it's
silent.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 909252d2
...@@ -98,6 +98,13 @@ int conf_read_simple(const char *name) ...@@ -98,6 +98,13 @@ int conf_read_simple(const char *name)
in = zconf_fopen(name); in = zconf_fopen(name);
} else { } else {
const char **names = conf_confnames; const char **names = conf_confnames;
name = *names++;
if (!name)
return 1;
in = zconf_fopen(name);
if (in)
goto load;
sym_change_count++;
while ((name = *names++)) { while ((name = *names++)) {
name = conf_expand_value(name); name = conf_expand_value(name);
in = zconf_fopen(name); in = zconf_fopen(name);
...@@ -105,13 +112,14 @@ int conf_read_simple(const char *name) ...@@ -105,13 +112,14 @@ int conf_read_simple(const char *name)
printf(_("#\n" printf(_("#\n"
"# using defaults found in %s\n" "# using defaults found in %s\n"
"#\n"), name); "#\n"), name);
break; goto load;
} }
} }
} }
if (!in) if (!in)
return 1; return 1;
load:
conf_filename = name; conf_filename = name;
conf_lineno = 0; conf_lineno = 0;
conf_warnings = 0; conf_warnings = 0;
...@@ -275,6 +283,8 @@ int conf_read(const char *name) ...@@ -275,6 +283,8 @@ int conf_read(const char *name)
struct expr *e; struct expr *e;
int i; int i;
sym_change_count = 0;
if (conf_read_simple(name)) if (conf_read_simple(name))
return 1; return 1;
...@@ -325,7 +335,7 @@ int conf_read(const char *name) ...@@ -325,7 +335,7 @@ int conf_read(const char *name)
sym->flags |= e->right.sym->flags & SYMBOL_NEW; sym->flags |= e->right.sym->flags & SYMBOL_NEW;
} }
sym_change_count = conf_warnings || conf_unsaved; sym_change_count += conf_warnings || conf_unsaved;
return 0; return 0;
} }
...@@ -524,6 +534,10 @@ int conf_write(const char *name) ...@@ -524,6 +534,10 @@ int conf_write(const char *name)
if (rename(newname, tmpname)) if (rename(newname, tmpname))
return 1; return 1;
printf(_("#\n"
"# configuration written to %s\n"
"#\n"), tmpname);
sym_change_count = 0; sym_change_count = 0;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment