#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | poptOption |
struct | poptAlias |
A popt alias argument for poptAddAlias(). More... | |
struct | poptItem_s |
A popt alias or exec argument for poptAddItem(). More... | |
Auto-generated help/usage | |
#define | POPT_AUTOALIAS |
#define | POPT_AUTOHELP |
#define | POPT_TABLEEND { NULL, '\0', 0, NULL, 0, NULL, NULL } |
struct poptOption | poptAliasOptions [] |
Empty table marker to enable displaying popt alias/exec options. | |
struct poptOption | poptHelpOptions [] |
Auto help table options. | |
struct poptOption * | poptHelpOptionsI18N |
Defines | |
#define | POPT_OPTION_DEPTH 10 |
Arg type identifiers | |
#define | POPT_ARG_NONE 0 |
#define | POPT_ARG_STRING 1 |
#define | POPT_ARG_INT 2 |
#define | POPT_ARG_LONG 3 |
#define | POPT_ARG_INCLUDE_TABLE 4 |
#define | POPT_ARG_CALLBACK 5 |
#define | POPT_ARG_INTL_DOMAIN 6 |
#define | POPT_ARG_VAL 7 |
#define | POPT_ARG_FLOAT 8 |
#define | POPT_ARG_DOUBLE 9 |
#define | POPT_ARG_MASK 0x0000FFFF |
Arg modifiers | |
#define | POPT_ARGFLAG_ONEDASH 0x80000000 |
#define | POPT_ARGFLAG_DOC_HIDDEN 0x40000000 |
#define | POPT_ARGFLAG_STRIP 0x20000000 |
#define | POPT_ARGFLAG_OPTIONAL 0x10000000 |
#define | POPT_ARGFLAG_OR 0x08000000 |
#define | POPT_ARGFLAG_NOR 0x09000000 |
#define | POPT_ARGFLAG_AND 0x04000000 |
#define | POPT_ARGFLAG_NAND 0x05000000 |
#define | POPT_ARGFLAG_XOR 0x02000000 |
#define | POPT_ARGFLAG_NOT 0x01000000 |
#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 |
Callback modifiers | |
#define | POPT_CBFLAG_PRE 0x80000000 |
#define | POPT_CBFLAG_POST 0x40000000 |
#define | POPT_CBFLAG_INC_DATA 0x20000000 |
#define | POPT_CBFLAG_SKIPOPTION 0x10000000 |
#define | POPT_CBFLAG_CONTINUE 0x08000000 |
Error return values | |
#define | POPT_ERROR_NOARG -10 |
#define | POPT_ERROR_BADOPT -11 |
#define | POPT_ERROR_OPTSTOODEEP -13 |
#define | POPT_ERROR_BADQUOTE -15 |
#define | POPT_ERROR_ERRNO -16 |
#define | POPT_ERROR_BADNUMBER -17 |
#define | POPT_ERROR_OVERFLOW -18 |
#define | POPT_ERROR_BADOPERATION -19 |
#define | POPT_ERROR_NULLARG -20 |
#define | POPT_ERROR_MALLOC -21 |
poptBadOption() flags | |
#define | POPT_BADOPTION_NOALIAS (1 << 0) |
poptGetContext() flags | |
#define | POPT_CONTEXT_NO_EXEC (1 << 0) |
#define | POPT_CONTEXT_KEEP_FIRST (1 << 1) |
#define | POPT_CONTEXT_POSIXMEHARDER (1 << 2) |
#define | POPT_CONTEXT_ARG_OPTS (1 << 4) |
Typedefs | |
typedef struct poptItem_s * | poptItem |
typedef struct poptContext_s * | poptContext |
typedef struct poptOption * | poptOption |
typedef void(* | poptCallbackType )(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data) |
Table callback prototype. | |
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) |
Initialize popt context. | |
void | poptResetContext (poptContext con) |
Reinitialize popt context. | |
int | poptGetNextOpt (poptContext con) |
Return value of next option found. | |
const char * | poptGetOptArg (poptContext con) |
Return next option argument (if any). | |
const char * | poptGetArg (poptContext con) |
Return next argument. | |
const char * | poptPeekArg (poptContext con) |
Peek at current argument. | |
const char ** | poptGetArgs (poptContext con) |
Return remaining arguments. | |
const char * | poptBadOption (poptContext con, int flags) |
Return the option which caused the most recent error. | |
poptContext | poptFreeContext (poptContext con) |
Destroy context. | |
int | poptStuffArgs (poptContext con, const char **argv) |
Add arguments to context. | |
int | poptAddAlias (poptContext con, struct poptAlias alias, int flags) |
Add alias to context. | |
int | poptAddItem (poptContext con, poptItem newItem, int flags) |
Add alias/exec item to context. | |
int | poptReadConfigFile (poptContext con, const char *fn) |
Read configuration file. | |
int | poptReadDefaultConfig (poptContext con, int useEnv) |
Read default configuration from /etc/popt and $HOME/.popt. | |
int | poptDupArgv (int argc, const char **argv, int *argcPtr, const char ***argvPtr) |
Duplicate an argument array. | |
int | poptParseArgvString (const char *s, int *argcPtr, const char ***argvPtr) |
Parse a string into an argument array. | |
int | poptConfigFileToString (FILE *fp, char **argstrp, int flags) |
Parses an input configuration file and returns an string that is a command line. | |
const char *const | poptStrerror (const int error) |
Return formatted error string for popt failure. | |
void | poptSetExecPath (poptContext con, const char *path, int allowAbsolute) |
Limit search for executables. | |
void | poptPrintHelp (poptContext con, FILE *fp, int flags) |
Print detailed description of options. | |
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. | |
const char * | poptGetInvocationName (poptContext con) |
Return argv[0] from context. | |
int | poptStrippedArgv (poptContext con, int argc, char **argv) |
Shuffle argv pointers to remove stripped args, returns new argc. | |
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. |
Definition in file popt.h.
#define POPT_ARG_CALLBACK 5 |
table-wide callback... must be set first in table; arg points to callback, descrip points to callback data to pass
Definition at line 25 of file popt.h.
Referenced by findOption().
#define POPT_ARG_DOUBLE 9 |
arg will be converted to double
Definition at line 35 of file popt.h.
Referenced by getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_FLOAT 8 |
arg will be converted to float
Definition at line 34 of file popt.h.
Referenced by getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_INCLUDE_TABLE 4 |
#define POPT_ARG_INT 2 |
arg will be converted to int
Definition at line 22 of file popt.h.
Referenced by db3New(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_INTL_DOMAIN 6 |
set the translation domain for this table and any included tables; arg points to the domain string
Definition at line 29 of file popt.h.
Referenced by getTableTranslationDomain().
#define POPT_ARG_LONG 3 |
arg will be converted to long
Definition at line 23 of file popt.h.
Referenced by db3New(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_MASK 0x0000FFFF |
Definition at line 37 of file popt.h.
Referenced by db3New(), findOption(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_NONE 0 |
no arg
Definition at line 20 of file popt.h.
Referenced by db3New(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_STRING 1 |
arg will be saved as string
Definition at line 21 of file popt.h.
Referenced by configLine(), db3New(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARG_VAL 7 |
arg should take value val
Definition at line 33 of file popt.h.
Referenced by db3New(), getArgDescrip(), poptGetNextOpt(), and singleOptionDefaultValue().
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 |
#define POPT_ARGFLAG_LOGICALOPS (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) |
#define POPT_ARGFLAG_ONEDASH 0x80000000 |
allow -longoption
Definition at line 44 of file popt.h.
Referenced by findOption(), and poptGetNextOpt().
#define POPT_ARGFLAG_OPTIONAL 0x10000000 |
#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000 |
#define POPT_ARGFLAG_STRIP 0x20000000 |
strip this arg from argv(only applies to long args)
Definition at line 46 of file popt.h.
Referenced by poptGetNextOpt().
#define POPT_AUTOALIAS |
Value:
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \ 0, "Options implemented via popt alias/exec:", NULL },
#define POPT_AUTOHELP |
Value:
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \ 0, "Help options:", NULL },
#define POPT_BADOPTION_NOALIAS (1 << 0) |
don't go into an alias
Definition at line 99 of file popt.h.
Referenced by doSetupMacro(), main(), parseDescription(), parseFiles(), parseScript(), poptBadOption(), and rpmcliInit().
#define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) |
#define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) |
#define POPT_CBFLAG_CONTINUE 0x08000000 |
#define POPT_CBFLAG_INC_DATA 0x20000000 |
use data from the include line, not the subtable
Definition at line 73 of file popt.h.
Referenced by findOption().
#define POPT_CBFLAG_POST 0x40000000 |
#define POPT_CBFLAG_PRE 0x80000000 |
#define POPT_CBFLAG_SKIPOPTION 0x10000000 |
#define POPT_CONTEXT_ARG_OPTS (1 << 4) |
return args as options with value 0
Definition at line 109 of file popt.h.
Referenced by poptGetNextOpt().
#define POPT_CONTEXT_KEEP_FIRST (1 << 1) |
#define POPT_CONTEXT_NO_EXEC (1 << 0) |
#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) |
#define POPT_ERROR_BADNUMBER -17 |
#define POPT_ERROR_BADOPERATION -19 |
mutually exclusive logical operations requested
Definition at line 90 of file popt.h.
Referenced by poptGetNextOpt().
#define POPT_ERROR_BADOPT -11 |
#define POPT_ERROR_ERRNO -16 |
errno set, use strerror(errno)
Definition at line 87 of file popt.h.
Referenced by execCommand(), and poptReadConfigFile().
#define POPT_ERROR_NULLARG -20 |
opt->arg should not be NULL
Definition at line 91 of file popt.h.
Referenced by poptConfigFileToString().
#define POPT_ERROR_OPTSTOODEEP -13 |
#define POPT_ERROR_OVERFLOW -18 |
number too large or too small
Definition at line 89 of file popt.h.
Referenced by poptConfigFileToString(), and poptGetNextOpt().
#define POPT_OPTION_DEPTH 10 |
enum poptCallbackReason |
int poptSaveInt | ( | int * | arg, | |
int | argInfo, | |||
long | aLong | |||
) |
Save an integer, performing logical operation with value.
arg | integer pointer, aligned on int boundary. | |
argInfo | logical operation (see POPT_ARGFLAG_*) | |
aLong | value to use |
Definition at line 674 of file popt.c.
Referenced by db3New(), and poptGetNextOpt().
int poptSaveLong | ( | long * | arg, | |
int | argInfo, | |||
long | aLong | |||
) |
Save a long, performing logical operation with value.
arg | integer pointer, aligned on int boundary. | |
argInfo | logical operation (see POPT_ARGFLAG_*) | |
aLong | value to use |
Definition at line 646 of file popt.c.
Referenced by db3New(), and poptGetNextOpt().
struct poptOption poptAliasOptions[] |
Empty table marker to enable displaying popt alias/exec options.
Definition at line 52 of file popthelp.c.
struct poptOption poptHelpOptions[] |
struct poptOption* poptHelpOptionsI18N |