aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2011-07-04 05:24:10 -0400
committerMichal Marek <mmarek@suse.cz>2011-07-04 05:24:10 -0400
commit5c74cd4cc7e7ad9117789e0ca22892a42f87d890 (patch)
tree139e419539a43b759cecb3fed618f8c1a6cce556 /scripts/kconfig
parente54e692ba613c2170c66ce36a3791c009680af08 (diff)
parentab63f58f253c3eca620347f5180ca3d6a1b6aa38 (diff)
Merge branch 'kconfig-trivial' of git://github.com/lacombar/linux-2.6 into kbuild/kconfig
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/conf.c43
-rw-r--r--scripts/kconfig/expr.c12
-rw-r--r--scripts/kconfig/lkc.h6
3 files changed, 39 insertions, 22 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");
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 792c62ed9d63..290ce41f8ba4 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -13,8 +13,7 @@
13 13
14struct expr *expr_alloc_symbol(struct symbol *sym) 14struct expr *expr_alloc_symbol(struct symbol *sym)
15{ 15{
16 struct expr *e = malloc(sizeof(*e)); 16 struct expr *e = calloc(1, sizeof(*e));
17 memset(e, 0, sizeof(*e));
18 e->type = E_SYMBOL; 17 e->type = E_SYMBOL;
19 e->left.sym = sym; 18 e->left.sym = sym;
20 return e; 19 return e;
@@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
22 21
23struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) 22struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
24{ 23{
25 struct expr *e = malloc(sizeof(*e)); 24 struct expr *e = calloc(1, sizeof(*e));
26 memset(e, 0, sizeof(*e));
27 e->type = type; 25 e->type = type;
28 e->left.expr = ce; 26 e->left.expr = ce;
29 return e; 27 return e;
@@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
31 29
32struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) 30struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
33{ 31{
34 struct expr *e = malloc(sizeof(*e)); 32 struct expr *e = calloc(1, sizeof(*e));
35 memset(e, 0, sizeof(*e));
36 e->type = type; 33 e->type = type;
37 e->left.expr = e1; 34 e->left.expr = e1;
38 e->right.expr = e2; 35 e->right.expr = e2;
@@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
41 38
42struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) 39struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
43{ 40{
44 struct expr *e = malloc(sizeof(*e)); 41 struct expr *e = calloc(1, sizeof(*e));
45 memset(e, 0, sizeof(*e));
46 e->type = type; 42 e->type = type;
47 e->left.sym = s1; 43 e->left.sym = s1;
48 e->right.sym = s2; 44 e->right.sym = s2;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 306c5a59efc2..6fc894f358e4 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -76,9 +76,6 @@ void zconf_nextfile(const char *name);
76int zconf_lineno(void); 76int zconf_lineno(void);
77const char *zconf_curname(void); 77const char *zconf_curname(void);
78 78
79/* conf.c */
80void xfgets(char *str, int size, FILE *in);
81
82/* confdata.c */ 79/* confdata.c */
83const char *conf_get_configname(void); 80const char *conf_get_configname(void);
84const char *conf_get_autoconfig_name(void); 81const char *conf_get_autoconfig_name(void);
@@ -99,9 +96,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
99 fprintf(stderr, "\nError in writing or end of file.\n"); 96 fprintf(stderr, "\nError in writing or end of file.\n");
100} 97}
101 98
102/* kconfig_load.c */
103void kconfig_load(void);
104
105/* menu.c */ 99/* menu.c */
106void _menu_init(void); 100void _menu_init(void);
107void menu_warn(struct menu *menu, const char *fmt, ...); 101void menu_warn(struct menu *menu, const char *fmt, ...);