aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/conf.c21
-rw-r--r--scripts/kconfig/confdata.c2
-rw-r--r--scripts/kconfig/lxdialog/menubox.c19
3 files changed, 14 insertions, 28 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 10eeae53d827..ae5ab981bb1d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -63,20 +63,6 @@ static void check_stdin(void)
63 } 63 }
64} 64}
65 65
66static char *fgets_check_stream(char *s, int size, FILE *stream)
67{
68 char *ret = fgets(s, size, stream);
69
70 if (ret == NULL && feof(stream)) {
71 printf(_("aborted!\n\n"));
72 printf(_("Console input is closed. "));
73 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
74 exit(1);
75 }
76
77 return ret;
78}
79
80static void conf_askvalue(struct symbol *sym, const char *def) 66static void conf_askvalue(struct symbol *sym, const char *def)
81{ 67{
82 enum symbol_type type = sym_get_type(sym); 68 enum symbol_type type = sym_get_type(sym);
@@ -114,7 +100,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
114 check_stdin(); 100 check_stdin();
115 case ask_all: 101 case ask_all:
116 fflush(stdout); 102 fflush(stdout);
117 fgets_check_stream(line, 128, stdin); 103 fgets(line, 128, stdin);
118 return; 104 return;
119 case set_default: 105 case set_default:
120 printf("%s\n", def); 106 printf("%s\n", def);
@@ -328,8 +314,7 @@ static int conf_choice(struct menu *menu)
328 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 314 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
329 def_sym = sym_get_choice_value(sym); 315 def_sym = sym_get_choice_value(sym);
330 cnt = def = 0; 316 cnt = def = 0;
331 line[0] = '0'; 317 line[0] = 0;
332 line[1] = 0;
333 for (child = menu->list; child; child = child->next) { 318 for (child = menu->list; child; child = child->next) {
334 if (!menu_is_visible(child)) 319 if (!menu_is_visible(child))
335 continue; 320 continue;
@@ -370,7 +355,7 @@ static int conf_choice(struct menu *menu)
370 check_stdin(); 355 check_stdin();
371 case ask_all: 356 case ask_all:
372 fflush(stdout); 357 fflush(stdout);
373 fgets_check_stream(line, 128, stdin); 358 fgets(line, 128, stdin);
374 strip(line); 359 strip(line);
375 if (line[0] == '?') { 360 if (line[0] == '?') {
376 printf("\n%s\n", menu->sym->help ? 361 printf("\n%s\n", menu->sym->help ?
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 1b8882ddbc74..1b5df589f3ae 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -325,7 +325,7 @@ int conf_read(const char *name)
325 sym->flags |= e->right.sym->flags & SYMBOL_NEW; 325 sym->flags |= e->right.sym->flags & SYMBOL_NEW;
326 } 326 }
327 327
328 sym_change_count = conf_warnings && conf_unsaved; 328 sym_change_count = conf_warnings || conf_unsaved;
329 329
330 return 0; 330 return 0;
331} 331}
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 09512b544375..bf8052f4fd4a 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -58,8 +58,7 @@
58 58
59#include "dialog.h" 59#include "dialog.h"
60 60
61#define ITEM_IDENT 1 /* Indent of menu entries. Fixed for all menus */ 61static int menu_width, item_x;
62static int menu_width;
63 62
64/* 63/*
65 * Print menu item 64 * Print menu item
@@ -70,7 +69,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
70 int j; 69 int j;
71 char *menu_item = malloc(menu_width + 1); 70 char *menu_item = malloc(menu_width + 1);
72 71
73 strncpy(menu_item, item, menu_width - ITEM_IDENT); 72 strncpy(menu_item, item, menu_width - item_x);
74 menu_item[menu_width] = 0; 73 menu_item[menu_width] = 0;
75 j = first_alpha(menu_item, "YyNnMmHh"); 74 j = first_alpha(menu_item, "YyNnMmHh");
76 75
@@ -87,13 +86,13 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
87 wclrtoeol(win); 86 wclrtoeol(win);
88#endif 87#endif
89 wattrset(win, selected ? item_selected_attr : item_attr); 88 wattrset(win, selected ? item_selected_attr : item_attr);
90 mvwaddstr(win, choice, ITEM_IDENT, menu_item); 89 mvwaddstr(win, choice, item_x, menu_item);
91 if (hotkey) { 90 if (hotkey) {
92 wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); 91 wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
93 mvwaddch(win, choice, ITEM_IDENT + j, menu_item[j]); 92 mvwaddch(win, choice, item_x + j, menu_item[j]);
94 } 93 }
95 if (selected) { 94 if (selected) {
96 wmove(win, choice, ITEM_IDENT + 1); 95 wmove(win, choice, item_x + 1);
97 } 96 }
98 free(menu_item); 97 free(menu_item);
99 wrefresh(win); 98 wrefresh(win);
@@ -227,6 +226,8 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
227 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, 226 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
228 menubox_border_attr, menubox_attr); 227 menubox_border_attr, menubox_attr);
229 228
229 item_x = (menu_width - 70) / 2;
230
230 /* Set choice to default item */ 231 /* Set choice to default item */
231 for (i = 0; i < item_no; i++) 232 for (i = 0; i < item_no; i++)
232 if (strcmp(current, items[i * 2]) == 0) 233 if (strcmp(current, items[i * 2]) == 0)
@@ -263,10 +264,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
263 wnoutrefresh(menu); 264 wnoutrefresh(menu);
264 265
265 print_arrows(dialog, item_no, scroll, 266 print_arrows(dialog, item_no, scroll,
266 box_y, box_x + ITEM_IDENT + 1, menu_height); 267 box_y, box_x + item_x + 1, menu_height);
267 268
268 print_buttons(dialog, height, width, 0); 269 print_buttons(dialog, height, width, 0);
269 wmove(menu, choice, ITEM_IDENT + 1); 270 wmove(menu, choice, item_x + 1);
270 wrefresh(menu); 271 wrefresh(menu);
271 272
272 while (key != ESC) { 273 while (key != ESC) {
@@ -349,7 +350,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
349 print_item(scroll + choice, choice, TRUE); 350 print_item(scroll + choice, choice, TRUE);
350 351
351 print_arrows(dialog, item_no, scroll, 352 print_arrows(dialog, item_no, scroll,
352 box_y, box_x + ITEM_IDENT + 1, menu_height); 353 box_y, box_x + item_x + 1, menu_height);
353 354
354 wnoutrefresh(dialog); 355 wnoutrefresh(dialog);
355 wrefresh(menu); 356 wrefresh(menu);