summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r--scripts/kconfig/conf.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 08c05bcc82c9..f208f900ed3a 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -18,6 +18,7 @@
18 18
19static void conf(struct menu *menu); 19static void conf(struct menu *menu);
20static void check_conf(struct menu *menu); 20static void check_conf(struct menu *menu);
21static void xfgets(char *str, int size, FILE *in);
21 22
22enum input_mode { 23enum input_mode {
23 oldaskconfig, 24 oldaskconfig,
@@ -34,8 +35,6 @@ enum input_mode {
34 oldnoconfig, 35 oldnoconfig,
35} input_mode = oldaskconfig; 36} input_mode = oldaskconfig;
36 37
37char *defconfig_file;
38
39static int indent = 1; 38static int indent = 1;
40static int valid_stdin = 1; 39static int valid_stdin = 1;
41static int sync_kconfig; 40static int sync_kconfig;
@@ -459,10 +458,30 @@ static struct option long_opts[] = {
459 {NULL, 0, NULL, 0} 458 {NULL, 0, NULL, 0}
460}; 459};
461 460
461static void conf_usage(const char *progname)
462{
463
464 printf("Usage: %s [option] <kconfig-file>\n", progname);
465 printf("[option] is _one_ of the following:\n");
466 printf(" --listnewconfig List new options\n");
467 printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
468 printf(" --oldconfig Update a configuration using a provided .config as base\n");
469 printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n");
470 printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n");
471 printf(" --defconfig <file> New config with default defined in <file>\n");
472 printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
473 printf(" --allnoconfig New config where all options are answered with no\n");
474 printf(" --allyesconfig New config where all options are answered with yes\n");
475 printf(" --allmodconfig New config where all options are answered with mod\n");
476 printf(" --alldefconfig New config with all symbols set to default\n");
477 printf(" --randconfig New config with random answer to all options\n");
478}
479
462int main(int ac, char **av) 480int main(int ac, char **av)
463{ 481{
482 const char *progname = av[0];
464 int opt; 483 int opt;
465 const char *name; 484 const char *name, *defconfig_file = NULL /* gcc uninit */;
466 struct stat tmpstat; 485 struct stat tmpstat;
467 486
468 setlocale(LC_ALL, ""); 487 setlocale(LC_ALL, "");
@@ -494,14 +513,24 @@ int main(int ac, char **av)
494 srand(seed); 513 srand(seed);
495 break; 514 break;
496 } 515 }
516 case oldaskconfig:
517 case oldconfig:
518 case allnoconfig:
519 case allyesconfig:
520 case allmodconfig:
521 case alldefconfig:
522 case listnewconfig:
523 case oldnoconfig:
524 break;
497 case '?': 525 case '?':
498 fprintf(stderr, _("See README for usage info\n")); 526 conf_usage(progname);
499 exit(1); 527 exit(1);
500 break; 528 break;
501 } 529 }
502 } 530 }
503 if (ac == optind) { 531 if (ac == optind) {
504 printf(_("%s: Kconfig file missing\n"), av[0]); 532 printf(_("%s: Kconfig file missing\n"), av[0]);
533 conf_usage(progname);
505 exit(1); 534 exit(1);
506 } 535 }
507 name = av[optind]; 536 name = av[optind];
@@ -644,13 +673,11 @@ int main(int ac, char **av)
644 } 673 }
645 return 0; 674 return 0;
646} 675}
676
647/* 677/*
648 * Helper function to facilitate fgets() by Jean Sacren. 678 * Helper function to facilitate fgets() by Jean Sacren.
649 */ 679 */
650void xfgets(str, size, in) 680void xfgets(char *str, int size, FILE *in)
651 char *str;
652 int size;
653 FILE *in;
654{ 681{
655 if (fgets(str, size, in) == NULL) 682 if (fgets(str, size, in) == NULL)
656 fprintf(stderr, "\nError in reading or end of file.\n"); 683 fprintf(stderr, "\nError in reading or end of file.\n");