Fast-forward merge with Linus to be able to merge patches based on more recent version of the tree.
Showing the changes to scripts (23 of 3980 files). Show all
Unified · Split
| @@ -2574,7 +2574,8 @@ sub process { · 2573 unmodified lines | ||
| 2574 | 2574 | } else { |
| 2575 | 2575 | $cast = $cast2; |
| 2576 | 2576 | } |
| 2577 | − WARN("$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr); | |
| 2577 | + WARN("MINMAX", | |
| 2578 | + "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr); | |
| 2578 | 2579 | } |
| 2579 | 2580 | } |
| 2580 | 2581 | |
| @@ -1389,7 +1389,7 @@ sub vcs_exists { · 1388 unmodified lines | ||
| 1389 | 1389 | warn("$P: No supported VCS found. Add --nogit to options?\n"); |
| 1390 | 1390 | warn("Using a git repository produces better results.\n"); |
| 1391 | 1391 | warn("Try Linus Torvalds' latest git repository using:\n"); |
| 1392 | − warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n"); | |
| 1392 | + warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n"); | |
| 1393 | 1393 | $printed_novcs = 1; |
| 1394 | 1394 | } |
| 1395 | 1395 | return 0; |
| @@ -170,8 +170,8 @@ mconf-objs := mconf.o zconf.tab.o $(lxdialog) · 169 unmodified lines | ||
| 170 | 170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o |
| 171 | 171 | kxgettext-objs := kxgettext.o zconf.tab.o |
| 172 | 172 | qconf-cxxobjs := qconf.o |
| 173 | −qconf-objs := kconfig_load.o zconf.tab.o | |
| 174 | −gconf-objs := gconf.o kconfig_load.o zconf.tab.o | |
| 173 | +qconf-objs := zconf.tab.o | |
| 174 | +gconf-objs := gconf.o zconf.tab.o | |
| 175 | 175 | |
| 176 | 176 | hostprogs-y := conf |
| 177 | 177 | |
| @@ -203,7 +203,7 @@ ifeq ($(gconf-target),1) · 25 unmodified lines | ||
| 203 | 203 | hostprogs-y += gconf |
| 204 | 204 | endif |
| 205 | 205 | |
| 206 | −clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck | |
| 206 | +clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck | |
| 207 | 207 | clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h |
| 208 | 208 | clean-files += mconf qconf gconf nconf |
| 209 | 209 | clean-files += config.pot linux.pot |
| @@ -226,12 +226,12 @@ HOSTCFLAGS_zconf.tab.o := -I$(src) · 16 unmodified lines | ||
| 226 | 226 | LEX_PREFIX_zconf := zconf |
| 227 | 227 | YACC_PREFIX_zconf := zconf |
| 228 | 228 | |
| 229 | −HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | |
| 230 | −HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | |
| 229 | +HOSTLOADLIBES_qconf = $(KC_QT_LIBS) | |
| 230 | +HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) | |
| 231 | 231 | |
| 232 | −HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl | |
| 232 | +HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | |
| 233 | 233 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
| 234 | − -D LKC_DIRECT_LINK | |
| 234 | + -Wno-missing-prototypes | |
| 235 | 235 | |
| 236 | 236 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) |
| 237 | 237 | |
| @@ -321,18 +321,11 @@ endif · 83 unmodified lines | ||
| 321 | 321 | |
| 322 | 322 | $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c |
| 323 | 323 | |
| 324 | −$(obj)/kconfig_load.o: $(obj)/lkc_defs.h | |
| 325 | − | |
| 326 | −$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h | |
| 327 | − | |
| 328 | −$(obj)/gconf.o: $(obj)/lkc_defs.h | |
| 324 | +$(obj)/qconf.o: $(obj)/qconf.moc | |
| 329 | 325 | |
| 330 | 326 | $(obj)/%.moc: $(src)/%.h |
| 331 | 327 | $(KC_QT_MOC) -i $< -o $@ |
| 332 | 328 | |
| 333 | −$(obj)/lkc_defs.h: $(src)/lkc_proto.h | |
| 334 | − $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | |
| 335 | − | |
| 336 | 329 | # Extract gconf menu items for I18N support |
| 337 | 330 | $(obj)/gconf.glade.h: $(obj)/gconf.glade |
| 338 | 331 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ |
| @@ -14,11 +14,11 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <sys/stat.h> |
| 15 | 15 | #include <sys/time.h> |
| 16 | 16 | |
| 17 | −#define LKC_DIRECT_LINK | |
| 18 | 17 | #include "lkc.h" |
| 19 | 18 | |
| 20 | 19 | static void conf(struct menu *menu); |
| 21 | 20 | static void check_conf(struct menu *menu); |
| 21 | +static void xfgets(char *str, int size, FILE *in); | |
| 22 | 22 | |
| 23 | 23 | enum input_mode { |
| 24 | 24 | oldaskconfig, |
| @@ -35,8 +35,6 @@ enum input_mode { · 10 unmodified lines | ||
| 35 | 35 | oldnoconfig, |
| 36 | 36 | } input_mode = oldaskconfig; |
| 37 | 37 | |
| 38 | −char *defconfig_file; | |
| 39 | − | |
| 40 | 38 | static int indent = 1; |
| 41 | 39 | static int valid_stdin = 1; |
| 42 | 40 | static int sync_kconfig; |
| @@ -106,6 +104,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) · 63 unmodified lines | ||
| 106 | 104 | return 0; |
| 107 | 105 | } |
| 108 | 106 | check_stdin(); |
| 107 | + /* fall through */ | |
| 109 | 108 | case oldaskconfig: |
| 110 | 109 | fflush(stdout); |
| 111 | 110 | xfgets(line, 128, stdin); |
| @@ -150,6 +149,7 @@ static int conf_string(struct menu *menu) · 38 unmodified lines | ||
| 150 | 149 | def = NULL; |
| 151 | 150 | break; |
| 152 | 151 | } |
| 152 | + /* fall through */ | |
| 153 | 153 | default: |
| 154 | 154 | line[strlen(line)-1] = 0; |
| 155 | 155 | def = line; |
| @@ -304,6 +304,7 @@ static int conf_choice(struct menu *menu) · 148 unmodified lines | ||
| 304 | 304 | break; |
| 305 | 305 | } |
| 306 | 306 | check_stdin(); |
| 307 | + /* fall through */ | |
| 307 | 308 | case oldaskconfig: |
| 308 | 309 | fflush(stdout); |
| 309 | 310 | xfgets(line, 128, stdin); |
| @@ -369,6 +370,7 @@ static void conf(struct menu *menu) · 59 unmodified lines | ||
| 369 | 370 | check_conf(menu); |
| 370 | 371 | return; |
| 371 | 372 | } |
| 373 | + /* fall through */ | |
| 372 | 374 | case P_COMMENT: |
| 373 | 375 | prompt = menu_get_prompt(menu); |
| 374 | 376 | if (prompt) |
| @@ -456,10 +458,30 @@ static struct option long_opts[] = { · 81 unmodified lines | ||
| 456 | 458 | {NULL, 0, NULL, 0} |
| 457 | 459 | }; |
| 458 | 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 | + | |
| 459 | 480 | int main(int ac, char **av) |
| 460 | 481 | { |
| 482 | + const char *progname = av[0]; | |
| 461 | 483 | int opt; |
| 462 | − const char *name; | |
| 484 | + const char *name, *defconfig_file = NULL /* gcc uninit */; | |
| 463 | 485 | struct stat tmpstat; |
| 464 | 486 | |
| 465 | 487 | setlocale(LC_ALL, ""); |
| @@ -491,14 +513,24 @@ int main(int ac, char **av) · 25 unmodified lines | ||
| 491 | 513 | srand(seed); |
| 492 | 514 | break; |
| 493 | 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; | |
| 494 | 525 | case '?': |
| 495 | − fprintf(stderr, _("See README for usage info\n")); | |
| 526 | + conf_usage(progname); | |
| 496 | 527 | exit(1); |
| 497 | 528 | break; |
| 498 | 529 | } |
| 499 | 530 | } |
| 500 | 531 | if (ac == optind) { |
| 501 | 532 | printf(_("%s: Kconfig file missing\n"), av[0]); |
| 533 | + conf_usage(progname); | |
| 502 | 534 | exit(1); |
| 503 | 535 | } |
| 504 | 536 | name = av[optind]; |
| @@ -641,13 +673,11 @@ int main(int ac, char **av) · 136 unmodified lines | ||
| 641 | 673 | } |
| 642 | 674 | return 0; |
| 643 | 675 | } |
| 676 | + | |
| 644 | 677 | /* |
| 645 | 678 | * Helper function to facilitate fgets() by Jean Sacren. |
| 646 | 679 | */ |
| 647 | −void xfgets(str, size, in) | |
| 648 | − char *str; | |
| 649 | − int size; | |
| 650 | − FILE *in; | |
| 680 | +void xfgets(char *str, int size, FILE *in) | |
| 651 | 681 | { |
| 652 | 682 | if (fgets(str, size, in) == NULL) |
| 653 | 683 | fprintf(stderr, "\nError in reading or end of file.\n"); |
| @@ -7,13 +7,13 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <ctype.h> |
| 8 | 8 | #include <errno.h> |
| 9 | 9 | #include <fcntl.h> |
| 10 | +#include <stdarg.h> | |
| 10 | 11 | #include <stdio.h> |
| 11 | 12 | #include <stdlib.h> |
| 12 | 13 | #include <string.h> |
| 13 | 14 | #include <time.h> |
| 14 | 15 | #include <unistd.h> |
| 15 | 16 | |
| 16 | −#define LKC_DIRECT_LINK | |
| 17 | 17 | #include "lkc.h" |
| 18 | 18 | |
| 19 | 19 | static void conf_warning(const char *fmt, ...) |
| @@ -128,6 +128,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 108 unmodified lines | ||
| 128 | 128 | sym->flags |= def_flags; |
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | + /* fall through */ | |
| 131 | 132 | case S_BOOLEAN: |
| 132 | 133 | if (p[0] == 'y') { |
| 133 | 134 | sym->def[def].tri = yes; |
| @@ -140,7 +141,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 6 unmodified lines | ||
| 140 | 141 | break; |
| 141 | 142 | } |
| 142 | 143 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); |
| 143 | − break; | |
| 144 | + return 1; | |
| 144 | 145 | case S_OTHER: |
| 145 | 146 | if (*p != '"') { |
| 146 | 147 | for (p2 = p; *p2 && !isspace(*p2); p2++) |
| @@ -148,6 +149,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 1 unmodified line | ||
| 148 | 149 | sym->type = S_STRING; |
| 149 | 150 | goto done; |
| 150 | 151 | } |
| 152 | + /* fall through */ | |
| 151 | 153 | case S_STRING: |
| 152 | 154 | if (*p++ != '"') |
| 153 | 155 | break; |
| @@ -162,6 +164,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 8 unmodified lines | ||
| 162 | 164 | conf_warning("invalid string found"); |
| 163 | 165 | return 1; |
| 164 | 166 | } |
| 167 | + /* fall through */ | |
| 165 | 168 | case S_INT: |
| 166 | 169 | case S_HEX: |
| 167 | 170 | done: |
| @@ -237,6 +240,7 @@ load: · 69 unmodified lines | ||
| 237 | 240 | case S_STRING: |
| 238 | 241 | if (sym->def[def].val) |
| 239 | 242 | free(sym->def[def].val); |
| 243 | + /* fall through */ | |
| 240 | 244 | default: |
| 241 | 245 | sym->def[def].val = NULL; |
| 242 | 246 | sym->def[def].tri = no; |
| @@ -363,6 +367,7 @@ int conf_read(const char *name) · 120 unmodified lines | ||
| 363 | 367 | break; |
| 364 | 368 | if (!sym_is_choice(sym)) |
| 365 | 369 | goto sym_ok; |
| 370 | + /* fall through */ | |
| 366 | 371 | default: |
| 367 | 372 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
| 368 | 373 | goto sym_ok; |
| @@ -417,64 +422,202 @@ int conf_read(const char *name) · 48 unmodified lines | ||
| 417 | 422 | return 0; |
| 418 | 423 | } |
| 419 | 424 | |
| 420 | −/* Write a S_STRING */ | |
| 421 | −static void conf_write_string(bool headerfile, const char *name, | |
| 422 | − const char *str, FILE *out) | |
| 425 | +/* | |
| 426 | + * Kconfig configuration printer | |
| 427 | + * | |
| 428 | + * This printer is used when generating the resulting configuration after | |
| 429 | + * kconfig invocation and `defconfig' files. Unset symbol might be omitted by | |
| 430 | + * passing a non-NULL argument to the printer. | |
| 431 | + * | |
| 432 | + */ | |
| 433 | +static void | |
| 434 | +kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | |
| 423 | 435 | { |
| 424 | − int l; | |
| 425 | − if (headerfile) | |
| 426 | − fprintf(out, "#define %s%s \"", CONFIG_, name); | |
| 427 | − else | |
| 428 | − fprintf(out, "%s%s=\"", CONFIG_, name); | |
| 429 | − | |
| 430 | − while (1) { | |
| 431 | − l = strcspn(str, "\"\\"); | |
| 436 | + | |
| 437 | + switch (sym->type) { | |
| 438 | + case S_BOOLEAN: | |
| 439 | + case S_TRISTATE: | |
| 440 | + if (*value == 'n') { | |
| 441 | + bool skip_unset = (arg != NULL); | |
| 442 | + | |
| 443 | + if (!skip_unset) | |
| 444 | + fprintf(fp, "# %s%s is not set\n", | |
| 445 | + CONFIG_, sym->name); | |
| 446 | + return; | |
| 447 | + } | |
| 448 | + break; | |
| 449 | + default: | |
| 450 | + break; | |
| 451 | + } | |
| 452 | + | |
| 453 | + fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); | |
| 454 | +} | |
| 455 | + | |
| 456 | +static void | |
| 457 | +kconfig_print_comment(FILE *fp, const char *value, void *arg) | |
| 458 | +{ | |
| 459 | + const char *p = value; | |
| 460 | + size_t l; | |
| 461 | + | |
| 462 | + for (;;) { | |
| 463 | + l = strcspn(p, "\n"); | |
| 464 | + fprintf(fp, "#"); | |
| 432 | 465 | if (l) { |
| 433 | − xfwrite(str, l, 1, out); | |
| 434 | − str += l; | |
| 466 | + fprintf(fp, " "); | |
| 467 | + fwrite(p, l, 1, fp); | |
| 468 | + p += l; | |
| 435 | 469 | } |
| 436 | − if (!*str) | |
| 470 | + fprintf(fp, "\n"); | |
| 471 | + if (*p++ == '\0') | |
| 437 | 472 | break; |
| 438 | − fprintf(out, "\\%c", *str++); | |
| 439 | 473 | } |
| 440 | − fputs("\"\n", out); | |
| 441 | 474 | } |
| 442 | 475 | |
| 443 | −static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no) | |
| 476 | +static struct conf_printer kconfig_printer_cb = | |
| 477 | +{ | |
| 478 | + .print_symbol = kconfig_print_symbol, | |
| 479 | + .print_comment = kconfig_print_comment, | |
| 480 | +}; | |
| 481 | + | |
| 482 | +/* | |
| 483 | + * Header printer | |
| 484 | + * | |
| 485 | + * This printer is used when generating the `include/generated/autoconf.h' file. | |
| 486 | + */ | |
| 487 | +static void | |
| 488 | +header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | |
| 444 | 489 | { |
| 445 | − const char *str; | |
| 446 | 490 | |
| 447 | 491 | switch (sym->type) { |
| 448 | 492 | case S_BOOLEAN: |
| 449 | − case S_TRISTATE: | |
| 450 | − switch (sym_get_tristate_value(sym)) { | |
| 451 | − case no: | |
| 452 | − if (write_no) | |
| 453 | − fprintf(out, "# %s%s is not set\n", | |
| 454 | − CONFIG_, sym->name); | |
| 455 | − break; | |
| 456 | − case mod: | |
| 457 | − fprintf(out, "%s%s=m\n", CONFIG_, sym->name); | |
| 458 | − break; | |
| 459 | − case yes: | |
| 460 | − fprintf(out, "%s%s=y\n", CONFIG_, sym->name); | |
| 493 | + case S_TRISTATE: { | |
| 494 | + const char *suffix = ""; | |
| 495 | + | |
| 496 | + switch (*value) { | |
| 497 | + case 'n': | |
| 461 | 498 | break; |
| 499 | + case 'm': | |
| 500 | + suffix = "_MODULE"; | |
| 501 | + /* fall through */ | |
| 502 | + default: | |
| 503 | + fprintf(fp, "#define %s%s%s 1\n", | |
| 504 | + CONFIG_, sym->name, suffix); | |
| 462 | 505 | } |
| 506 | + /* | |
| 507 | + * Generate the __enabled_CONFIG_* and | |
| 508 | + * __enabled_CONFIG_*_MODULE macros for use by the | |
| 509 | + * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | |
| 510 | + * generated even for booleans so that the IS_ENABLED() macro | |
| 511 | + * works. | |
| 512 | + */ | |
| 513 | + fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | |
| 514 | + sym->name, (*value == 'y')); | |
| 515 | + fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | |
| 516 | + sym->name, (*value == 'm')); | |
| 463 | 517 | break; |
| 464 | − case S_STRING: | |
| 465 | − conf_write_string(false, sym->name, sym_get_string_value(sym), out); | |
| 518 | + } | |
| 519 | + case S_HEX: { | |
| 520 | + const char *prefix = ""; | |
| 521 | + | |
| 522 | + if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) | |
| 523 | + prefix = "0x"; | |
| 524 | + fprintf(fp, "#define %s%s %s%s\n", | |
| 525 | + CONFIG_, sym->name, prefix, value); | |
| 466 | 526 | break; |
| 467 | − case S_HEX: | |
| 527 | + } | |
| 528 | + case S_STRING: | |
| 468 | 529 | case S_INT: |
| 469 | − str = sym_get_string_value(sym); | |
| 470 | − fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str); | |
| 530 | + fprintf(fp, "#define %s%s %s\n", | |
| 531 | + CONFIG_, sym->name, value); | |
| 532 | + break; | |
| 533 | + default: | |
| 471 | 534 | break; |
| 535 | + } | |
| 536 | + | |
| 537 | +} | |
| 538 | + | |
| 539 | +static void | |
| 540 | +header_print_comment(FILE *fp, const char *value, void *arg) | |
| 541 | +{ | |
| 542 | + const char *p = value; | |
| 543 | + size_t l; | |
| 544 | + | |
| 545 | + fprintf(fp, "/*\n"); | |
| 546 | + for (;;) { | |
| 547 | + l = strcspn(p, "\n"); | |
| 548 | + fprintf(fp, " *"); | |
| 549 | + if (l) { | |
| 550 | + fprintf(fp, " "); | |
| 551 | + fwrite(p, l, 1, fp); | |
| 552 | + p += l; | |
| 553 | + } | |
| 554 | + fprintf(fp, "\n"); | |
| 555 | + if (*p++ == '\0') | |
| 556 | + break; | |
| 557 | + } | |
| 558 | + fprintf(fp, " */\n"); | |
| 559 | +} | |
| 560 | + | |
| 561 | +static struct conf_printer header_printer_cb = | |
| 562 | +{ | |
| 563 | + .print_symbol = header_print_symbol, | |
| 564 | + .print_comment = header_print_comment, | |
| 565 | +}; | |
| 566 | + | |
| 567 | +/* | |
| 568 | + * Tristate printer | |
| 569 | + * | |
| 570 | + * This printer is used when generating the `include/config/tristate.conf' file. | |
| 571 | + */ | |
| 572 | +static void | |
| 573 | +tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | |
| 574 | +{ | |
| 575 | + | |
| 576 | + if (sym->type == S_TRISTATE && *value != 'n') | |
| 577 | + fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); | |
| 578 | +} | |
| 579 | + | |
| 580 | +static struct conf_printer tristate_printer_cb = | |
| 581 | +{ | |
| 582 | + .print_symbol = tristate_print_symbol, | |
| 583 | + .print_comment = kconfig_print_comment, | |
| 584 | +}; | |
| 585 | + | |
| 586 | +static void conf_write_symbol(FILE *fp, struct symbol *sym, | |
| 587 | + struct conf_printer *printer, void *printer_arg) | |
| 588 | +{ | |
| 589 | + const char *str; | |
| 590 | + | |
| 591 | + switch (sym->type) { | |
| 472 | 592 | case S_OTHER: |
| 473 | 593 | case S_UNKNOWN: |
| 474 | 594 | break; |
| 595 | + case S_STRING: | |
| 596 | + str = sym_get_string_value(sym); | |
| 597 | + str = sym_escape_string_value(str); | |
| 598 | + printer->print_symbol(fp, sym, str, printer_arg); | |
| 599 | + free((void *)str); | |
| 600 | + break; | |
| 601 | + default: | |
| 602 | + str = sym_get_string_value(sym); | |
| 603 | + printer->print_symbol(fp, sym, str, printer_arg); | |
| 475 | 604 | } |
| 476 | 605 | } |
| 477 | 606 | |
| 607 | +static void | |
| 608 | +conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) | |
| 609 | +{ | |
| 610 | + char buf[256]; | |
| 611 | + | |
| 612 | + snprintf(buf, sizeof(buf), | |
| 613 | + "\n" | |
| 614 | + "Automatically generated file; DO NOT EDIT.\n" | |
| 615 | + "%s\n", | |
| 616 | + rootmenu.prompt->text); | |
| 617 | + | |
| 618 | + printer->print_comment(fp, buf, printer_arg); | |
| 619 | +} | |
| 620 | + | |
| 478 | 621 | /* |
| 479 | 622 | * Write out a minimal config. |
| 480 | 623 | * All values that has default values are skipped as this is redundant. |
| @@ -531,7 +674,7 @@ int conf_write_defconfig(const char *filename) · 50 unmodified lines | ||
| 531 | 674 | goto next_menu; |
| 532 | 675 | } |
| 533 | 676 | } |
| 534 | − conf_write_symbol(sym, out, true); | |
| 677 | + conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); | |
| 535 | 678 | } |
| 536 | 679 | next_menu: |
| 537 | 680 | if (menu->list != NULL) { |
| @@ -596,11 +739,7 @@ int conf_write(const char *name) · 58 unmodified lines | ||
| 596 | 739 | if (!out) |
| 597 | 740 | return 1; |
| 598 | 741 | |
| 599 | − fprintf(out, _("#\n" | |
| 600 | − "# Automatically generated make config: don't edit\n" | |
| 601 | − "# %s\n" | |
| 602 | − "#\n"), | |
| 603 | − rootmenu.prompt->text); | |
| 742 | + conf_write_heading(out, &kconfig_printer_cb, NULL); | |
| 604 | 743 | |
| 605 | 744 | if (!conf_get_changed()) |
| 606 | 745 | sym_clear_all_valid(); |
| @@ -621,8 +760,8 @@ int conf_write(const char *name) · 14 unmodified lines | ||
| 621 | 760 | if (!(sym->flags & SYMBOL_WRITE)) |
| 622 | 761 | goto next; |
| 623 | 762 | sym->flags &= ~SYMBOL_WRITE; |
| 624 | − /* Write config symbol to file */ | |
| 625 | − conf_write_symbol(sym, out, true); | |
| 763 | + | |
| 764 | + conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); | |
| 626 | 765 | } |
| 627 | 766 | |
| 628 | 767 | next: |
| @@ -771,7 +910,6 @@ out: · 142 unmodified lines | ||
| 771 | 910 | int conf_write_autoconf(void) |
| 772 | 911 | { |
| 773 | 912 | struct symbol *sym; |
| 774 | − const char *str; | |
| 775 | 913 | const char *name; |
| 776 | 914 | FILE *out, *tristate, *out_h; |
| 777 | 915 | int i; |
| @@ -800,68 +938,23 @@ int conf_write_autoconf(void) · 22 unmodified lines | ||
| 800 | 938 | return 1; |
| 801 | 939 | } |
| 802 | 940 | |
| 803 | − fprintf(out, "#\n" | |
| 804 | − "# Automatically generated make config: don't edit\n" | |
| 805 | − "# %s\n" | |
| 806 | − "#\n", | |
| 807 | − rootmenu.prompt->text); | |
| 808 | − fprintf(tristate, "#\n" | |
| 809 | − "# Automatically generated - do not edit\n" | |
| 810 | − "\n"); | |
| 811 | − fprintf(out_h, "/*\n" | |
| 812 | − " * Automatically generated C config: don't edit\n" | |
| 813 | − " * %s\n" | |
| 814 | − " */\n", | |
| 815 | − rootmenu.prompt->text); | |
| 941 | + conf_write_heading(out, &kconfig_printer_cb, NULL); | |
| 942 | + | |
| 943 | + conf_write_heading(tristate, &tristate_printer_cb, NULL); | |
| 944 | + | |
| 945 | + conf_write_heading(out_h, &header_printer_cb, NULL); | |
| 816 | 946 | |
| 817 | 947 | for_all_symbols(i, sym) { |
| 818 | 948 | sym_calc_value(sym); |
| 819 | 949 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) |
| 820 | 950 | continue; |
| 821 | 951 | |
| 822 | − /* write symbol to config file */ | |
| 823 | − conf_write_symbol(sym, out, false); | |
| 952 | + /* write symbol to auto.conf, tristate and header files */ | |
| 953 | + conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); | |
| 824 | 954 | |
| 825 | − /* update autoconf and tristate files */ | |
| 826 | − switch (sym->type) { | |
| 827 | − case S_BOOLEAN: | |
| 828 | − case S_TRISTATE: | |
| 829 | − switch (sym_get_tristate_value(sym)) { | |
| 830 | − case no: | |
| 831 | − break; | |
| 832 | − case mod: | |
| 833 | − fprintf(tristate, "%s%s=M\n", | |
| 834 | − CONFIG_, sym->name); | |
| 835 | − fprintf(out_h, "#define %s%s_MODULE 1\n", | |
| 836 | − CONFIG_, sym->name); | |
| 837 | − break; | |
| 838 | − case yes: | |
| 839 | − if (sym->type == S_TRISTATE) | |
| 840 | − fprintf(tristate,"%s%s=Y\n", | |
| 841 | − CONFIG_, sym->name); | |
| 842 | − fprintf(out_h, "#define %s%s 1\n", | |
| 843 | − CONFIG_, sym->name); | |
| 844 | − break; | |
| 845 | − } | |
| 846 | − break; | |
| 847 | − case S_STRING: | |
| 848 | − conf_write_string(true, sym->name, sym_get_string_value(sym), out_h); | |
| 849 | − break; | |
| 850 | − case S_HEX: | |
| 851 | − str = sym_get_string_value(sym); | |
| 852 | − if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | |
| 853 | − fprintf(out_h, "#define %s%s 0x%s\n", | |
| 854 | − CONFIG_, sym->name, str); | |
| 855 | − break; | |
| 856 | − } | |
| 857 | − case S_INT: | |
| 858 | − str = sym_get_string_value(sym); | |
| 859 | − fprintf(out_h, "#define %s%s %s\n", | |
| 860 | − CONFIG_, sym->name, str); | |
| 861 | − break; | |
| 862 | − default: | |
| 863 | − break; | |
| 864 | − } | |
| 955 | + conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); | |
| 956 | + | |
| 957 | + conf_write_symbol(out_h, sym, &header_printer_cb, NULL); | |
| 865 | 958 | } |
| 866 | 959 | fclose(out); |
| 867 | 960 | fclose(tristate); |
| @@ -7,15 +7,13 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <stdlib.h> |
| 8 | 8 | #include <string.h> |
| 9 | 9 | |
| 10 | −#define LKC_DIRECT_LINK | |
| 11 | 10 | #include "lkc.h" |
| 12 | 11 | |
| 13 | 12 | #define DEBUG_EXPR 0 |
| 14 | 13 | |
| 15 | 14 | struct expr *expr_alloc_symbol(struct symbol *sym) |
| 16 | 15 | { |
| 17 | − struct expr *e = malloc(sizeof(*e)); | |
| 18 | − memset(e, 0, sizeof(*e)); | |
| 16 | + struct expr *e = calloc(1, sizeof(*e)); | |
| 19 | 17 | e->type = E_SYMBOL; |
| 20 | 18 | e->left.sym = sym; |
| 21 | 19 | return e; |
| @@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) · 1 unmodified line | ||
| 23 | 21 | |
| 24 | 22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) |
| 25 | 23 | { |
| 26 | − struct expr *e = malloc(sizeof(*e)); | |
| 27 | − memset(e, 0, sizeof(*e)); | |
| 24 | + struct expr *e = calloc(1, sizeof(*e)); | |
| 28 | 25 | e->type = type; |
| 29 | 26 | e->left.expr = ce; |
| 30 | 27 | return e; |
| @@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) · 1 unmodified line | ||
| 32 | 29 | |
| 33 | 30 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) |
| 34 | 31 | { |
| 35 | − struct expr *e = malloc(sizeof(*e)); | |
| 36 | − memset(e, 0, sizeof(*e)); | |
| 32 | + struct expr *e = calloc(1, sizeof(*e)); | |
| 37 | 33 | e->type = type; |
| 38 | 34 | e->left.expr = e1; |
| 39 | 35 | e->right.expr = e2; |
| @@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e · 2 unmodified lines | ||
| 42 | 38 | |
| 43 | 39 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) |
| 44 | 40 | { |
| 45 | − struct expr *e = malloc(sizeof(*e)); | |
| 46 | − memset(e, 0, sizeof(*e)); | |
| 41 | + struct expr *e = calloc(1, sizeof(*e)); | |
| 47 | 42 | e->type = type; |
| 48 | 43 | e->left.sym = s1; |
| 49 | 44 | e->right.sym = s2; |
| @@ -172,8 +172,6 @@ struct menu { · 171 unmodified lines | ||
| 172 | 172 | #define MENU_CHANGED 0x0001 |
| 173 | 173 | #define MENU_ROOT 0x0002 |
| 174 | 174 | |
| 175 | −#ifndef SWIG | |
| 176 | − | |
| 177 | 175 | extern struct file *file_list; |
| 178 | 176 | extern struct file *current_file; |
| 179 | 177 | struct file *lookup_file(const char *name); |
| @@ -218,7 +216,6 @@ static inline int expr_is_no(struct expr *e) · 38 unmodified lines | ||
| 218 | 216 | { |
| 219 | 217 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); |
| 220 | 218 | } |
| 221 | −#endif | |
| 222 | 219 | |
| 223 | 220 | #ifdef __cplusplus |
| 224 | 221 | } |
| @@ -285,8 +285,6 @@ void init_left_tree(void) · 284 unmodified lines | ||
| 285 | 285 | static void renderer_edited(GtkCellRendererText * cell, |
| 286 | 286 | const gchar * path_string, |
| 287 | 287 | const gchar * new_text, gpointer user_data); |
| 288 | −static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle, | |
| 289 | − gchar * arg1, gpointer user_data); | |
| 290 | 288 | |
| 291 | 289 | void init_right_tree(void) |
| 292 | 290 | { |
| @@ -320,8 +318,6 @@ void init_right_tree(void) · 27 unmodified lines | ||
| 320 | 318 | "inconsistent", COL_BTNINC, |
| 321 | 319 | "visible", COL_BTNVIS, |
| 322 | 320 | "radio", COL_BTNRAD, NULL); |
| 323 | − /*g_signal_connect(G_OBJECT(renderer), "toggled", | |
| 324 | − G_CALLBACK(renderer_toggled), NULL); */ | |
| 325 | 321 | renderer = gtk_cell_renderer_text_new(); |
| 326 | 322 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), |
| 327 | 323 | renderer, FALSE); |
| @@ -888,35 +884,6 @@ static void toggle_sym_value(struct menu *menu) · 560 unmodified lines | ||
| 888 | 884 | display_tree_part(); //fixme: keep exp/coll |
| 889 | 885 | } |
| 890 | 886 | |
| 891 | −static void renderer_toggled(GtkCellRendererToggle * cell, | |
| 892 | − gchar * path_string, gpointer user_data) | |
| 893 | −{ | |
| 894 | − GtkTreePath *path, *sel_path = NULL; | |
| 895 | − GtkTreeIter iter, sel_iter; | |
| 896 | − GtkTreeSelection *sel; | |
| 897 | − struct menu *menu; | |
| 898 | − | |
| 899 | − path = gtk_tree_path_new_from_string(path_string); | |
| 900 | − if (!gtk_tree_model_get_iter(model2, &iter, path)) | |
| 901 | − return; | |
| 902 | − | |
| 903 | − sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w)); | |
| 904 | − if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter)) | |
| 905 | − sel_path = gtk_tree_model_get_path(model2, &sel_iter); | |
| 906 | − if (!sel_path) | |
| 907 | − goto out1; | |
| 908 | − if (gtk_tree_path_compare(path, sel_path)) | |
| 909 | − goto out2; | |
| 910 | − | |
| 911 | − gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | |
| 912 | − toggle_sym_value(menu); | |
| 913 | − | |
| 914 | − out2: | |
| 915 | − gtk_tree_path_free(sel_path); | |
| 916 | − out1: | |
| 917 | − gtk_tree_path_free(path); | |
| 918 | −} | |
| 919 | − | |
| 920 | 887 | static gint column2index(GtkTreeViewColumn * column) |
| 921 | 888 | { |
| 922 | 889 | gint i; |
| @@ -1172,6 +1139,7 @@ static gchar **fill_row(struct menu *menu) · 249 unmodified lines | ||
| 1172 | 1139 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); |
| 1173 | 1140 | if (sym_is_choice(sym)) |
| 1174 | 1141 | break; |
| 1142 | + /* fall through */ | |
| 1175 | 1143 | case S_TRISTATE: |
| 1176 | 1144 | val = sym_get_tristate_value(sym); |
| 1177 | 1145 | switch (val) { |
| @@ -1506,10 +1474,6 @@ int main(int ac, char *av[]) · 328 unmodified lines | ||
| 1506 | 1474 | char *env; |
| 1507 | 1475 | gchar *glade_file; |
| 1508 | 1476 | |
| 1509 | −#ifndef LKC_DIRECT_LINK | |
| 1510 | − kconfig_load(); | |
| 1511 | −#endif | |
| 1512 | − | |
| 1513 | 1477 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 1514 | 1478 | bind_textdomain_codeset(PACKAGE, "UTF-8"); |
| 1515 | 1479 | textdomain(PACKAGE); |
| @@ -1,35 +0,0 @@ | ||
| 1 | −#include <dlfcn.h> | |
| 2 | −#include <stdio.h> | |
| 3 | −#include <stdlib.h> | |
| 4 | − | |
| 5 | −#include "lkc.h" | |
| 6 | − | |
| 7 | −#define P(name,type,arg) type (*name ## _p) arg | |
| 8 | −#include "lkc_proto.h" | |
| 9 | −#undef P | |
| 10 | − | |
| 11 | −void kconfig_load(void) | |
| 12 | −{ | |
| 13 | − void *handle; | |
| 14 | − char *error; | |
| 15 | − | |
| 16 | − handle = dlopen("./libkconfig.so", RTLD_LAZY); | |
| 17 | − if (!handle) { | |
| 18 | − handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); | |
| 19 | − if (!handle) { | |
| 20 | − fprintf(stderr, "%s\n", dlerror()); | |
| 21 | − exit(1); | |
| 22 | − } | |
| 23 | − } | |
| 24 | − | |
| 25 | −#define P(name,type,arg) \ | |
| 26 | −{ \ | |
| 27 | − name ## _p = dlsym(handle, #name); \ | |
| 28 | − if ((error = dlerror())) { \ | |
| 29 | − fprintf(stderr, "%s\n", error); \ | |
| 30 | − exit(1); \ | |
| 31 | − } \ | |
| 32 | −} | |
| 33 | −#include "lkc_proto.h" | |
| 34 | −#undef P | |
| 35 | −} | |
| @@ -7,7 +7,6 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <stdlib.h> |
| 8 | 8 | #include <string.h> |
| 9 | 9 | |
| 10 | −#define LKC_DIRECT_LINK | |
| 11 | 10 | #include "lkc.h" |
| 12 | 11 | |
| 13 | 12 | static char *escape(const char* text, char *bf, int len) |
| @@ -21,12 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; · 20 unmodified lines | ||
| 21 | 21 | extern "C" { |
| 22 | 22 | #endif |
| 23 | 23 | |
| 24 | −#ifdef LKC_DIRECT_LINK | |
| 25 | 24 | #define P(name,type,arg) extern type name arg |
| 26 | −#else | |
| 27 | −#include "lkc_defs.h" | |
| 28 | −#define P(name,type,arg) extern type (*name ## _p) arg | |
| 29 | −#endif | |
| 30 | 25 | #include "lkc_proto.h" |
| 31 | 26 | #undef P |
| 32 | 27 | |
| @@ -79,9 +74,6 @@ void zconf_nextfile(const char *name); · 46 unmodified lines | ||
| 79 | 74 | int zconf_lineno(void); |
| 80 | 75 | const char *zconf_curname(void); |
| 81 | 76 | |
| 82 | −/* conf.c */ | |
| 83 | −void xfgets(char *str, int size, FILE *in); | |
| 84 | − | |
| 85 | 77 | /* confdata.c */ |
| 86 | 78 | const char *conf_get_configname(void); |
| 87 | 79 | const char *conf_get_autoconfig_name(void); |
| @@ -90,6 +82,11 @@ void sym_set_change_count(int count); · 2 unmodified lines | ||
| 90 | 82 | void sym_add_change_count(int count); |
| 91 | 83 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
| 92 | 84 | |
| 85 | +struct conf_printer { | |
| 86 | + void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | |
| 87 | + void (*print_comment)(FILE *, const char *, void *); | |
| 88 | +}; | |
| 89 | + | |
| 93 | 90 | /* confdata.c and expr.c */ |
| 94 | 91 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) |
| 95 | 92 | { |
| @@ -97,9 +94,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) · 1 unmodified line | ||
| 97 | 94 | fprintf(stderr, "\nError in writing or end of file.\n"); |
| 98 | 95 | } |
| 99 | 96 | |
| 100 | −/* kconfig_load.c */ | |
| 101 | −void kconfig_load(void); | |
| 102 | − | |
| 103 | 97 | /* menu.c */ |
| 104 | 98 | void _menu_init(void); |
| 105 | 99 | void menu_warn(struct menu *menu, const char *fmt, ...); |
| @@ -31,6 +31,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); · 30 unmodified lines | ||
| 31 | 31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); |
| 32 | 32 | P(sym_find,struct symbol *,(const char *name)); |
| 33 | 33 | P(sym_expand_string_value,const char *,(const char *in)); |
| 34 | +P(sym_escape_string_value, const char *,(const char *in)); | |
| 34 | 35 | P(sym_re_search,struct symbol **,(const char *pattern)); |
| 35 | 36 | P(sym_type_name,const char *,(enum symbol_type type)); |
| 36 | 37 | P(sym_calc_value,void,(struct symbol *sym)); |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <unistd.h> |
| 19 | 19 | #include <locale.h> |
| 20 | 20 | |
| 21 | −#define LKC_DIRECT_LINK | |
| 22 | 21 | #include "lkc.h" |
| 23 | 22 | #include "lxdialog/dialog.h" |
| 24 | 23 | |
| @@ -845,6 +844,7 @@ int main(int ac, char **av) · 820 unmodified lines | ||
| 845 | 844 | "\n\n")); |
| 846 | 845 | return 1; |
| 847 | 846 | } |
| 847 | + /* fall through */ | |
| 848 | 848 | case -1: |
| 849 | 849 | printf(_("\n\n" |
| 850 | 850 | "*** End of the configuration.\n" |
| @@ -3,10 +3,11 @@ · 2 unmodified lines | ||
| 3 | 3 | * Released under the terms of the GNU GPL v2.0. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#include <ctype.h> | |
| 7 | +#include <stdarg.h> | |
| 6 | 8 | #include <stdlib.h> |
| 7 | 9 | #include <string.h> |
| 8 | 10 | |
| 9 | −#define LKC_DIRECT_LINK | |
| 10 | 11 | #include "lkc.h" |
| 11 | 12 | |
| 12 | 13 | static const char nohelp_text[] = N_( |
| @@ -350,7 +351,7 @@ void menu_finalize(struct menu *parent) · 337 unmodified lines | ||
| 350 | 351 | last_menu->next = NULL; |
| 351 | 352 | } |
| 352 | 353 | |
| 353 | − sym->dir_dep.expr = parent->dep; | |
| 354 | + sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep); | |
| 354 | 355 | } |
| 355 | 356 | for (menu = parent->list; menu; menu = menu->next) { |
| 356 | 357 | if (sym && sym_is_choice(sym) && |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | */ |
| 8 | 8 | #define _GNU_SOURCE |
| 9 | 9 | #include <string.h> |
| 10 | −#define LKC_DIRECT_LINK | |
| 10 | + | |
| 11 | 11 | #include "lkc.h" |
| 12 | 12 | #include "nconf.h" |
| 13 | 13 | #include <ctype.h> |
| @@ -1067,7 +1067,6 @@ static void conf(struct menu *menu) · 1053 unmodified lines | ||
| 1067 | 1067 | struct menu *submenu = 0; |
| 1068 | 1068 | const char *prompt = menu_get_prompt(menu); |
| 1069 | 1069 | struct symbol *sym; |
| 1070 | − struct menu *active_menu = NULL; | |
| 1071 | 1070 | int res; |
| 1072 | 1071 | int current_index = 0; |
| 1073 | 1072 | int last_top_row = 0; |
| @@ -1152,13 +1151,9 @@ static void conf(struct menu *menu) · 78 unmodified lines | ||
| 1152 | 1151 | continue; |
| 1153 | 1152 | |
| 1154 | 1153 | submenu = (struct menu *) item_data(); |
| 1155 | − active_menu = (struct menu *)item_data(); | |
| 1156 | 1154 | if (!submenu || !menu_is_visible(submenu)) |
| 1157 | 1155 | continue; |
| 1158 | − if (submenu) | |
| 1159 | − sym = submenu->sym; | |
| 1160 | − else | |
| 1161 | − sym = NULL; | |
| 1156 | + sym = submenu->sym; | |
| 1162 | 1157 | |
| 1163 | 1158 | switch (res) { |
| 1164 | 1159 | case ' ': |
| @@ -1222,20 +1217,13 @@ static void conf_message_callback(const char *fmt, va_list ap) · 57 unmodified lines | ||
| 1222 | 1217 | |
| 1223 | 1218 | static void show_help(struct menu *menu) |
| 1224 | 1219 | { |
| 1225 | − struct gstr help = str_new(); | |
| 1226 | − | |
| 1227 | − if (menu && menu->sym && menu_has_help(menu)) { | |
| 1228 | − if (menu->sym->name) { | |
| 1229 | − str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name); | |
| 1230 | − str_append(&help, _(menu_get_help(menu))); | |
| 1231 | − str_append(&help, "\n"); | |
| 1232 | − get_symbol_str(&help, menu->sym); | |
| 1233 | − } else { | |
| 1234 | − str_append(&help, _(menu_get_help(menu))); | |
| 1235 | − } | |
| 1236 | − } else { | |
| 1237 | − str_append(&help, nohelp_text); | |
| 1238 | − } | |
| 1220 | + struct gstr help; | |
| 1221 | + | |
| 1222 | + if (!menu) | |
| 1223 | + return; | |
| 1224 | + | |
| 1225 | + help = str_new(); | |
| 1226 | + menu_get_ext_help(menu, &help); | |
| 1239 | 1227 | show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); |
| 1240 | 1228 | str_free(&help); |
| 1241 | 1229 | } |
| @@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void) · 1477 unmodified lines | ||
| 1478 | 1478 | ConfigView::updateListAll(); |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | −void ConfigMainWindow::saveConfig(void) | |
| 1481 | +bool ConfigMainWindow::saveConfig(void) | |
| 1482 | 1482 | { |
| 1483 | − if (conf_write(NULL)) | |
| 1483 | + if (conf_write(NULL)) { | |
| 1484 | 1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); |
| 1485 | + return false; | |
| 1486 | + } | |
| 1487 | + return true; | |
| 1485 | 1488 | } |
| 1486 | 1489 | |
| 1487 | 1490 | void ConfigMainWindow::saveConfigAs(void) |
| @@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) · 154 unmodified lines | ||
| 1642 | 1645 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); |
| 1643 | 1646 | switch (mb.exec()) { |
| 1644 | 1647 | case QMessageBox::Yes: |
| 1645 | − saveConfig(); | |
| 1648 | + if (saveConfig()) | |
| 1649 | + e->accept(); | |
| 1650 | + else | |
| 1651 | + e->ignore(); | |
| 1652 | + break; | |
| 1646 | 1653 | case QMessageBox::No: |
| 1647 | 1654 | e->accept(); |
| 1648 | 1655 | break; |
| @@ -1745,10 +1752,6 @@ int main(int ac, char** av) · 96 unmodified lines | ||
| 1745 | 1752 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 1746 | 1753 | textdomain(PACKAGE); |
| 1747 | 1754 | |
| 1748 | −#ifndef LKC_DIRECT_LINK | |
| 1749 | − kconfig_load(); | |
| 1750 | −#endif | |
| 1751 | − | |
| 1752 | 1755 | progname = av[0]; |
| 1753 | 1756 | configApp = new QApplication(ac, av); |
| 1754 | 1757 | if (ac > 1 && av[1][0] == '-') { |
| @@ -311,7 +311,7 @@ public slots: · 310 unmodified lines | ||
| 311 | 311 | void listFocusChanged(void); |
| 312 | 312 | void goBack(void); |
| 313 | 313 | void loadConfig(void); |
| 314 | − void saveConfig(void); | |
| 314 | + bool saveConfig(void); | |
| 315 | 315 | void saveConfigAs(void); |
| 316 | 316 | void searchConfig(void); |
| 317 | 317 | void showSingleView(void); |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <regex.h> |
| 10 | 10 | #include <sys/utsname.h> |
| 11 | 11 | |
| 12 | −#define LKC_DIRECT_LINK | |
| 13 | 12 | #include "lkc.h" |
| 14 | 13 | |
| 15 | 14 | struct symbol symbol_yes = { |
| @@ -751,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym) · 735 unmodified lines | ||
| 751 | 750 | case no: |
| 752 | 751 | return "n"; |
| 753 | 752 | case mod: |
| 754 | − return "m"; | |
| 753 | + sym_calc_value(modules_sym); | |
| 754 | + return (modules_sym->curr.tri == no) ? "n" : "m"; | |
| 755 | 755 | case yes: |
| 756 | 756 | return "y"; |
| 757 | 757 | } |
| @@ -893,6 +893,49 @@ const char *sym_expand_string_value(const char *in) · 135 unmodified lines | ||
| 893 | 893 | return res; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | +const char *sym_escape_string_value(const char *in) | |
| 897 | +{ | |
| 898 | + const char *p; | |
| 899 | + size_t reslen; | |
| 900 | + char *res; | |
| 901 | + size_t l; | |
| 902 | + | |
| 903 | + reslen = strlen(in) + strlen("\"\"") + 1; | |
| 904 | + | |
| 905 | + p = in; | |
| 906 | + for (;;) { | |
| 907 | + l = strcspn(p, "\"\\"); | |
| 908 | + p += l; | |
| 909 | + | |
| 910 | + if (p[0] == '\0') | |
| 911 | + break; | |
| 912 | + | |
| 913 | + reslen++; | |
| 914 | + p++; | |
| 915 | + } | |
| 916 | + | |
| 917 | + res = malloc(reslen); | |
| 918 | + res[0] = '\0'; | |
| 919 | + | |
| 920 | + strcat(res, "\""); | |
| 921 | + | |
| 922 | + p = in; | |
| 923 | + for (;;) { | |
| 924 | + l = strcspn(p, "\"\\"); | |
| 925 | + strncat(res, p, l); | |
| 926 | + p += l; | |
| 927 | + | |
| 928 | + if (p[0] == '\0') | |
| 929 | + break; | |
| 930 | + | |
| 931 | + strcat(res, "\\"); | |
| 932 | + strncat(res, p++, 1); | |
| 933 | + } | |
| 934 | + | |
| 935 | + strcat(res, "\""); | |
| 936 | + return res; | |
| 937 | +} | |
| 938 | + | |
| 896 | 939 | struct symbol **sym_re_search(const char *pattern) |
| 897 | 940 | { |
| 898 | 941 | struct symbol *sym, **sym_arr = NULL; |
| @@ -5,6 +5,8 @@ · 4 unmodified lines | ||
| 5 | 5 | * Released under the terms of the GNU GPL v2.0. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +#include <stdarg.h> | |
| 9 | +#include <stdlib.h> | |
| 8 | 10 | #include <string.h> |
| 9 | 11 | #include "lkc.h" |
| 10 | 12 | |
| @@ -14,7 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <string.h> |
| 15 | 15 | #include <unistd.h> |
| 16 | 16 | |
| 17 | −#define LKC_DIRECT_LINK | |
| 18 | 17 | #include "lkc.h" |
| 19 | 18 | |
| 20 | 19 | #define START_STRSIZE 16 |
| @@ -776,7 +776,6 @@ char *zconftext; · 775 unmodified lines | ||
| 776 | 776 | #include <string.h> |
| 777 | 777 | #include <unistd.h> |
| 778 | 778 | |
| 779 | −#define LKC_DIRECT_LINK | |
| 780 | 779 | #include "lkc.h" |
| 781 | 780 | |
| 782 | 781 | #define START_STRSIZE 16 |
| @@ -87,7 +87,6 @@ · 86 unmodified lines | ||
| 87 | 87 | #include <string.h> |
| 88 | 88 | #include <stdbool.h> |
| 89 | 89 | |
| 90 | −#define LKC_DIRECT_LINK | |
| 91 | 90 | #include "lkc.h" |
| 92 | 91 | |
| 93 | 92 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
| @@ -11,7 +11,6 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <string.h> |
| 12 | 12 | #include <stdbool.h> |
| 13 | 13 | |
| 14 | −#define LKC_DIRECT_LINK | |
| 15 | 14 | #include "lkc.h" |
| 16 | 15 | |
| 17 | 16 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |