* Display help text for a table of options. * @param con context * @param fp output file handle * @param table option(s) * @param columns output display width control * @param translation_domain translation domain */
| 565 | * @param translation_domain translation domain |
| 566 | */ |
| 567 | static void singleTableHelp(poptContext con, FILE * fp, |
| 568 | const struct poptOption * table, |
| 569 | columns_t columns, |
| 570 | const char * translation_domain) |
| 571 | { |
| 572 | const struct poptOption * opt; |
| 573 | const char *sub_transdom; |
| 574 | |
| 575 | if (table == poptAliasOptions) { |
| 576 | itemHelp(fp, con->aliases, con->numAliases, columns, NULL); |
| 577 | itemHelp(fp, con->execs, con->numExecs, columns, NULL); |
| 578 | return; |
| 579 | } |
| 580 | |
| 581 | if (table != NULL) |
| 582 | for (opt = table; opt->longName || opt->shortName || opt->arg; opt++) { |
| 583 | if ((opt->longName || opt->shortName) && !F_ISSET(opt, DOC_HIDDEN)) |
| 584 | singleOptionHelp(fp, columns, opt, translation_domain); |
| 585 | } |
| 586 | |
| 587 | if (table != NULL) |
| 588 | for (opt = table; opt->longName || opt->shortName || opt->arg; opt++) { |
| 589 | void * arg = opt->arg; |
| 590 | if (poptArgType(opt) != POPT_ARG_INCLUDE_TABLE) |
| 591 | continue; |
| 592 | /* XXX sick hack to preserve pretense of ABI. */ |
| 593 | if (arg == poptHelpOptions) |
| 594 | arg = poptHelpOptionsI18N; |
| 595 | sub_transdom = getTableTranslationDomain(arg); |
| 596 | if (sub_transdom == NULL) |
| 597 | sub_transdom = translation_domain; |
| 598 | |
| 599 | /* If no popt aliases/execs, skip poptAliasOption processing. */ |
| 600 | if (arg == poptAliasOptions && !(con->numAliases || con->numExecs)) |
| 601 | continue; |
| 602 | if (opt->descrip) |
| 603 | POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip)); |
| 604 | |
| 605 | singleTableHelp(con, fp, arg, columns, sub_transdom); |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * @param con context |
no test coverage detected