7 #include <kconfig/lkc.h>
9 #include <build_files.h>
13 #define INPUT_SIZE 1024
20 void printf_help(void);
23 int main(int argc, char **argv) {
26 for (i = 1; i < argc; i++) {
27 if (!strcmp(argv[i], "-v"))
29 else if (file == NULL)
32 Eprintf("Unknown parameter: %s\n", argv[i]);
38 Eprintf("No Kconfig input file specified\n");
42 setlocale(LC_ALL, "");
43 bindtextdomain(PACKAGE, LOCALEDIR);
49 dotconfig_read(&reqsave);
51 struct menu *wroot, *wmenu, *wwmenu;
56 input = malloc(INPUT_SIZE * sizeof(char));
60 rootmenu.data = menudata_new();
62 printf("\n%s\n", wroot->prompt->text);
65 while (wmenu != NULL) {
66 if (wmenu->prompt != NULL
67 && (wmenu->sym == NULL || wmenu->sym->type == S_BOOLEAN
68 || wmenu->sym->type == S_TRISTATE
69 || wmenu->sym->type == S_OTHER)) {
70 if (wmenu->data == NULL)
71 wmenu->data = menudata_new();
72 printf("%3d", ++menucount);
73 if (((struct menudata *) wmenu->data)->permute) {
75 } else if (((struct menudata *) wmenu->data)->subpermute) {
80 if (wmenu->sym == NULL || sym_is_choice(wmenu->sym))
81 printf(" %s -->\n", wmenu->prompt->text);
83 printf(" %s\n", wmenu->prompt->text);
90 fgets(input, INPUT_SIZE, stdin);
95 inputi = atoi(input + 1);
96 if (inputi <= 0 && inputi > menucount)
101 if (wwmenu->prompt != NULL
102 && (wwmenu->sym == NULL
103 || wwmenu->sym->type == S_BOOLEAN
104 || wwmenu->sym->type == S_TRISTATE
105 || wwmenu->sym->type == S_OTHER))
109 wwmenu = wwmenu->next;
113 if (wroot->parent == NULL)
115 wroot = wroot->parent;
120 printf("Configuration saved...\n");
132 if (wwmenu->list != NULL)
138 if (input[1] == 'a') {
139 menudata_set_all_permute(wwmenu, true);
141 menudata_set_permute(wwmenu, true);
146 menudata_set_permute(wwmenu, false);
158 void printf_help(void) {
159 printf("As input are accepted these commands:\n");
160 printf(" e <NUM> Enter menu according to number.\n");
161 printf(" u Go to previous upper menu.\n");
162 printf(" v <NUM> Set config as variable.\n");
163 printf(" va <NUM> Set menu and all its submenus as variable.\n");
164 printf(" f <NUM> Set menu and all its submenus as fixed.\n");
165 printf(" s Save settings.\n");
166 printf(" r Reprint menu.\n");
167 printf(" h Prints this text.\n");
168 printf(" q Quit this program\n");
171 void exit_save(void) {
174 printf("Unsaved chages. Save (y/N): ");
175 int ch = fgetc(stdin);
176 if (ch == 'y' || ch == 'Y') {
178 printf("Configuration saved.\n");