14 #define POPT_OPTION_DEPTH 10 20 #define POPT_ARG_NONE 0U 21 #define POPT_ARG_STRING 1U 22 #define POPT_ARG_INT 2U 23 #define POPT_ARG_LONG 3U 24 #define POPT_ARG_INCLUDE_TABLE 4U 25 #define POPT_ARG_CALLBACK 5U 29 #define POPT_ARG_INTL_DOMAIN 6U 33 #define POPT_ARG_VAL 7U 34 #define POPT_ARG_FLOAT 8U 35 #define POPT_ARG_DOUBLE 9U 36 #define POPT_ARG_LONGLONG 10U 38 #define POPT_ARG_MAINCALL 16U+11U 39 #define POPT_ARG_ARGV 12U 40 #define POPT_ARG_SHORT 13U 41 #define POPT_ARG_BITSET 16U+14U 43 #define POPT_ARG_MASK 0x000000FFU 44 #define POPT_GROUP_MASK 0x0000FF00U 52 #define POPT_ARGFLAG_ONEDASH 0x80000000U 53 #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000U 54 #define POPT_ARGFLAG_STRIP 0x20000000U 55 #define POPT_ARGFLAG_OPTIONAL 0x10000000U 57 #define POPT_ARGFLAG_OR 0x08000000U 58 #define POPT_ARGFLAG_NOR 0x09000000U 59 #define POPT_ARGFLAG_AND 0x04000000U 60 #define POPT_ARGFLAG_NAND 0x05000000U 61 #define POPT_ARGFLAG_XOR 0x02000000U 62 #define POPT_ARGFLAG_NOT 0x01000000U 63 #define POPT_ARGFLAG_LOGICALOPS \ 64 (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) 66 #define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) 68 #define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) 71 #define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000U 72 #define POPT_ARGFLAG_RANDOM 0x00400000U 73 #define POPT_ARGFLAG_TOGGLE 0x00200000U 81 #define POPT_CBFLAG_PRE 0x80000000U 82 #define POPT_CBFLAG_POST 0x40000000U 83 #define POPT_CBFLAG_INC_DATA 0x20000000U 85 #define POPT_CBFLAG_SKIPOPTION 0x10000000U 86 #define POPT_CBFLAG_CONTINUE 0x08000000U 93 #define POPT_ERROR_NOARG -10 94 #define POPT_ERROR_BADOPT -11 95 #define POPT_ERROR_OPTSTOODEEP -13 96 #define POPT_ERROR_BADQUOTE -15 97 #define POPT_ERROR_ERRNO -16 98 #define POPT_ERROR_BADNUMBER -17 99 #define POPT_ERROR_OVERFLOW -18 100 #define POPT_ERROR_BADOPERATION -19 101 #define POPT_ERROR_NULLARG -20 102 #define POPT_ERROR_MALLOC -21 103 #define POPT_ERROR_BADCONFIG -22 110 #define POPT_BADOPTION_NOALIAS (1U << 0) 117 #define POPT_CONTEXT_NO_EXEC (1U << 0) 118 #define POPT_CONTEXT_KEEP_FIRST (1U << 1) 119 #define POPT_CONTEXT_POSIXMEHARDER (1U << 2) 120 #define POPT_CONTEXT_ARG_OPTS (1U << 4) 175 #define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \ 176 0, "Options implemented via popt alias/exec:", NULL }, 191 #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \ 192 0, "Help options:", NULL }, 194 #define POPT_TABLEEND { NULL, '\0', 0, NULL, 0, NULL, NULL } 236 const struct poptOption * opt,
263 int argc,
const char ** argv,
264 const struct poptOption * options,
275 poptContext
poptFini( poptContext con)
288 poptContext
poptInit(
int argc,
const char ** argv,
289 const struct poptOption * options,
290 const char * configPaths)
354 const char *
poptBadOption(poptContext con,
unsigned int flags)
408 size_t * nbp,
int flags)
411 #define POPT_READFILE_TRIMNEWLINES 1 463 const char *** argvPtr)
478 int * argcPtr,
const char *** argvPtr)
549 void poptSetExecPath(poptContext con,
const char * path,
int allowAbsolute)
685 unsigned int bits[1];
689 #define _POPT_BITS_N 1024U 690 #define _POPT_BITS_M ((3U * _POPT_BITS_N) / 2U) 691 #define _POPT_BITS_K 16U const char * poptStrerror(const int error)
Return formatted error string for popt failure.
int poptParseArgvString(const char *s, int *argcPtr, const char ***argvPtr)
Parse a string into an argument array.
char * poptGetOptArg(poptContext con)
Return next option argument (if any).
struct poptContext_s * poptContext
A popt alias argument for poptAddAlias().
int poptBitsAdd(poptBits bits, const char *s)
void poptPrintUsage(poptContext con, FILE *fp, int flags)
Print terse description of options.
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 poptSaveShort(short *arg, unsigned int argInfo, long aLong)
Save a short integer, performing logical operation with value.
int poptGetNextOpt(poptContext con)
Return value of next option found.
struct poptItem_s * poptItem
A popt alias or exec argument for poptAddItem().
int poptSaneFile(const char *fn)
Perform sanity checks on a file path.
struct poptBits_s * poptBits
int poptBitsClr(poptBits bits)
int poptSaveLongLong(long long *arg, unsigned int argInfo, long long aLongLong)
Save a long long, performing logical operation with value.
A popt alias or exec argument for poptAddItem().
const char * poptGetArg(poptContext con)
Return next argument.
int poptStuffArgs(poptContext con, const char **argv)
Add arguments to context.
poptContext poptInit(int argc, const char **argv, const struct poptOption *options, const char *configPaths)
Initialize popt context (alternative implementation).
void poptSetOtherOptionHelp(poptContext con, const char *text)
Provide text to replace default "[OPTION...]" in help/usage output.
const char ** poptGetArgs(poptContext con)
Return remaining arguments.
int poptConfigFileToString(FILE *fp, char **argstrp, int flags)
Parses an input configuration file and returns an string that is a command line.
int poptBitsChk(poptBits bits, const char *s)
int poptStrippedArgv(poptContext con, int argc, char **argv)
Shuffle argv pointers to remove stripped args, returns new argc.
int poptAddItem(poptContext con, poptItem newItem, int flags)
Add alias/exec item to context.
int poptBitsUnion(poptBits *ap, const poptBits b)
int poptSaveLong(long *arg, unsigned int argInfo, long aLong)
Save a long, performing logical operation with value.
int poptSaveString(const char ***argvp, unsigned int argInfo, const char *val)
Add a string to an argv array.
int poptDupArgv(int argc, const char **argv, int *argcPtr, const char ***argvPtr)
Duplicate an argument array.
int poptBitsDel(poptBits bits, const char *s)
poptContext poptFreeContext(poptContext con)
Destroy context.
void poptPrintHelp(poptContext con, FILE *fp, int flags)
Print detailed description of options.
struct poptOption * poptHelpOptionsI18N
void poptResetContext(poptContext con)
Reinitialize popt context.
void(* poptCallbackType)(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data)
Table callback prototype.
int poptBitsArgs(poptContext con, poptBits *ap)
const char * poptPeekArg(poptContext con)
Peek at current argument.
const char * poptBadOption(poptContext con, unsigned int flags)
Return the option which caused the most recent error.
poptContext poptGetContext(const char *name, int argc, const char **argv, const struct poptOption *options, unsigned int flags)
Initialize popt context.
void poptSetExecPath(poptContext con, const char *path, int allowAbsolute)
Limit search for executables.
const char * poptGetInvocationName(poptContext con)
Return argv[0] from context.
struct poptOption * poptOption
int poptBitsIntersect(poptBits *ap, const poptBits b)
int poptSaveInt(int *arg, unsigned int argInfo, long aLong)
Save an integer, performing logical operation with value.
poptContext poptFini(poptContext con)
Destroy context (alternative implementation).
struct poptOption poptHelpOptions[]
Auto help table options.
int poptReadConfigFiles(poptContext con, const char *paths)
Read configuration file(s).
struct poptOption poptAliasOptions[]
Empty table marker to enable displaying popt alias/exec options.
int poptSaveBits(poptBits *bitsp, unsigned int argInfo, const char *s)
Save a string into a bit set (experimental).
int poptAddAlias(poptContext con, struct poptAlias alias, int flags)
Add alias to context.
int poptReadFile(const char *fn, char **bp, size_t *nbp, int flags)
Read a file into a buffer.