aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/config
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-06-25 20:06:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-06-25 20:06:59 +0000
commiteaf2344f8d7169d89d9de7ebbf0459b37a775c40 (patch)
tree7efbe8442bcaf85d1535f57925a790b66b9712d6 /scripts/config
parentb8852bf072d417217feb3b5f89503c1f7b815f82 (diff)
downloadupstream-eaf2344f8d7169d89d9de7ebbf0459b37a775c40.tar.gz
upstream-eaf2344f8d7169d89d9de7ebbf0459b37a775c40.tar.bz2
upstream-eaf2344f8d7169d89d9de7ebbf0459b37a775c40.zip
add 'reset to defaults' to menuconfig
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4080 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts/config')
-rw-r--r--scripts/config/confdata.c23
-rw-r--r--scripts/config/lkc_proto.h1
-rw-r--r--scripts/config/mconf.c5
3 files changed, 29 insertions, 0 deletions
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c
index a1abdeb087..641aa48915 100644
--- a/scripts/config/confdata.c
+++ b/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/scripts/config/lkc_proto.h b/scripts/config/lkc_proto.h
index b6a389c5fc..15fafd01b0 100644
--- a/scripts/config/lkc_proto.h
+++ b/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/scripts/config/mconf.c b/scripts/config/mconf.c
index 2ef24aa5b6..5caf82280d 100644
--- a/scripts/config/mconf.c
+++ b/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;