diff options
author | Michal Marek <mmarek@suse.cz> | 2011-07-04 05:24:10 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-07-04 05:24:10 -0400 |
commit | 5c74cd4cc7e7ad9117789e0ca22892a42f87d890 (patch) | |
tree | 139e419539a43b759cecb3fed618f8c1a6cce556 /scripts/kconfig | |
parent | e54e692ba613c2170c66ce36a3791c009680af08 (diff) | |
parent | ab63f58f253c3eca620347f5180ca3d6a1b6aa38 (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.c | 43 | ||||
-rw-r--r-- | scripts/kconfig/expr.c | 12 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 6 |
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 | ||
19 | static void conf(struct menu *menu); | 19 | static void conf(struct menu *menu); |
20 | static void check_conf(struct menu *menu); | 20 | static void check_conf(struct menu *menu); |
21 | static void xfgets(char *str, int size, FILE *in); | ||
21 | 22 | ||
22 | enum input_mode { | 23 | enum 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 | ||
37 | char *defconfig_file; | ||
38 | |||
39 | static int indent = 1; | 38 | static int indent = 1; |
40 | static int valid_stdin = 1; | 39 | static int valid_stdin = 1; |
41 | static int sync_kconfig; | 40 | static 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 | ||
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 | |||
462 | int main(int ac, char **av) | 480 | int 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 | */ |
650 | void xfgets(str, size, in) | 680 | void 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 | ||
14 | struct expr *expr_alloc_symbol(struct symbol *sym) | 14 | struct 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 | ||
23 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | 22 | struct 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 | ||
32 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | 30 | struct 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 | ||
42 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | 39 | struct 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); | |||
76 | int zconf_lineno(void); | 76 | int zconf_lineno(void); |
77 | const char *zconf_curname(void); | 77 | const char *zconf_curname(void); |
78 | 78 | ||
79 | /* conf.c */ | ||
80 | void xfgets(char *str, int size, FILE *in); | ||
81 | |||
82 | /* confdata.c */ | 79 | /* confdata.c */ |
83 | const char *conf_get_configname(void); | 80 | const char *conf_get_configname(void); |
84 | const char *conf_get_autoconfig_name(void); | 81 | const 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 */ | ||
103 | void kconfig_load(void); | ||
104 | |||
105 | /* menu.c */ | 99 | /* menu.c */ |
106 | void _menu_init(void); | 100 | void _menu_init(void); |
107 | void menu_warn(struct menu *menu, const char *fmt, ...); | 101 | void menu_warn(struct menu *menu, const char *fmt, ...); |