* Returns 1 if the chosen symset was found and loaded. * 0 if it wasn't found in the sym file or other problem. */
| 2628 | * 0 if it wasn't found in the sym file or other problem. |
| 2629 | */ |
| 2630 | int |
| 2631 | read_sym_file(int which_set) |
| 2632 | { |
| 2633 | FILE *fp; |
| 2634 | |
| 2635 | gs.symset[which_set].explicitly = FALSE; |
| 2636 | if (!(fp = fopen_sym_file())) |
| 2637 | return 0; |
| 2638 | |
| 2639 | gs.symset[which_set].explicitly = TRUE; |
| 2640 | gc.chosen_symset_start = gc.chosen_symset_end = FALSE; |
| 2641 | gs.symset_which_set = which_set; |
| 2642 | gs.symset_count = 0; |
| 2643 | |
| 2644 | config_error_init(TRUE, "symbols", FALSE); |
| 2645 | |
| 2646 | parse_conf_file(fp, proc_symset_line); |
| 2647 | (void) fclose(fp); |
| 2648 | |
| 2649 | if (!gc.chosen_symset_start && !gc.chosen_symset_end) { |
| 2650 | /* name caller put in symset[which_set].name was not found; |
| 2651 | if it looks like "Default symbols", null it out and return |
| 2652 | success to use the default; otherwise, return failure */ |
| 2653 | if (gs.symset[which_set].name |
| 2654 | && (fuzzymatch(gs.symset[which_set].name, "Default symbols", |
| 2655 | " -_", TRUE) |
| 2656 | || !strcmpi(gs.symset[which_set].name, "default"))) |
| 2657 | clear_symsetentry(which_set, TRUE); |
| 2658 | config_error_done(); |
| 2659 | |
| 2660 | /* If name was defined, it was invalid. Then we're loading fallback */ |
| 2661 | if (gs.symset[which_set].name) { |
| 2662 | gs.symset[which_set].explicitly = FALSE; |
| 2663 | return 0; |
| 2664 | } |
| 2665 | |
| 2666 | return 1; |
| 2667 | } |
| 2668 | if (!gc.chosen_symset_end) |
| 2669 | config_error_add("Missing finish for symset \"%s\"", |
| 2670 | gs.symset[which_set].name ? gs.symset[which_set].name |
| 2671 | : "unknown"); |
| 2672 | config_error_done(); |
| 2673 | return 1; |
| 2674 | } |
| 2675 | |
| 2676 | /* ---------- END SYMSET FILE HANDLING ----------- */ |
| 2677 |
no test coverage detected