add 'reset to defaults' to menuconfig
authorFelix Fietkau <nbd@openwrt.org>
Sun, 25 Jun 2006 20:06:59 +0000 (20:06 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 25 Jun 2006 20:06:59 +0000 (20:06 +0000)
SVN-Revision: 4080

openwrt/scripts/config/confdata.c
openwrt/scripts/config/lkc_proto.h
openwrt/scripts/config/mconf.c

index a1abdeb08733829162584f4d866e7342c0a5742f..641aa489153ca4451619fb987cc4d500faf616da 100644 (file)
@@ -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;
index b6a389c5fcbde1ca9f4e25b05a1813b056f7c632..15fafd01b0818fe259b820e18a8a831046fd4a54 100644 (file)
@@ -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));
 
index 2ef24aa5b69c11dbdb898e31a0b91c6ae507bc57..5caf82280dec9ca1d01ecffdd52fe59b20699086 100644 (file)
@@ -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;