| 847 | } |
| 848 | |
| 849 | void poptPrintUsage(poptContext con, FILE * fp, UNUSED(int flags)) |
| 850 | { |
| 851 | columns_t columns = calloc((size_t)1, sizeof(*columns)); |
| 852 | struct poptDone_s done_buf; |
| 853 | poptDone done = &done_buf; |
| 854 | |
| 855 | memset(done, 0, sizeof(*done)); |
| 856 | done->nopts = 0; |
| 857 | done->maxopts = 64; |
| 858 | if (columns) { |
| 859 | columns->cur = done->maxopts * sizeof(*done->opts); |
| 860 | columns->max = maxColumnWidth(fp); |
| 861 | done->opts = calloc((size_t)1, columns->cur); |
| 862 | if (done->opts != NULL) |
| 863 | done->opts[done->nopts++] = (const void *) con->options; |
| 864 | |
| 865 | columns->cur = showHelpIntro(con, fp); |
| 866 | columns->cur += showShortOptions(con->options, fp, NULL); |
| 867 | columns->cur = singleTableUsage(con, fp, columns, con->options, NULL, done); |
| 868 | columns->cur = itemUsage(fp, columns, con->aliases, con->numAliases, NULL); |
| 869 | columns->cur = itemUsage(fp, columns, con->execs, con->numExecs, NULL); |
| 870 | |
| 871 | if (con->otherHelp) { |
| 872 | columns->cur += strlen(con->otherHelp) + 1; |
| 873 | if (columns->cur > columns->max) fprintf(fp, "\n "); |
| 874 | fprintf(fp, " %s", con->otherHelp); |
| 875 | } |
| 876 | |
| 877 | fprintf(fp, "\n"); |
| 878 | if (done->opts != NULL) |
| 879 | free(done->opts); |
| 880 | free(columns); |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | void poptSetOtherOptionHelp(poptContext con, const char * text) |
| 885 | { |
no test coverage detected