conf.c (448cc2fb3a7b327823a9afd374808c37b8e6194f) conf.c (c39afe624853e39af243dd9832640bf9c80b6554)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 */
5
6#include <ctype.h>
7#include <limits.h>
8#include <stdio.h>

--- 21 unchanged lines hidden (view full) ---

30 randconfig,
31 defconfig,
32 savedefconfig,
33 listnewconfig,
34 helpnewconfig,
35 olddefconfig,
36 yes2modconfig,
37 mod2yesconfig,
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 */
5
6#include <ctype.h>
7#include <limits.h>
8#include <stdio.h>

--- 21 unchanged lines hidden (view full) ---

30 randconfig,
31 defconfig,
32 savedefconfig,
33 listnewconfig,
34 helpnewconfig,
35 olddefconfig,
36 yes2modconfig,
37 mod2yesconfig,
38 mod2noconfig,
38};
39static enum input_mode input_mode = oldaskconfig;
40static int input_mode_opt;
41static int indent = 1;
42static int tty_stdio;
43static int sync_kconfig;
44static int conf_cnt;
45static char line[PATH_MAX];

--- 112 unchanged lines hidden (view full) ---

158
159 return true;
160}
161
162enum conf_def_mode {
163 def_default,
164 def_yes,
165 def_mod,
39};
40static enum input_mode input_mode = oldaskconfig;
41static int input_mode_opt;
42static int indent = 1;
43static int tty_stdio;
44static int sync_kconfig;
45static int conf_cnt;
46static char line[PATH_MAX];

--- 112 unchanged lines hidden (view full) ---

159
160 return true;
161}
162
163enum conf_def_mode {
164 def_default,
165 def_yes,
166 def_mod,
166 def_y2m,
167 def_m2y,
168 def_no,
169 def_random
170};
171
172static bool conf_set_all_new_symbols(enum conf_def_mode mode)
173{
174 struct symbol *sym, *csym;
175 int i, cnt;

--- 121 unchanged lines hidden (view full) ---

297 set_all_choice_values(csym);
298 has_changed = true;
299 }
300 }
301
302 return has_changed;
303}
304
167 def_no,
168 def_random
169};
170
171static bool conf_set_all_new_symbols(enum conf_def_mode mode)
172{
173 struct symbol *sym, *csym;
174 int i, cnt;

--- 121 unchanged lines hidden (view full) ---

296 set_all_choice_values(csym);
297 has_changed = true;
298 }
299 }
300
301 return has_changed;
302}
303
305static void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
304static void conf_rewrite_tristates(tristate old_val, tristate new_val)
306{
307 struct symbol *sym;
308 int i;
305{
306 struct symbol *sym;
307 int i;
309 tristate old_val = (mode == def_y2m) ? yes : mod;
310 tristate new_val = (mode == def_y2m) ? mod : yes;
311
312 for_all_symbols(i, sym) {
313 if (sym_get_type(sym) == S_TRISTATE &&
314 sym->def[S_DEF_USER].tri == old_val)
315 sym->def[S_DEF_USER].tri = new_val;
316 }
317 sym_clear_all_valid();
318}

--- 361 unchanged lines hidden (view full) ---

680 {"allmodconfig", no_argument, &input_mode_opt, allmodconfig},
681 {"alldefconfig", no_argument, &input_mode_opt, alldefconfig},
682 {"randconfig", no_argument, &input_mode_opt, randconfig},
683 {"listnewconfig", no_argument, &input_mode_opt, listnewconfig},
684 {"helpnewconfig", no_argument, &input_mode_opt, helpnewconfig},
685 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
686 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
687 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},
308
309 for_all_symbols(i, sym) {
310 if (sym_get_type(sym) == S_TRISTATE &&
311 sym->def[S_DEF_USER].tri == old_val)
312 sym->def[S_DEF_USER].tri = new_val;
313 }
314 sym_clear_all_valid();
315}

--- 361 unchanged lines hidden (view full) ---

