.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
---|
3 | | - * Released under the terms of the GNU GPL v2.0. |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
6 | 6 | #include <ctype.h> |
---|
.. | .. |
---|
32 | 32 | defconfig, |
---|
33 | 33 | savedefconfig, |
---|
34 | 34 | listnewconfig, |
---|
| 35 | + helpnewconfig, |
---|
35 | 36 | olddefconfig, |
---|
| 37 | + yes2modconfig, |
---|
| 38 | + mod2yesconfig, |
---|
36 | 39 | }; |
---|
37 | 40 | static enum input_mode input_mode = oldaskconfig; |
---|
38 | 41 | |
---|
.. | .. |
---|
90 | 93 | line[0] = '\n'; |
---|
91 | 94 | line[1] = 0; |
---|
92 | 95 | |
---|
93 | | - if (!sym_is_changable(sym)) { |
---|
| 96 | + if (!sym_is_changeable(sym)) { |
---|
94 | 97 | printf("%s\n", def); |
---|
95 | 98 | line[0] = '\n'; |
---|
96 | 99 | line[1] = 0; |
---|
.. | .. |
---|
234 | 237 | |
---|
235 | 238 | sym = menu->sym; |
---|
236 | 239 | is_new = !sym_has_value(sym); |
---|
237 | | - if (sym_is_changable(sym)) { |
---|
| 240 | + if (sym_is_changeable(sym)) { |
---|
238 | 241 | conf_sym(menu); |
---|
239 | 242 | sym_calc_value(sym); |
---|
240 | 243 | switch (sym_get_tristate_value(sym)) { |
---|
.. | .. |
---|
418 | 421 | |
---|
419 | 422 | sym = menu->sym; |
---|
420 | 423 | if (sym && !sym_has_value(sym)) { |
---|
421 | | - if (sym_is_changable(sym) || |
---|
| 424 | + if (sym_is_changeable(sym) || |
---|
422 | 425 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { |
---|
423 | 426 | if (input_mode == listnewconfig) { |
---|
424 | 427 | if (sym->name) { |
---|
.. | .. |
---|
434 | 437 | printf("%s%s=%s\n", CONFIG_, sym->name, str); |
---|
435 | 438 | } |
---|
436 | 439 | } |
---|
| 440 | + } else if (input_mode == helpnewconfig) { |
---|
| 441 | + printf("-----\n"); |
---|
| 442 | + print_help(menu); |
---|
| 443 | + printf("-----\n"); |
---|
| 444 | + |
---|
437 | 445 | } else { |
---|
438 | 446 | if (!conf_cnt++) |
---|
439 | 447 | printf("*\n* Restart config...\n*\n"); |
---|
.. | .. |
---|
451 | 459 | {"oldaskconfig", no_argument, NULL, oldaskconfig}, |
---|
452 | 460 | {"oldconfig", no_argument, NULL, oldconfig}, |
---|
453 | 461 | {"syncconfig", no_argument, NULL, syncconfig}, |
---|
454 | | - {"defconfig", optional_argument, NULL, defconfig}, |
---|
| 462 | + {"defconfig", required_argument, NULL, defconfig}, |
---|
455 | 463 | {"savedefconfig", required_argument, NULL, savedefconfig}, |
---|
456 | 464 | {"allnoconfig", no_argument, NULL, allnoconfig}, |
---|
457 | 465 | {"allyesconfig", no_argument, NULL, allyesconfig}, |
---|
.. | .. |
---|
459 | 467 | {"alldefconfig", no_argument, NULL, alldefconfig}, |
---|
460 | 468 | {"randconfig", no_argument, NULL, randconfig}, |
---|
461 | 469 | {"listnewconfig", no_argument, NULL, listnewconfig}, |
---|
| 470 | + {"helpnewconfig", no_argument, NULL, helpnewconfig}, |
---|
462 | 471 | {"olddefconfig", no_argument, NULL, olddefconfig}, |
---|
463 | | - /* |
---|
464 | | - * oldnoconfig is an alias of olddefconfig, because people already |
---|
465 | | - * are dependent on its behavior(sets new symbols to their default |
---|
466 | | - * value but not 'n') with the counter-intuitive name. |
---|
467 | | - */ |
---|
468 | | - {"oldnoconfig", no_argument, NULL, olddefconfig}, |
---|
| 472 | + {"yes2modconfig", no_argument, NULL, yes2modconfig}, |
---|
| 473 | + {"mod2yesconfig", no_argument, NULL, mod2yesconfig}, |
---|
469 | 474 | {NULL, 0, NULL, 0} |
---|
470 | 475 | }; |
---|
471 | 476 | |
---|
.. | .. |
---|
475 | 480 | printf("Usage: %s [-s] [option] <kconfig-file>\n", progname); |
---|
476 | 481 | printf("[option] is _one_ of the following:\n"); |
---|
477 | 482 | printf(" --listnewconfig List new options\n"); |
---|
| 483 | + printf(" --helpnewconfig List new options and help text\n"); |
---|
478 | 484 | printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); |
---|
479 | 485 | printf(" --oldconfig Update a configuration using a provided .config as base\n"); |
---|
480 | 486 | printf(" --syncconfig Similar to oldconfig but generates configuration in\n" |
---|
481 | 487 | " include/{generated/,config/}\n"); |
---|
482 | 488 | printf(" --olddefconfig Same as oldconfig but sets new symbols to their default value\n"); |
---|
483 | | - printf(" --oldnoconfig An alias of olddefconfig\n"); |
---|
484 | 489 | printf(" --defconfig <file> New config with default defined in <file>\n"); |
---|
485 | 490 | printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n"); |
---|
486 | 491 | printf(" --allnoconfig New config where all options are answered with no\n"); |
---|
.. | .. |
---|
488 | 493 | printf(" --allmodconfig New config where all options are answered with mod\n"); |
---|
489 | 494 | printf(" --alldefconfig New config with all symbols set to default\n"); |
---|
490 | 495 | printf(" --randconfig New config with random answer to all options\n"); |
---|
| 496 | + printf(" --yes2modconfig Change answers from yes to mod if possible\n"); |
---|
| 497 | + printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); |
---|
491 | 498 | } |
---|
492 | 499 | |
---|
493 | 500 | int main(int ac, char **av) |
---|
.. | .. |
---|
495 | 502 | const char *progname = av[0]; |
---|
496 | 503 | int opt; |
---|
497 | 504 | const char *name, *defconfig_file = NULL /* gcc uninit */; |
---|
498 | | - struct stat tmpstat; |
---|
499 | 505 | int no_conf_write = 0; |
---|
500 | 506 | |
---|
501 | 507 | tty_stdio = isatty(0) && isatty(1); |
---|
.. | .. |
---|
551 | 557 | case allmodconfig: |
---|
552 | 558 | case alldefconfig: |
---|
553 | 559 | case listnewconfig: |
---|
| 560 | + case helpnewconfig: |
---|
554 | 561 | case olddefconfig: |
---|
| 562 | + case yes2modconfig: |
---|
| 563 | + case mod2yesconfig: |
---|
555 | 564 | break; |
---|
556 | 565 | case '?': |
---|
557 | 566 | conf_usage(progname); |
---|
.. | .. |
---|
567 | 576 | name = av[optind]; |
---|
568 | 577 | conf_parse(name); |
---|
569 | 578 | //zconfdump(stdout); |
---|
570 | | - if (sync_kconfig) { |
---|
571 | | - name = conf_get_configname(); |
---|
572 | | - if (stat(name, &tmpstat)) { |
---|
573 | | - fprintf(stderr, "***\n" |
---|
574 | | - "*** Configuration file \"%s\" not found!\n" |
---|
575 | | - "***\n" |
---|
576 | | - "*** Please run some configurator (e.g. \"make oldconfig\" or\n" |
---|
577 | | - "*** \"make menuconfig\" or \"make xconfig\").\n" |
---|
578 | | - "***\n", name); |
---|
579 | | - exit(1); |
---|
580 | | - } |
---|
581 | | - } |
---|
582 | 579 | |
---|
583 | 580 | switch (input_mode) { |
---|
584 | 581 | case defconfig: |
---|
585 | | - if (!defconfig_file) |
---|
586 | | - defconfig_file = conf_get_default_confname(); |
---|
587 | 582 | if (conf_read(defconfig_file)) { |
---|
588 | 583 | fprintf(stderr, |
---|
589 | 584 | "***\n" |
---|
.. | .. |
---|
598 | 593 | case oldaskconfig: |
---|
599 | 594 | case oldconfig: |
---|
600 | 595 | case listnewconfig: |
---|
| 596 | + case helpnewconfig: |
---|
601 | 597 | case olddefconfig: |
---|
| 598 | + case yes2modconfig: |
---|
| 599 | + case mod2yesconfig: |
---|
602 | 600 | conf_read(NULL); |
---|
603 | 601 | break; |
---|
604 | 602 | case allnoconfig: |
---|
.. | .. |
---|
672 | 670 | break; |
---|
673 | 671 | case savedefconfig: |
---|
674 | 672 | break; |
---|
| 673 | + case yes2modconfig: |
---|
| 674 | + conf_rewrite_mod_or_yes(def_y2m); |
---|
| 675 | + break; |
---|
| 676 | + case mod2yesconfig: |
---|
| 677 | + conf_rewrite_mod_or_yes(def_m2y); |
---|
| 678 | + break; |
---|
675 | 679 | case oldaskconfig: |
---|
676 | 680 | rootEntry = &rootmenu; |
---|
677 | 681 | conf(&rootmenu); |
---|
.. | .. |
---|
679 | 683 | /* fall through */ |
---|
680 | 684 | case oldconfig: |
---|
681 | 685 | case listnewconfig: |
---|
| 686 | + case helpnewconfig: |
---|
682 | 687 | case syncconfig: |
---|
683 | 688 | /* Update until a loop caused no more changes */ |
---|
684 | 689 | do { |
---|
.. | .. |
---|
697 | 702 | defconfig_file); |
---|
698 | 703 | return 1; |
---|
699 | 704 | } |
---|
700 | | - } else if (input_mode != listnewconfig) { |
---|
| 705 | + } else if (input_mode != listnewconfig && input_mode != helpnewconfig) { |
---|
701 | 706 | if (!no_conf_write && conf_write(NULL)) { |
---|
702 | 707 | fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); |
---|
703 | 708 | exit(1); |
---|