popt 1.13
|
Go to the source code of this file.
Data Structures | |
struct | columns_s |
struct | poptDone_s |
Keep track of option tables already processed. More... | |
Defines | |
#define | POPT_USE_TIOCGWINSZ |
#define | POPT_WCHAR_HACK |
#define | _POPTHELP_MAXLINE ((size_t)79) |
Typedefs | |
typedef struct columns_s * | columns_t |
typedef struct poptDone_s * | poptDone |
Keep track of option tables already processed. | |
Functions | |
static void | displayArgs (poptContext con, enum poptCallbackReason foo, struct poptOption *key, const char *arg, void *data) |
Display arguments. | |
static size_t | maxColumnWidth (FILE *fp) |
Return no. | |
static const char * | getTableTranslationDomain (const struct poptOption *table) |
static const char * | getArgDescrip (const struct poptOption *opt, const char *translation_domain) |
static char * | singleOptionDefaultValue (size_t lineLength, const struct poptOption *opt, const char *translation_domain) |
Display default value for an option. | |
static void | singleOptionHelp (FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain) |
Display help text for an option. | |
static size_t | maxArgWidth (const struct poptOption *opt, const char *translation_domain) |
Find display width for longest argument string. | |
static void | itemHelp (FILE *fp, poptItem items, int nitems, columns_t columns, const char *translation_domain) |
Display popt alias and exec help. | |
static void | singleTableHelp (poptContext con, FILE *fp, const struct poptOption *table, columns_t columns, const char *translation_domain) |
Display help text for a table of options. | |
static size_t | showHelpIntro (poptContext con, FILE *fp) |
void | poptPrintHelp (poptContext con, FILE *fp, int flags) |
Print detailed description of options. | |
static size_t | singleOptionUsage (FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain) |
Display usage text for an option. | |
static size_t | itemUsage (FILE *fp, columns_t columns, poptItem item, int nitems, const char *translation_domain) |
Display popt alias and exec usage. | |
static size_t | singleTableUsage (poptContext con, FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain, poptDone done) |
Display usage text for a table of options. | |
static size_t | showShortOptions (const struct poptOption *opt, FILE *fp, char *str) |
Return concatenated short options for display. | |
void | poptPrintUsage (poptContext con, FILE *fp, int flags) |
Print terse description of options. | |
void | poptSetOtherOptionHelp (poptContext con, const char *text) |
Provide text to replace default "[OPTION...]" in help/usage output. | |
Variables | |
struct poptOption | poptAliasOptions [] |
Empty table marker to enable displaying popt alias/exec options. | |
struct poptOption | poptHelpOptions [] |
Auto help table options. | |
static struct poptOption | poptHelpOptions2 [] |
struct poptOption * | poptHelpOptionsI18N = poptHelpOptions2 |
#define _POPTHELP_MAXLINE ((size_t)79) |
Definition at line 98 of file popthelp.c.
Referenced by maxColumnWidth().
#define POPT_USE_TIOCGWINSZ |
Definition at line 13 of file popthelp.c.
#define POPT_WCHAR_HACK |
Definition at line 18 of file popthelp.c.
typedef struct poptDone_s * poptDone |
Keep track of option tables already processed.
static void displayArgs | ( | poptContext | con, |
enum poptCallbackReason | foo, | ||
struct poptOption * | key, | ||
const char * | arg, | ||
void * | data | ||
) | [static] |
Display arguments.
con | context |
foo | (unused) |
key | option(s) |
arg | (unused) |
data | (unused) |
Definition at line 38 of file popthelp.c.
References poptFreeContext(), poptPrintHelp(), poptPrintUsage(), and poptOption::shortName.
static const char* getArgDescrip | ( | const struct poptOption * | opt, |
const char * | translation_domain | ||
) | [static] |
opt | option(s) |
translation_domain | translation domain |
< return (*arg) (argc, argv)
< no arg
< arg should take value val
< arg will be converted to int
< arg will be converted to long
< arg will be saved as string
< arg will be converted to float
< arg will be converted to double
< return (*arg) (argc, argv)
Definition at line 148 of file popthelp.c.
References poptOption::argDescrip, poptOption::argInfo, D_, N_, POPT_, POPT_ARG_DOUBLE, POPT_ARG_FLOAT, POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_MAINCALL, POPT_ARG_MASK, POPT_ARG_NONE, POPT_ARG_STRING, and POPT_ARG_VAL.
Referenced by maxArgWidth(), singleOptionHelp(), and singleOptionUsage().
static const char* getTableTranslationDomain | ( | const struct poptOption * | table | ) | [static] |
table | option(s) |
< set the translation domain for this table and any included tables; arg points to the domain string
Definition at line 130 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INTL_DOMAIN, and poptOption::shortName.
Referenced by singleTableHelp().
static void itemHelp | ( | FILE * | fp, |
poptItem | items, | ||
int | nitems, | ||
columns_t | columns, | ||
const char * | translation_domain | ||
) | [static] |
Display popt alias and exec help.
fp | output file handle |
items | alias/exec array |
nitems | no. of alias/exec entries |
left | largest argument display width |
translation_domain | translation domain |
< don't show in help/usage
Definition at line 519 of file popthelp.c.
References poptOption::argInfo, poptOption::longName, poptItem_s::option, POPT_ARGFLAG_DOC_HIDDEN, poptOption::shortName, and singleOptionHelp().
Referenced by singleTableHelp().
static size_t itemUsage | ( | FILE * | fp, |
columns_t | columns, | ||
poptItem | item, | ||
int | nitems, | ||
const char * | translation_domain | ||
) | [static] |
Display popt alias and exec usage.
fp | output file handle |
columns | output display width control |
item | alias/exec array |
nitems | no. of ara/exec entries |
translation_domain | translation domain |
< set the translation domain for this table and any included tables; arg points to the domain string
< don't show in help/usage
Definition at line 713 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, columns_s::cur, poptOption::longName, poptItem_s::option, POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, POPT_ARGFLAG_DOC_HIDDEN, poptOption::shortName, and singleOptionUsage().
Referenced by poptPrintUsage().
static size_t maxArgWidth | ( | const struct poptOption * | opt, |
const char * | translation_domain | ||
) | [static] |
Find display width for longest argument string.
opt | option(s) |
translation_domain | translation domain |
< arg points to table
< don't show in help/usage
< allow -longoption
< arg may be missing
Definition at line 458 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, getArgDescrip(), poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, POPT_ARGFLAG_DOC_HIDDEN, POPT_ARGFLAG_ONEDASH, POPT_ARGFLAG_OPTIONAL, and poptOption::shortName.
Referenced by poptPrintHelp().
static size_t maxColumnWidth | ( | FILE * | fp | ) | [static] |
Return no.
of columns in output window.
fp | FILE |
Definition at line 110 of file popthelp.c.
References _POPTHELP_MAXLINE.
Referenced by poptPrintHelp(), and poptPrintUsage().
void poptPrintHelp | ( | poptContext | con, |
FILE * | fp, | ||
int | flags | ||
) |
Print detailed description of options.
con | context |
fp | ouput file handle |
flags | (unused) |
Definition at line 610 of file popthelp.c.
References columns_s::cur, columns_s::max, maxArgWidth(), maxColumnWidth(), poptContext_s::options, poptContext_s::otherHelp, POPT_, showHelpIntro(), and singleTableHelp().
Referenced by displayArgs().
void poptPrintUsage | ( | poptContext | con, |
FILE * | fp, | ||
int | flags | ||
) |
Print terse description of options.
con | context |
fp | ouput file handle |
flags | (unused) |
Definition at line 837 of file popthelp.c.
References poptContext_s::aliases, columns_s::cur, poptContext_s::execs, itemUsage(), columns_s::max, maxColumnWidth(), poptContext_s::numAliases, poptContext_s::numExecs, poptContext_s::options, poptContext_s::otherHelp, showHelpIntro(), showShortOptions(), and singleTableUsage().
Referenced by displayArgs().
void poptSetOtherOptionHelp | ( | poptContext | con, |
const char * | text | ||
) |
Provide text to replace default "[OPTION...]" in help/usage output.
con | context |
text | replacement text |
Definition at line 874 of file popthelp.c.
References _free(), poptContext_s::otherHelp, and xstrdup().
static size_t showHelpIntro | ( | poptContext | con, |
FILE * | fp | ||
) | [static] |
con | context |
fp | output file handle |
< pay attention to argv[0]
Definition at line 589 of file popthelp.c.
References optionStackEntry::argv, poptContext_s::flags, poptContext_s::optionStack, POPT_, and POPT_CONTEXT_KEEP_FIRST.
Referenced by poptPrintHelp(), and poptPrintUsage().
static size_t showShortOptions | ( | const struct poptOption * | opt, |
FILE * | fp, | ||
char * | str | ||
) | [static] |
Return concatenated short options for display.
opt | option(s) |
fp | output file handle |
str | concatenation of short options |
< arg points to table
Definition at line 802 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and poptOption::shortName.
Referenced by poptPrintUsage().
static char* singleOptionDefaultValue | ( | size_t | lineLength, |
const struct poptOption * | opt, | ||
const char * | translation_domain | ||
) | [static] |
Display default value for an option.
lineLength | display positions remaining |
opt | option(s) |
translation_domain | translation domain |
< arg should take value val
< arg will be converted to int
< arg will be converted to long
< arg will be converted to float
< arg will be converted to double
< return (*arg) (argc, argv)
< arg will be saved as string
< no arg
Definition at line 196 of file popthelp.c.
References _free(), poptOption::arg, poptOption::argInfo, D_, POPT_ARG_DOUBLE, POPT_ARG_FLOAT, POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_MAINCALL, POPT_ARG_MASK, POPT_ARG_NONE, POPT_ARG_STRING, and POPT_ARG_VAL.
Referenced by singleOptionHelp().
static void singleOptionHelp | ( | FILE * | fp, |
columns_t | columns, | ||
const struct poptOption * | opt, | ||
const char * | translation_domain | ||
) | [static] |
Display help text for an option.
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
< allow -longoption
< return (*arg) (argc, argv)
< allow -longoption
< arg may be missing
< show default value in --help
< no arg
< arg should take value val
< arg will be converted to int
< arg will be converted to long
< arg will be converted to float
< arg will be converted to double
< arg will be saved as string
< return (*arg) (argc, argv)
< arg may be missing
Definition at line 268 of file popthelp.c.
References _free(), _isspaceptr, poptOption::argDescrip, poptOption::argInfo, columns_s::cur, D_, poptOption::descrip, getArgDescrip(), poptOption::longName, columns_s::max, POPT_ARG_DOUBLE, POPT_ARG_FLOAT, POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_MAINCALL, POPT_ARG_MASK, POPT_ARG_NONE, POPT_ARG_STRING, POPT_ARG_VAL, POPT_ARGFLAG_AND, POPT_ARGFLAG_LOGICALOPS, POPT_ARGFLAG_NOT, POPT_ARGFLAG_ONEDASH, POPT_ARGFLAG_OPTIONAL, POPT_ARGFLAG_OR, POPT_ARGFLAG_SHOW_DEFAULT, POPT_ARGFLAG_XOR, POPT_next_char(), POPT_prev_char(), poptOption::shortName, singleOptionDefaultValue(), and poptOption::val.
Referenced by itemHelp(), and singleTableHelp().
static size_t singleOptionUsage | ( | FILE * | fp, |
columns_t | columns, | ||
const struct poptOption * | opt, | ||
const char * | translation_domain | ||
) | [static] |
Display usage text for an option.
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
< allow -longoption
< allow -longoption
< allow -longoption
< allow -longoption
Definition at line 635 of file popthelp.c.
References poptOption::argDescrip, poptOption::argInfo, columns_s::cur, getArgDescrip(), poptOption::longName, columns_s::max, POPT_ARGFLAG_ONEDASH, and poptOption::shortName.
Referenced by itemUsage(), and singleTableUsage().
static void singleTableHelp | ( | poptContext | con, |
FILE * | fp, | ||
const struct poptOption * | table, | ||
columns_t | columns, | ||
const char * | translation_domain | ||
) | [static] |
Display help text for a table of options.
con | context |
fp | output file handle |
table | option(s) |
columns | output display width control |
translation_domain | translation domain |
< don't show in help/usage
< arg points to table
Definition at line 547 of file popthelp.c.
References poptContext_s::aliases, poptOption::arg, poptOption::argInfo, D_, poptOption::descrip, poptContext_s::execs, getTableTranslationDomain(), itemHelp(), poptOption::longName, poptContext_s::numAliases, poptContext_s::numExecs, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, POPT_ARGFLAG_DOC_HIDDEN, poptOption::shortName, and singleOptionHelp().
Referenced by poptPrintHelp().
static size_t singleTableUsage | ( | poptContext | con, |
FILE * | fp, | ||
columns_t | columns, | ||
const struct poptOption * | opt, | ||
const char * | translation_domain, | ||
poptDone | done | ||
) | [static] |
Display usage text for a table of options.
con | context |
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
done | tables already processed |
< set the translation domain for this table and any included tables; arg points to the domain string
< arg points to table
< don't show in help/usage
Definition at line 756 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, columns_s::cur, poptOption::longName, poptDone_s::maxopts, poptDone_s::nopts, poptDone_s::opts, POPT_ARG_INCLUDE_TABLE, POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, POPT_ARGFLAG_DOC_HIDDEN, poptOption::shortName, and singleOptionUsage().
Referenced by poptPrintUsage().
struct poptOption poptAliasOptions[] |
{
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
}
Empty table marker to enable displaying popt alias/exec options.
Definition at line 63 of file popthelp.c.
struct poptOption poptHelpOptions[] |
{ { NULL, '\0', 5U , (void *)displayArgs, 0, NULL, NULL }, { "help", '?', 0, NULL, (int)'?', "Show this help message" , NULL }, { "usage", '\0', 0, NULL, (int)'u', "Display brief usage message" , NULL }, { NULL, '\0', 0, NULL, 0, NULL, NULL } }
Auto help table options.
Definition at line 72 of file popthelp.c.
Referenced by findOption(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().
struct poptOption poptHelpOptions2[] [static] |
{ { NULL, '\0', 6U , PACKAGE, 0, NULL, NULL}, { NULL, '\0', 5U , (void *)displayArgs, 0, NULL, NULL }, { "help", '?', 0, NULL, (int)'?', "Show this help message" , NULL }, { "usage", '\0', 0, NULL, (int)'u', "Display brief usage message" , NULL }, { NULL, '\0', 0, NULL, 0, NULL, NULL } }
Definition at line 80 of file popthelp.c.
struct poptOption* poptHelpOptionsI18N = poptHelpOptions2 |
Definition at line 95 of file popthelp.c.
Referenced by findOption(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().