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

popt/popt.h File Reference

More...

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  poptOption
struct  poptAlias
struct  poptItem_s

Arg type identifiers

#define POPT_ARG_NONE   0 /*!< no arg */
#define POPT_ARG_STRING   1 /*!< arg will be saved as string */
#define POPT_ARG_INT   2 /*!< arg will be converted to int */
#define POPT_ARG_LONG   3 /*!< arg will be converted to long */
#define POPT_ARG_INCLUDE_TABLE   4 /*!< arg points to table */
#define POPT_ARG_CALLBACK
#define POPT_ARG_INTL_DOMAIN
#define POPT_ARG_VAL   7 /*!< arg should take value val */
#define POPT_ARG_FLOAT   8 /*!< arg will be converted to float */
#define POPT_ARG_DOUBLE   9 /*!< arg will be converted to double */
#define POPT_ARG_MASK   0x0000FFFF

Arg modifiers

#define POPT_ARGFLAG_ONEDASH   0x80000000 /*!< allow -longoption */
#define POPT_ARGFLAG_DOC_HIDDEN   0x40000000 /*!< don't show in help/usage */
#define POPT_ARGFLAG_STRIP   0x20000000 /*!< strip this arg from argv(only applies to long args) */
#define POPT_ARGFLAG_OPTIONAL   0x10000000 /*!< arg may be missing */
#define POPT_ARGFLAG_OR   0x08000000 /*!< arg will be or'ed */
#define POPT_ARGFLAG_NOR   0x09000000 /*!< arg will be nor'ed */
#define POPT_ARGFLAG_AND   0x04000000 /*!< arg will be and'ed */
#define POPT_ARGFLAG_NAND   0x05000000 /*!< arg will be nand'ed */
#define POPT_ARGFLAG_XOR   0x02000000 /*!< arg will be xor'ed */
#define POPT_ARGFLAG_NOT   0x01000000 /*!< arg will be negated */
#define POPT_ARGFLAG_LOGICALOPS   (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR)
#define POPT_BIT_SET   (POPT_ARG_VAL|POPT_ARGFLAG_OR)
#define POPT_BIT_CLR   (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
#define POPT_ARGFLAG_SHOW_DEFAULT   0x00800000 /*!< show default value in --help */

Callback modifiers

#define POPT_CBFLAG_PRE   0x80000000 /*!< call the callback before parse */
#define POPT_CBFLAG_POST   0x40000000 /*!< call the callback after parse */
#define POPT_CBFLAG_INC_DATA
#define POPT_CBFLAG_SKIPOPTION   0x10000000 /*!< don't callback with option */
#define POPT_CBFLAG_CONTINUE   0x08000000 /*!< continue callbacks with option */

Error return values

#define POPT_ERROR_NOARG   -10 /*!< missing argument */
#define POPT_ERROR_BADOPT   -11 /*!< unknown option */
#define POPT_ERROR_OPTSTOODEEP   -13 /*!< aliases nested too deeply */
#define POPT_ERROR_BADQUOTE   -15 /*!< error in paramter quoting */
#define POPT_ERROR_ERRNO   -16 /*!< errno set, use strerror(errno) */
#define POPT_ERROR_BADNUMBER   -17 /*!< invalid numeric value */
#define POPT_ERROR_OVERFLOW   -18 /*!< number too large or too small */
#define POPT_ERROR_BADOPERATION   -19 /*!< mutually exclusive logical operations requested */
#define POPT_ERROR_NULLARG   -20 /*!< opt->arg should not be NULL */
#define POPT_ERROR_MALLOC   -21 /*!< memory allocation failed */

poptBadOption() flags

#define POPT_BADOPTION_NOALIAS   (1 << 0) /*!< don't go into an alias */

poptGetContext() flags

#define POPT_CONTEXT_NO_EXEC   (1 << 0) /*!< ignore exec expansions */
#define POPT_CONTEXT_KEEP_FIRST   (1 << 1) /*!< pay attention to argv[0] */
#define POPT_CONTEXT_POSIXMEHARDER   (1 << 2) /*!< options can't follow args */
#define POPT_CONTEXT_ARG_OPTS   (1 << 4) /*!< return args as options with value 0 */

Auto-generated help/usage

#define POPT_AUTOALIAS
#define POPT_AUTOHELP
#define POPT_TABLEEND   { NULL, '\0', 0, 0, 0, NULL, NULL }
poptOption poptAliasOptions []
 Empty table marker to enable displaying popt alias/exec options.

poptOption poptHelpOptions []
 Auto help table options.

poptOptionpoptHelpOptionsI18N

Defines

#define POPT_OPTION_DEPTH   10

Typedefs

typedef poptItem_spoptItem
typedef poptContext_spoptContext
typedef poptOptionpoptOption
typedef void(* poptCallbackType )(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data)

Enumerations

