/** * Print the long options processed with "-W". These options will be the * ones that do *not* have flag characters. * * @param opts the program option descriptor * @param title the title for the options */ static void prt_vendor_opts(tOptions * opts, char const * title) { static unsigned int const not_vended_mask = OPTST_NO_USAGE_MASK | OPTST_DOCUMENT; static char const vfmtfmt[] = "%%-%us %%s\n"; char vfmt[sizeof(vfmtfmt)]; /* * Only handle client specified options. The "vendor option" follows * "presetOptCt", so we won't loop/recurse indefinitely. */ int ct = opts->presetOptCt; tOptDesc * od = opts->pOptDesc; fprintf(option_usage_fp, zTabout + tab_skip_ct, zVendOptsAre); { size_t nmlen = 0; do { size_t l; if ( ((od->fOptState & not_vended_mask) != 0) || IS_GRAPHIC_CHAR(od->optValue)) continue; l = strlen(od->pz_Name); if (l > nmlen) nmlen = l; } while (od++, (--ct > 0)); snprintf(vfmt, sizeof(vfmt), vfmtfmt, (unsigned int)nmlen + 4); } if (tab_skip_ct > 0) tab_skip_ct--; ct = opts->presetOptCt; od = opts->pOptDesc; do { if ( ((od->fOptState & not_vended_mask) != 0) || IS_GRAPHIC_CHAR(od->optValue)) continue; prt_one_vendor(opts, od, &argTypes, vfmt); prt_extd_usage(opts, od, title); } while (od++, (--ct > 0)); /* no need to restore "tab_skip_ct" - options are done now */ }
/** * Print the long options processed with "-W". These options will be the * ones that do *not* have flag characters. * * @param pOptions the program option descriptor * @param pOD the option descriptor * @param pAT names of the option argument types */ static void prt_vendor_opts(tOptions * pOpts, arg_types_t * pAT, char const * pOptTitle) { static unsigned int const not_vended_mask = OPTST_NO_USAGE_MASK | OPTST_DOCUMENT; static char const vfmtfmt[] = "%%-%us %%s\n"; char vfmt[sizeof(vfmtfmt)]; /* * Only handle client specified options. The "vendor option" follows * "presetOptCt", so we won't loop/recurse indefinitely. */ int ct = pOpts->presetOptCt; tOptDesc * pOD = pOpts->pOptDesc; size_t nmlen = 0; fprintf(option_usage_fp, zTabout, zVendOptsAre); do { size_t l; if ( ((pOD->fOptState & not_vended_mask) != 0) || IS_GRAPHIC_CHAR(pOD->optValue)) continue; l = strlen(pOD->pz_Name); if (l > nmlen) nmlen = l; } while (pOD++, (--ct > 0)); sprintf(vfmt, vfmtfmt, (unsigned int)nmlen + 4); ct = pOpts->presetOptCt; pOD = pOpts->pOptDesc; do { if ( ((pOD->fOptState & not_vended_mask) != 0) || IS_GRAPHIC_CHAR(pOD->optValue)) continue; prt_one_vendor(pOpts, pOD, &argTypes, vfmt); prt_extd_usage(pOpts, pOD, &argTypes, pOptTitle); } while (pOD++, (--ct > 0)); }