aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r--scripts/kconfig/conf.c24
1 files changed, 5 insertions, 19 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 }