enum  poptCallbackReason { POPT_CALLBACK_REASON_PRE = 0, POPT_CALLBACK_REASON_POST = 1, POPT_CALLBACK_REASON_OPTION = 2 }

Functions

poptContext poptGetContext (const char *name, int argc, const char **argv, const struct poptOption *options, int flags)
void poptResetContext (poptContext con)
int poptGetNextOpt (poptContext con)
const char * poptGetOptArg (poptContext con)
const char * poptGetArg (poptContext con)
const char * poptPeekArg (poptContext con)
const char ** poptGetArgs (poptContext con)
const char * poptBadOption (poptContext con, int flags)
poptContext poptFreeContext (poptContext con)
int poptStuffArgs (poptContext con, const char **argv)
int poptAddAlias (poptContext con, struct poptAlias alias, int flags)
int poptAddItem (poptContext con, poptItem newItem, int flags)
int poptReadConfigFile (poptContext con, const char *fn)
int poptReadDefaultConfig (poptContext con, int useEnv)
int poptDupArgv (int argc, const char **argv, int *argcPtr, const char ***argvPtr)
int poptParseArgvString (const char *s, int *argcPtr, const char ***argvPtr)
int poptConfigFileToString (FILE *fp, char **argstrp, int flags)
const char *const  poptStrerror (const int error)
void poptSetExecPath (poptContext con, const char *path, int allowAbsolute)
void poptPrintHelp (poptContext con, FILE *fp, int flags)
void poptPrintUsage (poptContext con, FILE *fp, int flags)
void poptSetOtherOptionHelp (poptContext con, const char *text)
const char * poptGetInvocationName (poptContext con)
int poptStrippedArgv (poptContext con, int argc, char **argv)
int poptSaveLong (long *arg, int argInfo, long aLong)
 Save a long, performing logical operation with value.

int poptSaveInt (int *arg, int argInfo, long aLong)
 Save an integer, performing logical operation with value.


Detailed Description

Definition in file popt.h.


Define Documentation

#define POPT_AUTOALIAS
 

Value:

{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \
                        0, "Options implemented via popt alias/exec:", NULL },

Definition at line 205 of file popt.h.

#define POPT_AUTOHELP
 

Value:

{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
                        0, "Help options:", NULL },

Definition at line 221 of file popt.h.

#define POPT_OPTION_DEPTH   10
 

Definition at line 14 of file popt.h.

Referenced by handleAlias(), and poptStuffArgs().

#define POPT_TABLEEND   { NULL, '\0', 0, 0, 0, NULL, NULL }
 

Definition at line 224 of file popt.h.


Enumeration Type Documentation

enum poptCallbackReason
 

Enumeration values:
POPT_CALLBACK_REASON_PRE 
POPT_CALLBACK_REASON_POST 
POPT_CALLBACK_REASON_OPTION 

Definition at line 242 of file popt.h.


Function Documentation

int poptSaveInt int *  arg,
int  argInfo,
long  aLong
 

Save an integer, performing logical operation with value.

Warning:
Alignment check may be too strict on certain platorms.
Parameters:
arg integer pointer, aligned on int boundary.
argInfo logical operation (see POPT_ARGFLAG_*)
aLong value to use
Returns:
0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION

Definition at line 676 of file popt.c.

References POPT_ARGFLAG_AND, POPT_ARGFLAG_LOGICALOPS, POPT_ARGFLAG_NOT, POPT_ARGFLAG_OR, POPT_ARGFLAG_XOR, POPT_ERROR_BADOPERATION, and POPT_ERROR_NULLARG.

Referenced by db3New(), and poptGetNextOpt().

int poptSaveLong long *  arg,
int  argInfo,
long  aLong
 

Save a long, performing logical operation with value.

Warning:
Alignment check may be too strict on certain platorms.
Parameters:
arg integer pointer, aligned on int boundary.
argInfo logical operation (see POPT_ARGFLAG_*)
aLong value to use
Returns:
0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION

Definition at line 648 of file popt.c.

References POPT_ARGFLAG_AND, POPT_ARGFLAG_LOGICALOPS, POPT_ARGFLAG_NOT, POPT_ARGFLAG_OR, POPT_ARGFLAG_XOR, POPT_ERROR_BADOPERATION, and POPT_ERROR_NULLARG.

Referenced by db3New(), and poptGetNextOpt().


Variable Documentation

struct poptOption poptHelpOptions[]
 

Auto help table options.

Definition at line 213 of file popt.h.

Referenced by findOption(), getArgDescrip(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().

struct poptOption* poptHelpOptionsI18N
 

Definition at line 218 of file popt.h.

Referenced by findOption(), invokeCallbacksOPTION(), invokeCallbacksPOST(), and invokeCallbacksPRE().


Generated on Tue Dec 28 15:17:17 2004 for rpm by doxygen 1.3.6