677 {"allmodconfig", no_argument, &input_mode_opt, allmodconfig},
678 {"alldefconfig", no_argument, &input_mode_opt, alldefconfig},
679 {"randconfig", no_argument, &input_mode_opt, randconfig},
680 {"listnewconfig", no_argument, &input_mode_opt, listnewconfig},
681 {"helpnewconfig", no_argument, &input_mode_opt, helpnewconfig},
682 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
683 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
684 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},
685 {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig},
688 {NULL, 0, NULL, 0}
689};
690
691static void conf_usage(const char *progname)
692{
693 printf("Usage: %s [options] <kconfig-file>\n", progname);
694 printf("\n");
695 printf("Generic options:\n");

--- 12 unchanged lines hidden (view full) ---

708 printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
709 printf(" --allnoconfig New config where all options are answered with no\n");
710 printf(" --allyesconfig New config where all options are answered with yes\n");
711 printf(" --allmodconfig New config where all options are answered with mod\n");
712 printf(" --alldefconfig New config with all symbols set to default\n");
713 printf(" --randconfig New config with random answer to all options\n");
714 printf(" --yes2modconfig Change answers from yes to mod if possible\n");
715 printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
686 {NULL, 0, NULL, 0}
687};
688
689static void conf_usage(const char *progname)
690{
691 printf("Usage: %s [options] <kconfig-file>\n", progname);
692 printf("\n");
693 printf("Generic options:\n");

--- 12 unchanged lines hidden (view full) ---

706 printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
707 printf(" --allnoconfig New config where all options are answered with no\n");
708 printf(" --allyesconfig New config where all options are answered with yes\n");
709 printf(" --allmodconfig New config where all options are answered with mod\n");
710 printf(" --alldefconfig New config with all symbols set to default\n");
711 printf(" --randconfig New config with random answer to all options\n");
712 printf(" --yes2modconfig Change answers from yes to mod if possible\n");
713 printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
714 printf(" --mod2noconfig Change answers from mod to no if possible\n");
716 printf(" (If none of the above is given, --oldaskconfig is the default)\n");
717}
718
719int main(int ac, char **av)
720{
721 const char *progname = av[0];
722 int opt;
723 const char *name, *defconfig_file = NULL /* gcc uninit */;

--- 59 unchanged lines hidden (view full) ---

783 case syncconfig:
784 case oldaskconfig:
785 case oldconfig:
786 case listnewconfig:
787 case helpnewconfig:
788 case olddefconfig:
789 case yes2modconfig:
790 case mod2yesconfig:
715 printf(" (If none of the above is given, --oldaskconfig is the default)\n");
716}
717
718int main(int ac, char **av)
719{
720 const char *progname = av[0];
721 int opt;
722 const char *name, *defconfig_file = NULL /* gcc uninit */;

--- 59 unchanged lines hidden (view full) ---

782 case syncconfig:
783 case oldaskconfig:
784 case oldconfig:
785 case listnewconfig:
786 case helpnewconfig:
787 case olddefconfig:
788 case yes2modconfig:
789 case mod2yesconfig:
790 case mod2noconfig:
791 conf_read(NULL);
792 break;
793 case allnoconfig:
794 case allyesconfig:
795 case allmodconfig:
796 case alldefconfig:
797 case randconfig:
798 name = getenv("KCONFIG_ALLCONFIG");

--- 58 unchanged lines hidden (view full) ---

857 while (conf_set_all_new_symbols(def_random)) ;
858 break;
859 case defconfig:
860 conf_set_all_new_symbols(def_default);
861 break;
862 case savedefconfig:
863 break;
864 case yes2modconfig:
791 conf_read(NULL);
792 break;
793 case allnoconfig:
794 case allyesconfig:
795 case allmodconfig:
796 case alldefconfig:
797 case randconfig:
798 name = getenv("KCONFIG_ALLCONFIG");

--- 58 unchanged lines hidden (view full) ---

857 while (conf_set_all_new_symbols(def_random)) ;
858 break;
859 case defconfig:
860 conf_set_all_new_symbols(def_default);
861 break;
862 case savedefconfig:
863 break;
864 case yes2modconfig:
865 conf_rewrite_mod_or_yes(def_y2m);
865 conf_rewrite_tristates(yes, mod);
866 break;
867 case mod2yesconfig:
866 break;
867 case mod2yesconfig:
868 conf_rewrite_mod_or_yes(def_m2y);
868 conf_rewrite_tristates(mod, yes);
869 break;
869 break;
870 case mod2noconfig:
871 conf_rewrite_tristates(mod, no);
872 break;
870 case oldaskconfig:
871 rootEntry = &rootmenu;
872 conf(&rootmenu);
873 input_mode = oldconfig;
874 /* fall through */
875 case oldconfig:
876 case listnewconfig:
877 case helpnewconfig:

--- 41 unchanged lines hidden ---
873 case oldaskconfig:
874 rootEntry = &rootmenu;
875 conf(&rootmenu);
876 input_mode = oldconfig;
877 /* fall through */
878 case oldconfig:
879 case listnewconfig:
880 case helpnewconfig:

--- 41 unchanged lines hidden ---