Main Page Modules Data Structures File List Data Fields Globals Related Pages

# popt/popthelp.c File Reference

More...

`#include "system.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...

## Typedefs

typedef poptDone_s * | poptDone
| Keep track of option tables already processed. More...

## Functions

void | displayArgs (poptContext con, enum poptCallbackReason foo, struct poptOption *key, const char *arg, void *data)
| Display arguments. More...
const char *const | getTableTranslationDomain (const struct poptOption *table)
const char *const | getArgDescrip (const struct poptOption *opt, const char *translation_domain)
char * | singleOptionDefaultValue (int lineLength, const struct poptOption *opt, const char *translation_domain)
| Display default value for an option. More...
void | singleOptionHelp (FILE *fp, int maxLeftCol, const struct poptOption *opt, const char *translation_domain)
| Display help text for an option. More...
int | maxArgWidth (const struct poptOption *opt, const char *translation_domain)
void | itemHelp (FILE *fp, poptItem items, int nitems, int left, const char *translation_domain)
| Display popt alias and exec help. More...
void | singleTableHelp (poptContext con, FILE *fp, const struct poptOption *table, int left, const char *translation_domain)
| Display help text for a table of options. More...
int | showHelpIntro (poptContext con, FILE *fp)
void | poptPrintHelp (poptContext con, FILE *fp, int flags)
int | singleOptionUsage (FILE *fp, int cursor, const struct poptOption *opt, const char *translation_domain)
int | itemUsage (FILE *fp, int cursor, poptItem item, int nitems, const char *translation_domain)
| Display popt alias and exec usage. More...
int | singleTableUsage (poptContext con, FILE *fp, int cursor, const struct poptOption *opt, const char *translation_domain, poptDone done)
| Display usage text for a table of options. More...
int | showShortOptions (const struct poptOption *opt, FILE *fp, char *str)
| Return concatenated short options for display. More...
void | poptPrintUsage (poptContext con, FILE *fp, int flags)
void | poptSetOtherOptionHelp (poptContext con, const char *text)

## Variables

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

## Detailed Description

Definition in file popthelp.c.

## Typedef Documentation

typedef struct poptDone_s * poptDone

| Keep track of option tables already processed.

## Function Documentation

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

Display arguments.

Parameters:

  con | context
  foo | (unused)
  key | option(s)
  arg | (unused)
  data | (unused)

Definition at line 23 of file popthelp.c.

References poptPrintHelp, and poptPrintUsage.

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

Parameters:

  opt | option(s)
  translation_domain | translation domain

Definition at line 89 of file popthelp.c.

References 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.

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

Parameters:

  table | option(s)

Definition at line 71 of file popthelp.c.

References POPT_ARG_INTL_DOMAIN, and table.

Referenced by singleTableHelp.

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
  left |
  translation_domain | translation domain

Definition at line 411 of file popthelp.c.

References singleOptionHelp.

Referenced by singleTableHelp.

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
  cursor |
  item | alias/exec array
  nitems | no. of ara/exec entries
  translation_domain | translation domain

Definition at line 582 of file popthelp.c.

References POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, and singleOptionUsage.

Referenced by poptPrintUsage.

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

Parameters:

  opt | option(s)
  translation_domain | translation domain

Definition at line 366 of file popthelp.c.

References getArgDescrip, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and POPT_ARGFLAG_ONEDASH.

Referenced by poptPrintHelp.

void poptPrintHelp | ( | poptContext | con,
|  | FILE * | fp,
|  | int | flags
| ) |

| Definition at line 502 of file popthelp.c. References maxArgWidth, POPT_, showHelpIntro, and singleTableHelp. Referenced by displayArgs, and printUsage.

void poptPrintUsage | ( | poptContext | con,
|  | FILE * | fp,
|  | int | flags
| ) |

| Definition at line 709 of file popthelp.c. References alloca, itemUsage, poptDone_s::maxopts, poptDone_s::nopts, poptDone_s::opts, showHelpIntro, showShortOptions, and singleTableUsage. Referenced by displayArgs, and printUsage.

void poptSetOtherOptionHelp | ( | poptContext | con,
|  | const char * | text
| ) |

| Definition at line 737 of file popthelp.c. References _free, and xstrdup.

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

Parameters:

  con | context
  fp | output file handle

Definition at line 479 of file popthelp.c.

References POPT_.

Referenced by poptPrintHelp, and poptPrintUsage.

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

Return concatenated short options for display.

Todo:
  Sub-tables should be recursed.

Parameters:

  opt | option(s)
  fp | output file handle

Return values:

  str | concatenation of short options

Returns:
  length of display string

Definition at line 676 of file popthelp.c.

References alloca, POPT_ARG_INCLUDE_TABLE, and POPT_ARG_MASK.

Referenced by poptPrintUsage.

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

Display default value for an option.

Parameters:

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

Returns:

Definition at line 126 of file popthelp.c.

References _free, 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.

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

Display help text for an option.

Parameters:

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

Definition at line 197 of file popthelp.c.

References _free, D_, getArgDescrip, 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_ONEDASH, and singleOptionDefaultValue.

Referenced by itemHelp, and singleTableHelp.

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

Parameters:

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

Definition at line 522 of file popthelp.c.

References getArgDescrip, and POPT_ARGFLAG_ONEDASH.

Referenced by itemUsage, and singleTableUsage.

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

Display help text for a table of options.

Parameters:

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

Definition at line 438 of file popthelp.c.

References D_, getTableTranslationDomain, itemHelp, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, poptAliasOptions, singleOptionHelp, and table.

Referenced by poptPrintHelp.

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

Display usage text for a table of options.

Parameters:

  con | context
  fp | output file handle
  cursor |
  opt | option(s)
  translation_domain | translation domain
  done | tables already processed

Returns:

Definition at line 625 of file popthelp.c.

References POPT_ARG_INCLUDE_TABLE, POPT_ARG_INTL_DOMAIN, POPT_ARG_MASK, and singleOptionUsage.

Referenced by poptPrintUsage.

## Variable Documentation

struct poptOption poptAliasOptions[]

Initial value:

     {
        POPT_TABLEEND
    }

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

Definition at line 46 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
    }

Auto help table options.

Definition at line 55 of file popthelp.c.

Referenced by getArgDescrip.