| 434 | } |
| 435 | |
| 436 | static void search_conf(void) |
| 437 | { |
| 438 | struct symbol **sym_arr; |
| 439 | struct gstr res; |
| 440 | struct gstr title; |
| 441 | char *dialog_input; |
| 442 | int dres, vscroll = 0, hscroll = 0; |
| 443 | bool again; |
| 444 | struct gstr sttext; |
| 445 | struct subtitle_part stpart; |
| 446 | |
| 447 | title = str_new(); |
| 448 | str_printf( &title, "Enter (sub)string or regexp to search for " |
| 449 | "(with or without \"%s\")", CONFIG_); |
| 450 | |
| 451 | again: |
| 452 | dialog_clear(); |
| 453 | dres = dialog_inputbox("Search Configuration Parameter", |
| 454 | str_get(&title), |
| 455 | 10, 75, ""); |
| 456 | switch (dres) { |
| 457 | case 0: |
| 458 | break; |
| 459 | case 1: |
| 460 | show_helptext("Search Configuration", search_help); |
| 461 | goto again; |
| 462 | default: |
| 463 | str_free(&title); |
| 464 | return; |
| 465 | } |
| 466 | |
| 467 | /* strip the prefix if necessary */ |
| 468 | dialog_input = dialog_input_result; |
| 469 | if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0) |
| 470 | dialog_input += strlen(CONFIG_); |
| 471 | |
| 472 | sttext = str_new(); |
| 473 | str_printf(&sttext, "Search (%s)", dialog_input_result); |
| 474 | stpart.text = str_get(&sttext); |
| 475 | list_add_tail(&stpart.entries, &trail); |
| 476 | |
| 477 | sym_arr = sym_re_search(dialog_input); |
| 478 | do { |
| 479 | LIST_HEAD(head); |
| 480 | struct search_data data = { |
| 481 | .head = &head, |
| 482 | }; |
| 483 | struct jump_key *pos, *tmp; |
| 484 | |
| 485 | jump_key_char = 0; |
| 486 | res = get_relations_str(sym_arr, &head); |
| 487 | set_subtitle(); |
| 488 | dres = show_textbox_ext("Search Results", str_get(&res), 0, 0, |
| 489 | &vscroll, &hscroll, |
| 490 | handle_search_keys, &data); |
| 491 | again = false; |
| 492 | if (dres >= '1' && dres <= '9') { |
| 493 | assert(data.target != NULL); |
no test coverage detected