1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-19 06:54:58 +01:00

add 'reset to defaults' to menuconfig

SVN-Revision: 4080
This commit is contained in:
Felix Fietkau 2006-06-25 20:06:59 +00:00
parent 611f3ded07
commit 49e12766bc
3 changed files with 29 additions and 0 deletions

@ -83,6 +83,29 @@ char *conf_get_default_confname(void)
return name; return name;
} }
void conf_reset(void)
{
struct symbol *sym;
int i;
for_all_symbols(i, sym) {
sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED;
if (sym_is_choice(sym))
sym->flags &= ~SYMBOL_NEW;
sym->flags &= ~SYMBOL_VALID;
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
if (sym->user.val)
free(sym->user.val);
default:
sym->user.val = NULL;
sym->user.tri = no;
}
}
}
int conf_read_simple(const char *name) int conf_read_simple(const char *name)
{ {
FILE *in = NULL; FILE *in = NULL;

@ -2,6 +2,7 @@
/* confdata.c */ /* confdata.c */
P(conf_parse,void,(const char *name)); P(conf_parse,void,(const char *name));
P(conf_read,int,(const char *name)); P(conf_read,int,(const char *name));
P(conf_reset,void,(void));
P(conf_read_simple,int,(const char *name)); P(conf_read_simple,int,(const char *name));
P(conf_write,int,(const char *name)); P(conf_write,int,(const char *name));

@ -737,6 +737,8 @@ static void conf(struct menu *menu)
if (menu == &rootmenu) { if (menu == &rootmenu) {
cprint(":"); cprint(":");
cprint("--- "); cprint("--- ");
cprint("D");
cprint(_(" Reset to defaults"));
cprint("L"); cprint("L");
cprint(_(" Load an Alternate Configuration File")); cprint(_(" Load an Alternate Configuration File"));
cprint("S"); cprint("S");
@ -783,6 +785,9 @@ static void conf(struct menu *menu)
case 's': case 's':
conf_string(submenu); conf_string(submenu);
break; break;
case 'D':
conf_reset();
break;
case 'L': case 'L':
conf_load(); conf_load();
break; break;