diff options
author | Felix Fietkau <nbd@openwrt.org> | 2006-06-25 20:06:59 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2006-06-25 20:06:59 +0000 |
commit | 49e12766bcd39a771cb85bb5671ab0ea3ee8d7ad (patch) | |
tree | 3e15a2bcdb143071e0cc80a7b9ca78f1417fcca9 | |
parent | 611f3ded07fb4f1cb767e753e1f6a8b716dfeb3a (diff) | |
download | mtk-20170518-49e12766bcd39a771cb85bb5671ab0ea3ee8d7ad.zip mtk-20170518-49e12766bcd39a771cb85bb5671ab0ea3ee8d7ad.tar.gz mtk-20170518-49e12766bcd39a771cb85bb5671ab0ea3ee8d7ad.tar.bz2 |
add 'reset to defaults' to menuconfig
SVN-Revision: 4080
-rw-r--r-- | openwrt/scripts/config/confdata.c | 23 | ||||
-rw-r--r-- | openwrt/scripts/config/lkc_proto.h | 1 | ||||
-rw-r--r-- | openwrt/scripts/config/mconf.c | 5 |
3 files changed, 29 insertions, 0 deletions
diff --git a/openwrt/scripts/config/confdata.c b/openwrt/scripts/config/confdata.c index a1abdeb..641aa48 100644 --- a/openwrt/scripts/config/confdata.c +++ b/openwrt/scripts/config/confdata.c @@ -83,6 +83,29 @@ char *conf_get_default_confname(void) 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) { FILE *in = NULL; diff --git a/openwrt/scripts/config/lkc_proto.h b/openwrt/scripts/config/lkc_proto.h index b6a389c..15fafd0 100644 --- a/openwrt/scripts/config/lkc_proto.h +++ b/openwrt/scripts/config/lkc_proto.h @@ -2,6 +2,7 @@ /* confdata.c */ P(conf_parse,void,(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_write,int,(const char *name)); diff --git a/openwrt/scripts/config/mconf.c b/openwrt/scripts/config/mconf.c index 2ef24aa..5caf822 100644 --- a/openwrt/scripts/config/mconf.c +++ b/openwrt/scripts/config/mconf.c @@ -737,6 +737,8 @@ static void conf(struct menu *menu) if (menu == &rootmenu) { cprint(":"); cprint("--- "); + cprint("D"); + cprint(_(" Reset to defaults")); cprint("L"); cprint(_(" Load an Alternate Configuration File")); cprint("S"); @@ -783,6 +785,9 @@ static void conf(struct menu *menu) case 's': conf_string(submenu); break; + case 'D': + conf_reset(); + break; case 'L': conf_load(); break; |