aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-04-29 01:11:23 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-29 01:11:23 -0400
commit7b7e394185014e0f3bd8989cac937003f20ef9ce (patch)
tree3beda5f979bba0aa9822534e239cf1b45f3be69c /scripts/kconfig
parentddc5d3414593e4d7ad7fbd33e7f7517fcc234544 (diff)
parent693f7d362055261882659475d2ef022e32edbff1 (diff)
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/conf.c24
-rw-r--r--scripts/kconfig/confdata.c2
-rw-r--r--scripts/kconfig/lxdialog/checklist.c19
-rw-r--r--scripts/kconfig/lxdialog/menubox.c19
4 files changed, 25 insertions, 39 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 10eeae53d827..8012d1076876 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -5,6 +5,7 @@
5 5
6#include <ctype.h> 6#include <ctype.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h>
8#include <string.h> 9#include <string.h>
9#include <unistd.h> 10#include <unistd.h>
10#include <time.h> 11#include <time.h>
@@ -63,20 +64,6 @@ static void check_stdin(void)
63 } 64 }
64} 65}
65 66
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) 67static void conf_askvalue(struct symbol *sym, const char *def)
81{ 68{
82 enum symbol_type type = sym_get_type(sym); 69 enum symbol_type type = sym_get_type(sym);
@@ -114,7 +101,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
114 check_stdin(); 101 check_stdin();
115 case ask_all: 102 case ask_all:
116 fflush(stdout); 103 fflush(stdout);
117 fgets_check_stream(line, 128, stdin); 104 fgets(line, 128, stdin);
118 return; 105 return;
119 case set_default: 106 case set_default:
120 printf("%s\n", def); 107 printf("%s\n", def);
@@ -328,8 +315,7 @@ static int conf_choice(struct menu *menu)
328 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 315 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
329 def_sym = sym_get_choice_value(sym); 316 def_sym = sym_get_choice_value(sym);
330 cnt = def = 0; 317 cnt = def = 0;
331 line[0] = '0'; 318 line[0] = 0;
332 line[1] = 0;
333 for (child = menu->list; child; child = child->next) { 319 for (child = menu->list; child; child = child->next) {
334 if (!menu_is_visible(child)) 320 if (!menu_is_visible(child))
335 continue; 321 continue;
@@ -370,7 +356,7 @@ static int conf_choice(struct menu *menu)
370 check_stdin(); 356 check_stdin();
371 case ask_all: 357 case ask_all:
372 fflush(stdout); 358 fflush(stdout);
373 fgets_check_stream(line, 128, stdin); 359 fgets(line, 128, stdin);
374 strip(line); 360 strip(line);
375 if (line[0] == '?') { 361 if (line[0] == '?') {
376 printf("\n%s\n", menu->sym->help ? 362 printf("\n%s\n", menu->sym->help ?
@@ -546,7 +532,7 @@ int main(int ac, char **av)
546 break; 532 break;
547 case 'h': 533 case 'h':
548 case '?': 534 case '?':
549 printf("%s [-o|-s] config\n", av[0]); 535 fprintf(stderr, "See README for usage info\n");
550 exit(0); 536 exit(0);
551 } 537 }
552 } 538 }
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/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index db07ae73e051..be0200e9cdaf 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -196,8 +196,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
196 196
197 print_buttons(dialog, height, width, 0); 197 print_buttons(dialog, height, width, 0);
198 198
199 wnoutrefresh(list);
200 wnoutrefresh(dialog); 199 wnoutrefresh(dialog);
200 wnoutrefresh(list);
201 doupdate(); 201 doupdate();
202 202
203 while (key != ESC) { 203 while (key != ESC) {
@@ -225,12 +225,11 @@ int dialog_checklist(const char *title, const char *prompt, int height,
225 } 225 }
226 scroll--; 226 scroll--;
227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); 227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE);
228 wnoutrefresh(list);
229
230 print_arrows(dialog, choice, item_no, 228 print_arrows(dialog, choice, item_no,
231 scroll, box_y, box_x + check_x + 5, list_height); 229 scroll, box_y, box_x + check_x + 5, list_height);
232 230
233 wrefresh(dialog); 231 wnoutrefresh(dialog);
232 wrefresh(list);
234 233
235 continue; /* wait for another key press */ 234 continue; /* wait for another key press */
236 } else 235 } else
@@ -252,12 +251,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
252 scroll++; 251 scroll++;
253 print_item(list, items[(scroll + max_choice - 1) * 3 + 1], 252 print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
254 status[scroll + max_choice - 1], max_choice - 1, TRUE); 253 status[scroll + max_choice - 1], max_choice - 1, TRUE);
255 wnoutrefresh(list);
256 254
257 print_arrows(dialog, choice, item_no, 255 print_arrows(dialog, choice, item_no,
258 scroll, box_y, box_x + check_x + 5, list_height); 256 scroll, box_y, box_x + check_x + 5, list_height);
259 257
260 wrefresh(dialog); 258 wnoutrefresh(dialog);
259 wrefresh(list);
261 260
262 continue; /* wait for another key press */ 261 continue; /* wait for another key press */
263 } else 262 } else
@@ -271,8 +270,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
271 choice = i; 270 choice = i;
272 print_item(list, items[(scroll + choice) * 3 + 1], 271 print_item(list, items[(scroll + choice) * 3 + 1],
273 status[scroll + choice], choice, TRUE); 272 status[scroll + choice], choice, TRUE);
274 wnoutrefresh(list); 273 wnoutrefresh(dialog);
275 wrefresh(dialog); 274 wrefresh(list);
276 } 275 }
277 continue; /* wait for another key press */ 276 continue; /* wait for another key press */
278 } 277 }
@@ -306,8 +305,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
306 print_item(list, items[(scroll + i) * 3 + 1], 305 print_item(list, items[(scroll + i) * 3 + 1],
307 status[scroll + i], i, i == choice); 306 status[scroll + i], i, i == choice);
308 } 307 }
309 wnoutrefresh(list); 308 wnoutrefresh(dialog);
310 wrefresh(dialog); 309 wrefresh(list);
311 310
312 for (i = 0; i < item_no; i++) 311 for (i = 0; i < item_no; i++)
313 if (status[i]) 312 if (status[i])
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);