#include "system.h"
#include <wchar.h>
#include "poptint.h"
Go to the source code of this file.
Data Structures | ||||
struct | poptDone_s | |||
Keep track of option tables already processed. More... | ||||
Defines | ||||
#define | POPT_WCHAR_HACK | |||
Typedefs | ||||
typedef 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 const char *const | getTableTranslationDomain (const struct poptOption *table) | |||
| ||||
static const char *const | 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, size_t maxLeftCol, 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, size_t left, const char *translation_domain) | |||
Display popt alias and exec help. | ||||
static void | singleTableHelp (poptContext con, FILE *fp, const struct poptOption *table, size_t left, const char *translation_domain) | |||
Display help text for a table of options. | ||||
static int | showHelpIntro (poptContext con, FILE *fp) | |||
| ||||
void | poptPrintHelp (poptContext con, FILE *fp, int flags) | |||
Print detailed description of options. | ||||
static size_t | singleOptionUsage (FILE *fp, size_t cursor, const struct poptOption *opt, const char *translation_domain) | |||
Display usage text for an option. | ||||
static size_t | itemUsage (FILE *fp, size_t cursor, poptItem item, int nitems, const char *translation_domain) | |||
Display popt alias and exec usage. | ||||
static size_t | singleTableUsage (poptContext con, FILE *fp, size_t cursor, const struct poptOption *opt, const char *translation_domain, poptDone done) | |||
Display usage text for a table of options. | ||||
static int | 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 | ||||
poptOption | poptAliasOptions [] | |||
Empty table marker to enable displaying popt alias/exec options. | ||||
poptOption | poptHelpOptions [] | |||
Auto help table options. | ||||
static struct poptOption | poptHelpOptions2 [] | |||
poptOption * | poptHelpOptionsI18N = poptHelpOptions2 |
Definition in file popthelp.c.
#define POPT_WCHAR_HACK |
Definition at line 13 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 30 of file popthelp.c.
References poptPrintHelp(), poptPrintUsage(), and poptOption::shortName.
static const char* const getArgDescrip | ( | const struct poptOption * | opt, | |
const char * | translation_domain | |||
) | [static] |
opt | option(s) |
translation_domain | translation domain |
Definition at line 110 of file popthelp.c.
References poptOption::argDescrip, poptOption::argInfo, D_, POPT_, POPT_ARG_DOUBLE, POPT_ARG_FLOAT, POPT_ARG_INT, POPT_ARG_LONG, POPT_ARG_MASK, POPT_ARG_NONE, POPT_ARG_STRING, POPT_ARG_VAL, and poptHelpOptions.
Referenced by maxArgWidth(), singleOptionHelp(), and singleOptionUsage().
static const char* const getTableTranslationDomain | ( | const struct poptOption * | table | ) | [static] |
table | option(s) |
Definition at line 92 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, | |||
size_t | left, | |||
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 |
Definition at line 473 of file popthelp.c.
References items, poptItem_s::option, POPT_ARGFLAG_DOC_HIDDEN, and singleOptionHelp().
Referenced by singleTableHelp().
static size_t itemUsage | ( | FILE * | fp, | |
size_t | cursor, | |||
poptItem | item, | |||
int | nitems, | |||
const char * | translation_domain | |||
) | [static] |
Display popt alias and exec usage.
fp | output file handle | |
cursor | current display position | |
item | alias/exec array | |
nitems | no. of ara/exec entries | |
translation_domain | translation domain |
Definition at line 661 of file popthelp.c.
References poptOption::arg, poptItem_s::option, POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, POPT_ARGFLAG_DOC_HIDDEN, 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 |
Definition at line 410 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 int showHelpIntro | ( | poptContext | con, | |
FILE * | fp | |||
) | [static] |
con | context |
fp | output file handle |
Definition at line 541 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 int 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 |
Definition at line 756 of file popthelp.c.
References alloca(), 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 |
Definition at line 147 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_MASK, POPT_ARG_NONE, POPT_ARG_STRING, and POPT_ARG_VAL.
Referenced by singleOptionHelp().
static void singleOptionHelp | ( | FILE * | fp, | |
size_t | maxLeftCol, | |||
const struct poptOption * | opt, | |||
const char * | translation_domain | |||
) | [static] |
Display help text for an option.
fp | output file handle | |
maxLeftCol | largest argument display width | |
opt | option(s) | |
translation_domain | translation domain |
Definition at line 218 of file popthelp.c.
References _free(), poptOption::argDescrip, poptOption::argInfo, D_, poptOption::descrip, getArgDescrip(), left, poptOption::longName, ops, POPT_ARG_DOUBLE, POPT_ARG_FLOAT, POPT_ARG_INT, POPT_ARG_LONG, 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, poptOption::shortName, singleOptionDefaultValue(), and poptOption::val.
Referenced by itemHelp(), and singleTableHelp().
static size_t singleOptionUsage | ( | FILE * | fp, | |
size_t | cursor, | |||
const struct poptOption * | opt, | |||
const char * | translation_domain | |||
) | [static] |
Display usage text for an option.
fp | output file handle | |
cursor | current display position | |
opt | option(s) | |
translation_domain | translation domain |
Definition at line 585 of file popthelp.c.
References poptOption::argDescrip, poptOption::argInfo, getArgDescrip(), poptOption::longName, POPT_ARGFLAG_ONEDASH, and poptOption::shortName.
Referenced by itemUsage().
static void singleTableHelp | ( | poptContext | con, | |
FILE * | fp, | |||
const struct poptOption * | table, | |||
size_t | left, | |||
const char * | translation_domain | |||
) | [static] |
Display help text for a table of options.
con | context | |
fp | output file handle | |
table | option(s) | |
left | largest argument display width | |
translation_domain | translation domain |
Definition at line 500 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, poptAliasOptions, poptOption::shortName, and singleOptionHelp().
Referenced by poptPrintHelp().
static size_t singleTableUsage | ( | poptContext | con, | |
FILE * | fp, | |||
size_t | cursor, | |||
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 | |
cursor | current display position | |
opt | option(s) | |
translation_domain | translation domain | |
done | tables already processed |
Definition at line 705 of file popthelp.c.
References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, and poptOption::shortName.
Referenced by poptPrintUsage().
struct poptOption poptAliasOptions[] |
Initial value:
{ POPT_TABLEEND }
Definition at line 53 of file popthelp.c.
Referenced by singleTableHelp().
struct poptOption poptHelpOptions[] |
Initial value:
{ { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL }, { "help", '?', 0, NULL, '?', "Show this help message" , NULL }, { "usage", '\0', 0, NULL, 'u', "Display brief usage message" , NULL }, POPT_TABLEEND }
Definition at line 62 of file popthelp.c.
Referenced by findOption(), getArgDescrip(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().
struct poptOption poptHelpOptions2[] [static] |
Initial value:
{ { NULL, '\0', POPT_ARG_INTL_DOMAIN, PACKAGE, 0, NULL, NULL}, { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL }, { "help", '?', 0, NULL, '?', "Show this help message" , NULL }, { "usage", '\0', 0, NULL, 'u', "Display brief usage message" , NULL }, POPT_TABLEEND }
Definition at line 70 of file popthelp.c.
struct poptOption* poptHelpOptionsI18N = poptHelpOptions2 |
Definition at line 85 of file popthelp.c.
Referenced by findOption(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().