# popt/popthelp.c File Reference

`#include "system.h"`
`#include "poptint.h"`

Go to the source code of this file.

## Functions

static void | displayArgs (poptContext con, enum poptCallbackReason foo, struct poptOption *key, const char *arg, void *data)
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 (int lineLength, const struct poptOption *opt, const char *translation_domain)
static void | singleOptionHelp (FILE *fp, int maxLeftCol, const struct poptOption *opt, const char *translation_domain)
static int | maxArgWidth (const struct poptOption *opt, const char *translation_domain)
static void | itemHelp (FILE *fp, poptItem items, int nitems, int left, const char *translation_domain)
| Display popt alias and exec help.
static void | singleTableHelp (poptContext con, FILE *fp, const struct poptOption *table, int left, const char *translation_domain)
static int | showHelpIntro (poptContext con, FILE *fp)
void | poptPrintHelp (poptContext con, FILE *fp, int flags)
| Print detailed description of options.
static int | singleOptionUsage (FILE *fp, int cursor, const struct poptOption *opt, const char *translation_domain)
static int | itemUsage (FILE *fp, int cursor, poptItem item, int nitems, const char *translation_domain)
| Display popt alias and exec usage.
static int | singleTableUsage (poptContext con, FILE *fp, int cursor, const struct poptOption *opt, const char *translation_domain)
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

struct poptOption | poptAliasOptions []
| Empty table marker to enable displaying popt alias/exec options.
struct poptOption | poptHelpOptions []
| Auto help table options.

## Detailed Description

Definition in file popthelp.c.

## Function Documentation

static void displayArgs | ( | poptContext | con,
|  | enum poptCallbackReason | foo,
|  | struct poptOption * | key,
|  | const char * | arg,
|  | void * | data |
| ) |  |  | `[static]`

Parameters:

  | con | context
  | key | option(s)

Definition at line 19 of file popthelp.c.

static const char* const getArgDescrip | ( | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | opt | option(s)
  | translation_domain | translation domain

< 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

Definition at line 91 of file popthelp.c.

static const char* const getTableTranslationDomain | ( | const struct poptOption * | table | ) | `[static]`

Parameters:

  | table | option(s)

< set the translation domain for this table and any included tables; arg points to the domain string

Definition at line 70 of file popthelp.c.

static void itemHelp | ( | FILE * | fp,
|  | poptItem | items,
|  | int | nitems,
|  | int | left,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Display popt alias and exec help.

Parameters:

  | fp | output file handle
  | items | alias/exec array
  | nitems | no. of alias/exec entries
  | translation_domain | translation domain

< don't show in help/usage

Definition at line 393 of file popthelp.c.

static int itemUsage | ( | FILE * | fp,
|  | int | cursor,
|  | poptItem | item,
|  | int | nitems,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Display popt alias and exec usage.

Parameters:

  | fp | output file handle
  | 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 546 of file popthelp.c.

static int maxArgWidth | ( | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | 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 349 of file popthelp.c.

static int showHelpIntro | ( | poptContext | con,
|  | FILE * | fp |
| ) |  |  | `[static]`

Parameters:

  | con | context
  | fp | output file handle

< pay attention to argv[0]

Definition at line 458 of file popthelp.c.

static int showShortOptions | ( | const struct poptOption * | opt,
|  | FILE * | fp,
|  | char * | str |
| ) |  |  | `[static]`

Return concatenated short options for display.

Parameters:

  | opt | option(s)
  | fp | output file handle

Return values:

  | str | concatenation of short options

Returns:
  length of display string

< arg points to table

Definition at line 613 of file popthelp.c.

static char* singleOptionDefaultValue | ( | int | lineLength,
|  | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | 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

< arg will be saved as string

< no arg

Definition at line 121 of file popthelp.c.

static void singleOptionHelp | ( | FILE * | fp,
|  | int | maxLeftCol,
|  | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | fp | output file handle
  | opt | option(s)
  | translation_domain | translation domain

< allow -longoption

< allow -longoption

< arg may be missing

< show default value in --help

< no arg

< arg should take value val

< arg will be or'ed

< arg will be and'ed

< arg will be xor'ed

< arg will be negated

< arg will be or'ed

< arg will be and'ed

< arg will be xor'ed

< 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

< arg may be missing

Definition at line 188 of file popthelp.c.

static int singleOptionUsage | ( | FILE * | fp,
|  | int | cursor,
|  | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | fp | output file handle
  | opt | option(s)
  | translation_domain | translation domain

< allow -longoption

Definition at line 498 of file popthelp.c.

static void singleTableHelp | ( | poptContext | con,
|  | FILE * | fp,
|  | const struct poptOption * | table,
|  | int | left,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | fp | output file handle
  | table | option(s)
  | translation_domain | translation domain

< don't show in help/usage

< arg points to table

Definition at line 417 of file popthelp.c.

static int singleTableUsage | ( | poptContext | con,
|  | FILE * | fp,
|  | int | cursor,
|  | const struct poptOption * | opt,
|  | const char * | translation_domain |
| ) |  |  | `[static]`

Parameters:

  | fp | output file handle
  | opt | option(s)
  | translation_domain | translation domain

< 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 578 of file popthelp.c.

## Variable Documentation

struct poptOption poptAliasOptions[]

Initial value:

     {
         { NULL, '\0', 0, 0, 0, NULL, NULL }
    }

Empty table marker to enable displaying popt alias/exec options.

Definition at line 42 of file popthelp.c.

struct poptOption poptHelpOptions[]

Initial value:

     {
      { NULL, '\0',  5  , (void *)&displayArgs, '\0', NULL, NULL },
      { "help", '?', 0, NULL, '?',  "Show this help message" , NULL },
      { "usage", '\0', 0, NULL, 'u',  "Display brief usage message" , NULL },

         { NULL, '\0', 0, 0, 0, NULL, NULL }
    }

Auto help table options.

Definition at line 51 of file popthelp.c.