1818
1919static void conf (struct menu * menu );
2020static void check_conf (struct menu * menu );
21+ static void xfgets (char * str , int size , FILE * in );
2122
2223enum input_mode {
2324 oldaskconfig ,
@@ -34,8 +35,6 @@ enum input_mode {
3435 oldnoconfig ,
3536} input_mode = oldaskconfig ;
3637
37- char * defconfig_file ;
38-
3938static int indent = 1 ;
4039static int valid_stdin = 1 ;
4140static int sync_kconfig ;
@@ -459,10 +458,30 @@ static struct option long_opts[] = {
459458 {NULL , 0 , NULL , 0 }
460459};
461460
461+ static 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+
462480int main (int ac , char * * av )
463481{
482+ const char * progname = av [0 ];
464483 int opt ;
465- const char * name ;
484+ const char * name , * defconfig_file = NULL /* gcc uninit */ ;
466485 struct stat tmpstat ;
467486
468487 setlocale (LC_ALL , "" );
@@ -494,14 +513,24 @@ int main(int ac, char **av)
494513 srand (seed );
495514 break ;
496515 }
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 ;
497525 case '?' :
498- fprintf ( stderr , _ ( "See README for usage info\n" ) );
526+ conf_usage ( progname );
499527 exit (1 );
500528 break ;
501529 }
502530 }
503531 if (ac == optind ) {
504532 printf (_ ("%s: Kconfig file missing\n" ), av [0 ]);
533+ conf_usage (progname );
505534 exit (1 );
506535 }
507536 name = av [optind ];
@@ -644,13 +673,11 @@ int main(int ac, char **av)
644673 }
645674 return 0 ;
646675}
676+
647677/*
648678 * Helper function to facilitate fgets() by Jean Sacren.
649679 */
650- void xfgets (str , size , in )
651- char * str ;
652- int size ;
653- FILE * in ;
680+ void xfgets (char * str , int size , FILE * in )
654681{
655682 if (fgets (str , size , in ) == NULL )
656683 fprintf (stderr , "\nError in reading or end of file.\n" );
0 commit comments