#include "system.h"#include <sys/ioctl.h>#include <wchar.h>#include "poptint.h"

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) |
| #define | prtlong (opt->longName != NULL) |
| #define | prtlong (opt->longName != NULL) |
Typedefs | |
| typedef struct columns_s * | columns_t |
| typedef struct poptDone_s * | poptDone |
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 size_t | stringDisplayWidth (const char *s) |
| Determine number of display characters in a string. | |
| static const char * | getTableTranslationDomain (const struct poptOption *opt) |
| 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 |
Definition in file popthelp.c.
| #define _POPTHELP_MAXLINE ((size_t)79) |
Definition at line 109 of file popthelp.c.
| #define POPT_USE_TIOCGWINSZ |
Definition at line 13 of file popthelp.c.
| #define POPT_WCHAR_HACK |
Definition at line 18 of file popthelp.c.
| #define prtlong (opt->longName != NULL) |
| #define prtlong (opt->longName != NULL) |
| typedef struct poptDone_s * poptDone |
| 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 36 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 |
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< no arg
< arg should take value val
< arg ==> int
< arg ==> long
< arg ==> long long
< arg will be saved as string
< arg ==> float
< arg ==> double
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
Definition at line 186 of file popthelp.c.
References poptOption::argDescrip, D_, N_, and POPT_.
| static const char* getTableTranslationDomain | ( | const struct poptOption * | opt | ) | [static] |
| opt | option(s) |
< set the translation domain for this table and any included tables; arg points to the domain string
Definition at line 167 of file popthelp.c.
| 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 | |
| columns | output display width control | |
| translation_domain | translation domain |
< don't show in help/usage
Definition at line 565 of file popthelp.c.
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 756 of file popthelp.c.
References poptOption::arg.
| 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 514 of file popthelp.c.
Referenced by poptPrintHelp().
| static size_t maxColumnWidth | ( | FILE * | fp | ) | [static] |
Return no.
of columns in output window.
| fp | FILE |
Definition at line 121 of file popthelp.c.
Referenced by poptPrintHelp().
| void poptPrintHelp | ( | poptContext | con, | |
| FILE * | fp, | |||
| int | flags | |||
| ) |
Print detailed description of options.
| con | context | |
| fp | ouput file handle | |
| flags | (unused) |
Definition at line 662 of file popthelp.c.
References columns_s::cur, columns_s::max, maxArgWidth(), maxColumnWidth(), poptContext_s::options, 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 891 of file popthelp.c.
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 930 of file popthelp.c.
| static size_t showHelpIntro | ( | poptContext | con, | |
| FILE * | fp | |||
| ) | [static] |
| con | context | |
| fp | output file handle |
< pay attention to argv[0]
Definition at line 639 of file popthelp.c.
| 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 |
< don't show in help/usage
< arg points to table
Definition at line 852 of file popthelp.c.
| 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 ==> int
< arg ==> long
< arg ==> long long
< arg ==> float
< arg ==> double
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< arg will be saved as string
< no arg
Definition at line 238 of file popthelp.c.
| 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
< EXPERIMENTAL: return (*arg) (argc, argv)
< allow -longoption
< arg may be missing
< show default value in --help
< no arg
< arg should take value val
< arg ==> int
< arg ==> long
< arg ==> long long
< arg ==> float
< arg ==> double
< arg will be saved as string
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< arg may be missing
Definition at line 315 of file popthelp.c.
| 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
Definition at line 690 of file popthelp.c.
References F_ISSET, and poptOption::longName.
| 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 592 of file popthelp.c.
References poptContext_s::aliases, poptContext_s::execs, itemHelp(), poptContext_s::numAliases, and poptContext_s::numExecs.
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 802 of file popthelp.c.
References poptOption::arg, and poptDone_s::opts.
| static size_t stringDisplayWidth | ( | const char * | s | ) | [inline, static] |
Determine number of display characters in a string.
| s | string |
Definition at line 144 of file popthelp.c.
| struct poptOption poptAliasOptions[] |
Initial value:
{
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
}
Definition at line 64 of file popthelp.c.
| struct poptOption poptHelpOptions[] |
Initial value:
{
{ 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 73 of file popthelp.c.
struct poptOption poptHelpOptions2[] [static] |
Initial value:
{
{ 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 },
{ "", '\0', 0, NULL, 0, "Terminate options" , NULL },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
}
Definition at line 84 of file popthelp.c.
| struct poptOption* poptHelpOptionsI18N = poptHelpOptions2 |
Definition at line 106 of file popthelp.c.
1.5.5