Messages in this thread | | | Date | Tue, 14 Sep 2004 19:53:26 +0200 (CEST) | From | Roman Zippel <> | Subject | Re: [PATCH] Menuconfig search changes - pt. 3 |
| |
Hi,
On Tue, 14 Sep 2004, Yuval Turgeman wrote:
> +static int regex_match(const char *string, regex_t *re) > +{ > + int rc; > + > + rc = regexec(re, string, (size_t) 0, NULL, 0); > + if (rc) > + return 0; > + return 1; > +}
I guess, this doesn't has to be a separate function anymore.
> +static void show_expr(struct menu *menu, FILE *fp) > +{ > + bool hit = false; > + fprintf(fp, "Depends:\n "); > + if (menu->prompt->visible.expr) { > + if (!hit) > + hit = true; > + expr_fprint(menu->prompt->visible.expr, fp); > + } > + if (!hit) > + fprintf(fp, "None"); > + if (menu->sym) { > + struct property *prop; > + hit = false; > + fprintf(fp, "\nSelects:\n "); > + for_all_properties(menu->sym, prop, P_SELECT) { > + if (!hit) > + hit = true; > + expr_fprint(prop->expr, fp); > + } > + if (!hit) > + fprintf(fp, "None"); > + hit = false; > + fprintf(fp, "\nSelected by:\n "); > + if (menu->sym->rev_dep.expr) { > + hit = true; > + expr_fprint(menu->sym->rev_dep.expr, fp); > + } > + if (!hit) > + fprintf(fp, "None"); > + } > +}
This still prints duplicate information, look at how ConfigMainWindow::setHelp() in qconf.cc does it. Your function should have pretty much the same structure, e.g.
> + for_all_symbols(i, sym) { > + if (!sym->name) > + continue; > + if (!regex_match(sym->name, &re)) > + continue; > + for_all_prompts(sym, prop) {
here you should iterate over all properties and print the info about it.
> + if (!hit) > + fprintf(fp, "No matches found.");
You could print the number of found symbols here.
> stat = exec_conf(); > + if (stat == 26) {
Move this into the switch part a few lines below and simply use the next available number. For this you need to print the currently selected symbol and the search string from lxdialog, this way you also return to the same previously selected symbol after exiting the search.
bye, Roman - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |