X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=config%2Fconf.c;h=5f1758c73ccf1762114c542ce08bbd5340822550;hp=2949b7d983193e8ae9eb7e26d4612e1f0827dd4b;hb=64244d1d068fbfdc9f8e8679ac663622d4957304;hpb=fa77bcaf0aac039e45715be971cbaa2532130570 diff --git a/config/conf.c b/config/conf.c index 2949b7d..5f1758c 100644 --- a/config/conf.c +++ b/config/conf.c @@ -32,6 +32,7 @@ enum input_mode { defconfig, savedefconfig, listnewconfig, + helpnewconfig, olddefconfig, }; static enum input_mode input_mode = oldaskconfig; @@ -90,7 +91,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) line[0] = '\n'; line[1] = 0; - if (!sym_is_changable(sym)) { + if (!sym_is_changeable(sym)) { printf("%s\n", def); line[0] = '\n'; line[1] = 0; @@ -234,7 +235,7 @@ static int conf_choice(struct menu *menu) sym = menu->sym; is_new = !sym_has_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { @@ -418,7 +419,7 @@ static void check_conf(struct menu *menu) sym = menu->sym; if (sym && !sym_has_value(sym)) { - if (sym_is_changable(sym) || + if (sym_is_changeable(sym) || (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (input_mode == listnewconfig) { if (sym->name) { @@ -434,6 +435,11 @@ static void check_conf(struct menu *menu) printf("%s%s=%s\n", CONFIG_, sym->name, str); } } + } else if (input_mode == helpnewconfig) { + printf("-----\n"); + print_help(menu); + printf("-----\n"); + } else { if (!conf_cnt++) printf("*\n* Restart config...\n*\n"); @@ -451,7 +457,7 @@ static struct option long_opts[] = { {"oldaskconfig", no_argument, NULL, oldaskconfig}, {"oldconfig", no_argument, NULL, oldconfig}, {"syncconfig", no_argument, NULL, syncconfig}, - {"defconfig", optional_argument, NULL, defconfig}, + {"defconfig", required_argument, NULL, defconfig}, {"savedefconfig", required_argument, NULL, savedefconfig}, {"allnoconfig", no_argument, NULL, allnoconfig}, {"allyesconfig", no_argument, NULL, allyesconfig}, @@ -459,6 +465,7 @@ static struct option long_opts[] = { {"alldefconfig", no_argument, NULL, alldefconfig}, {"randconfig", no_argument, NULL, randconfig}, {"listnewconfig", no_argument, NULL, listnewconfig}, + {"helpnewconfig", no_argument, NULL, helpnewconfig}, {"olddefconfig", no_argument, NULL, olddefconfig}, {NULL, 0, NULL, 0} }; @@ -469,6 +476,7 @@ static void conf_usage(const char *progname) printf("Usage: %s [-s] [option] \n", progname); printf("[option] is _one_ of the following:\n"); printf(" --listnewconfig List new options\n"); + printf(" --helpnewconfig List new options and help text\n"); printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); printf(" --oldconfig Update a configuration using a provided .config as base\n"); printf(" --syncconfig Similar to oldconfig but generates configuration in\n" @@ -488,7 +496,6 @@ int main(int ac, char **av) const char *progname = av[0]; int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; - struct stat tmpstat; int no_conf_write = 0; tty_stdio = isatty(0) && isatty(1); @@ -544,6 +551,7 @@ int main(int ac, char **av) case allmodconfig: case alldefconfig: case listnewconfig: + case helpnewconfig: case olddefconfig: break; case '?': @@ -560,23 +568,9 @@ int main(int ac, char **av) name = av[optind]; conf_parse(name); //zconfdump(stdout); - if (sync_kconfig) { - name = conf_get_configname(); - if (stat(name, &tmpstat)) { - fprintf(stderr, "***\n" - "*** Configuration file \"%s\" not found!\n" - "***\n" - "*** Please run some configurator (e.g. \"make oldconfig\" or\n" - "*** \"make menuconfig\" or \"make xconfig\").\n" - "***\n", name); - exit(1); - } - } switch (input_mode) { case defconfig: - if (!defconfig_file) - defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { fprintf(stderr, "***\n" @@ -591,6 +585,7 @@ int main(int ac, char **av) case oldaskconfig: case oldconfig: case listnewconfig: + case helpnewconfig: case olddefconfig: conf_read(NULL); break; @@ -672,6 +667,7 @@ int main(int ac, char **av) /* fall through */ case oldconfig: case listnewconfig: + case helpnewconfig: case syncconfig: /* Update until a loop caused no more changes */ do { @@ -690,7 +686,7 @@ int main(int ac, char **av) defconfig_file); return 1; } - } else if (input_mode != listnewconfig) { + } else if (input_mode != listnewconfig && input_mode != helpnewconfig) { if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1);