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... | |
Files | |
file | findme.c |
file | findme.h |
file | popt.c |
file | popt.h |
file | poptconfig.c |
file | popthelp.c |
file | poptint.h |
file | poptparse.c |
Typedefs | |
typedef struct poptItem_s * | poptItem |
A popt alias or exec argument for poptAddItem(). | |
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. | |
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 current option's argument. | |
const char * | poptPeekArg (poptContext con) |
Peek at current option's 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. | |
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. |
typedef void(* poptCallbackType)(poptContext con, enum poptCallbackReason reason,const struct poptOption *opt,const char *arg,const void *data) |
typedef struct poptContext_s* poptContext |
typedef struct poptItem_s * poptItem |
A popt alias or exec argument for poptAddItem().
typedef struct poptOption* poptOption |
int poptAddAlias | ( | poptContext | con, | |
struct poptAlias | alias, | |||
int | flags | |||
) |
Add alias to context.
con | context | |
alias | alias to add | |
flags | (unused) |
< don't show in help/usage
int poptAddItem | ( | poptContext | con, | |
poptItem | newItem, | |||
int | flags | |||
) |
const char* poptBadOption | ( | poptContext | con, | |
int | flags | |||
) |
int poptDupArgv | ( | int | argc, | |
const char ** | argv, | |||
int * | argcPtr, | |||
const char *** | argvPtr | |||
) |
Duplicate an argument array.
argc | no. of arguments | |
argv | argument array |
argcPtr | address of returned no. of arguments | |
argvPtr | address of returned argument array |
< missing argument
< missing argument
< memory allocation failed
Definition at line 13 of file poptparse.c.
poptContext poptFreeContext | ( | poptContext | con | ) |
const char* poptGetArg | ( | poptContext | con | ) |
const char** poptGetArgs | ( | poptContext | con | ) |
poptContext poptGetContext | ( | const char * | name, | |
int | argc, | |||
const char ** | argv, | |||
const struct poptOption * | options, | |||
int | flags | |||
) |
const char* poptGetInvocationName | ( | poptContext | con | ) |
int poptGetNextOpt | ( | poptContext | con | ) |
Return value of next option found.
con | context |
< unknown option
< options can't follow args
< return args as options with value 0
< unknown option
< unknown option
< strip this arg from argv(only applies to long args)
< unknown option
< unknown option
< no arg
< mutually exclusive logical operations requested
< arg should take value val
< mutually exclusive logical operations requested
< no arg
< arg may be missing
< missing argument
< strip this arg from argv(only applies to long args)
< arg will be saved as string
< arg will be converted to int
< arg will be converted to long
< invalid numeric value
< arg will be converted to long
< number too large or too small
< mutually exclusive logical operations requested
< number too large or too small
< mutually exclusive logical operations requested
< arg will be converted to float
< arg will be converted to double
< number too large or too small
< invalid numeric value
< arg will be converted to double
< number too large or too small
< number too large or too small
< arg should take value val
< allow -longoption
< no arg
< arg should take value val
< no arg
const char* poptGetOptArg | ( | poptContext | con | ) |
int poptParseArgvString | ( | const char * | s, | |
int * | argcPtr, | |||
const char *** | argvPtr | |||
) |
Parse a string into an argument array.
The parse allows ', ", and \ quoting, but ' is treated the same as " and both may include \ quotes.
s | string to parse |
argcPtr | address of returned no. of arguments | |
argvPtr | address of returned argument array |
< memory allocation failed
< error in paramter quoting
< error in paramter quoting
Definition at line 54 of file poptparse.c.
const char* poptPeekArg | ( | poptContext | con | ) |
void poptPrintHelp | ( | poptContext | con, | |
FILE * | fp, | |||
int | flags | |||
) |
Print detailed description of options.
con | context | |
fp | ouput file handle | |
flags | (unused) |
Definition at line 473 of file popthelp.c.
void poptPrintUsage | ( | poptContext | con, | |
FILE * | fp, | |||
int | flags | |||
) |
Print terse description of options.
con | context | |
fp | ouput file handle | |
flags | (unused) |
Definition at line 632 of file popthelp.c.
int poptReadConfigFile | ( | poptContext | con, | |
const char * | fn | |||
) |
Read configuration file.
con | context | |
fn | file name to read |
< errno set, use strerror(errno)
< errno set, use strerror(errno)
< errno set, use strerror(errno)
< errno set, use strerror(errno)
Definition at line 93 of file poptconfig.c.
int poptReadDefaultConfig | ( | poptContext | con, | |
int | useEnv | |||
) |
Read default configuration from /etc/popt and $HOME/.popt.
con | context | |
useEnv | (unused) |
Definition at line 162 of file poptconfig.c.
void poptResetContext | ( | poptContext | con | ) |
void poptSetExecPath | ( | poptContext | con, | |
const char * | path, | |||
int | allowAbsolute | |||
) |
void poptSetOtherOptionHelp | ( | poptContext | con, | |
const char * | text | |||
) |
Provide text to replace default "[OPTION...]" in help/usage output.
con | context | |
text | replacement text |
Definition at line 651 of file popthelp.c.
const char* const poptStrerror | ( | const int | error | ) |
Return formatted error string for popt failure.
error | popt error |
< missing argument
< unknown option
< mutually exclusive logical operations requested
< opt->arg should not be NULL
< aliases nested too deeply
< error in paramter quoting
< invalid numeric value
< number too large or too small
< memory allocation failed
< errno set, use strerror(errno)
int poptStrippedArgv | ( | poptContext | con, | |
int | argc, | |||
char ** | argv | |||
) |
int poptStuffArgs | ( | poptContext | con, | |
const char ** | argv | |||
) |