popt.h | popt.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
included tables; arg points | included tables; arg points | |||
to the domain string */ | to the domain string */ | |||
#define POPT_ARG_VAL 7U /*!< arg should take value val */ | #define POPT_ARG_VAL 7U /*!< arg should take value val */ | |||
#define POPT_ARG_FLOAT 8U /*!< arg ==> float */ | #define POPT_ARG_FLOAT 8U /*!< arg ==> float */ | |||
#define POPT_ARG_DOUBLE 9U /*!< arg ==> double */ | #define POPT_ARG_DOUBLE 9U /*!< arg ==> double */ | |||
#define POPT_ARG_LONGLONG 10U /*!< arg ==> long long */ | #define POPT_ARG_LONGLONG 10U /*!< arg ==> long long */ | |||
#define POPT_ARG_MAINCALL 16U+11U /*!< EXPERIMENTAL: return (*arg) (ar gc, argv) */ | #define POPT_ARG_MAINCALL 16U+11U /*!< EXPERIMENTAL: return (*arg) (ar gc, argv) */ | |||
#define POPT_ARG_ARGV 12U /*!< dupe'd arg appended to realloc'd argv array. */ | #define POPT_ARG_ARGV 12U /*!< dupe'd arg appended to realloc'd argv array. */ | |||
#define POPT_ARG_MASK 0x0000FFFFU | #define POPT_ARG_MASK 0x000000FFU | |||
#define POPT_GROUP_MASK 0x0000FF00U | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Arg modifiers | * \name Arg modifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_ARGFLAG_ONEDASH 0x80000000U /*!< allow -longoption */ | #define POPT_ARGFLAG_ONEDASH 0x80000000U /*!< allow -longoption */ | |||
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000U /*!< don't show in help/usage */ | #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000U /*!< don't show in help/usage */ | |||
#define POPT_ARGFLAG_STRIP 0x20000000U /*!< strip this arg from argv(o nly applies to long args) */ | #define POPT_ARGFLAG_STRIP 0x20000000U /*!< strip this arg from argv(o nly applies to long args) */ | |||
#define POPT_ARGFLAG_OPTIONAL 0x10000000U /*!< arg may be missing */ | #define POPT_ARGFLAG_OPTIONAL 0x10000000U /*!< arg may be missing */ | |||
skipping to change at line 68 | skipping to change at line 70 | |||
#define POPT_ARGFLAG_NOT 0x01000000U /*!< arg will be negate d */ | #define POPT_ARGFLAG_NOT 0x01000000U /*!< arg will be negate d */ | |||
#define POPT_ARGFLAG_LOGICALOPS \ | #define POPT_ARGFLAG_LOGICALOPS \ | |||
(POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) | (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) | |||
#define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) | #define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) | |||
/*!< set arg bit(s) */ | /*!< set arg bit(s) */ | |||
#define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) | #define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) | |||
/*!< clear arg bit(s) */ | /*!< clear arg bit(s) */ | |||
#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000U /*!< show default valu e in --help */ | #define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000U /*!< show default valu e in --help */ | |||
#define POPT_ARGFLAG_RANDOM 0x00400000U /*<! random value in [1 | #define POPT_ARGFLAG_RANDOM 0x00400000U /*!< random value in [1 | |||
,arg] */ | ,arg] */ | |||
#define POPT_ARGFLAG_TOGGLE 0x00200000U /*!< permit --[no]opt p | ||||
refix toggle */ | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Callback modifiers | * \name Callback modifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_CBFLAG_PRE 0x80000000U /*!< call the callback before parse */ | #define POPT_CBFLAG_PRE 0x80000000U /*!< call the callback before parse */ | |||
#define POPT_CBFLAG_POST 0x40000000U /*!< call the callback after pa rse */ | #define POPT_CBFLAG_POST 0x40000000U /*!< call the callback after pa rse */ | |||
#define POPT_CBFLAG_INC_DATA 0x20000000U /*!< use data from the include line, | #define POPT_CBFLAG_INC_DATA 0x20000000U /*!< use data from the include line, | |||
skipping to change at line 98 | skipping to change at line 101 | |||
#define POPT_ERROR_NOARG -10 /*!< missing argument */ | #define POPT_ERROR_NOARG -10 /*!< missing argument */ | |||
#define POPT_ERROR_BADOPT -11 /*!< unknown option */ | #define POPT_ERROR_BADOPT -11 /*!< unknown option */ | |||
#define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */ | #define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */ | |||
#define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */ | #define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */ | |||
#define POPT_ERROR_ERRNO -16 /*!< errno set, use strerror(errno) */ | #define POPT_ERROR_ERRNO -16 /*!< errno set, use strerror(errno) */ | |||
#define POPT_ERROR_BADNUMBER -17 /*!< invalid numeric value */ | #define POPT_ERROR_BADNUMBER -17 /*!< invalid numeric value */ | |||
#define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small * / | #define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small * / | |||
#define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logi cal operations requested */ | #define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logi cal operations requested */ | |||
#define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */ | #define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */ | |||
#define POPT_ERROR_MALLOC -21 /*!< memory allocation faile d */ | #define POPT_ERROR_MALLOC -21 /*!< memory allocation faile d */ | |||
#define POPT_ERROR_BADCONFIG -22 /*!< config file failed sani ty test */ | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name poptBadOption() flags | * \name poptBadOption() flags | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_BADOPTION_NOALIAS (1U << 0) /*!< don't go into an alias */ | #define POPT_BADOPTION_NOALIAS (1U << 0) /*!< don't go into an alias */ | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
skipping to change at line 237 | skipping to change at line 241 | |||
*/ | */ | |||
typedef void (*poptCallbackType) (poptContext con, | typedef void (*poptCallbackType) (poptContext con, | |||
enum poptCallbackReason reason, | enum poptCallbackReason reason, | |||
/*@null@*/ const struct poptOption * opt, | /*@null@*/ const struct poptOption * opt, | |||
/*@null@*/ const char * arg, | /*@null@*/ const char * arg, | |||
/*@null@*/ const void * data) | /*@null@*/ const void * data) | |||
/*@globals internalState @*/ | /*@globals internalState @*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Destroy context. | ||||
* @param con context | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ | ||||
poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con) | ||||
/*@modifies con @*/; | ||||
/** \ingroup popt | ||||
* Initialize popt context. | * Initialize popt context. | |||
* @param name context name (usually argv[0] program name) | * @param name context name (usually argv[0] program name) | |||
* @param argc no. of arguments | * @param argc no. of arguments | |||
* @param argv argument array | * @param argv argument array | |||
* @param options address of popt option table | * @param options address of popt option table | |||
* @param flags or'd POPT_CONTEXT_* bits | * @param flags or'd POPT_CONTEXT_* bits | |||
* @return initialized popt context | * @return initialized popt context | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
poptContext poptGetContext( | poptContext poptGetContext( | |||
/*@dependent@*/ /*@keep@*/ const char * name, | /*@dependent@*/ /*@keep@*/ const char * name, | |||
int argc, /*@dependent@*/ /*@keep@*/ const char ** argv, | int argc, /*@dependent@*/ /*@keep@*/ const char ** argv, | |||
/*@dependent@*/ /*@keep@*/ const struct poptOption * options , | /*@dependent@*/ /*@keep@*/ const struct poptOption * options , | |||
unsigned int flags) | unsigned int flags) | |||
/*@globals internalState @*/ | /*@globals internalState @*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Destroy context (alternative implementation). | ||||
* @param con context | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ | ||||
poptContext poptFini( /*@only@*/ /*@null@*/ poptContext con) | ||||
/*@modifies con @*/; | ||||
/** \ingroup popt | ||||
* Initialize popt context (alternative implementation). | ||||
* This routine does poptGetContext() and then poptReadConfigFiles(). | ||||
* @param argc no. of arguments | ||||
* @param argv argument array | ||||
* @param options address of popt option table | ||||
* @param configPaths colon separated file path(s) to read. | ||||
* @return initialized popt context (NULL on error). | ||||
*/ | ||||
/*@only@*/ /*@null@*/ /*@unused@*/ | ||||
poptContext poptInit(int argc, /*@dependent@*/ /*@keep@*/ const char ** arg | ||||
v, | ||||
/*@dependent@*/ /*@keep@*/ const struct poptOption * options | ||||
, | ||||
/*@null@*/ const char * configPaths) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** \ingroup popt | ||||
* Reinitialize popt context. | * Reinitialize popt context. | |||
* @param con context | * @param con context | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
void poptResetContext(/*@null@*/poptContext con) | void poptResetContext(/*@null@*/poptContext con) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Return value of next option found. | * Return value of next option found. | |||
* @param con context | * @param con context | |||
skipping to change at line 318 | skipping to change at line 356 | |||
* Return the option which caused the most recent error. | * Return the option which caused the most recent error. | |||
* @param con context | * @param con context | |||
* @param flags | * @param flags | |||
* @return offending option | * @return offending option | |||
*/ | */ | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * poptBadOption(/*@null@*/poptContext con, unsigned int flags) | const char * poptBadOption(/*@null@*/poptContext con, unsigned int flags) | |||
/*@*/; | /*@*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Destroy context. | ||||
* @param con context | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ | ||||
poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con) | ||||
/*@modifies con @*/; | ||||
/** \ingroup popt | ||||
* Add arguments to context. | * Add arguments to context. | |||
* @param con context | * @param con context | |||
* @param argv argument array, NULL terminated | * @param argv argument array, NULL terminated | |||
* @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure | * @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv) | int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
skipping to change at line 360 | skipping to change at line 389 | |||
* Add alias/exec item to context. | * Add alias/exec item to context. | |||
* @param con context | * @param con context | |||
* @param newItem alias/exec item to add | * @param newItem alias/exec item to add | |||
* @param flags 0 for alias, 1 for exec | * @param flags 0 for alias, 1 for exec | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int poptAddItem(poptContext con, poptItem newItem, int flags) | int poptAddItem(poptContext con, poptItem newItem, int flags) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Perform sanity checks on a file path. | ||||
* @param fn file name | ||||
* @return 0 on OK, 1 on NOTOK. | ||||
*/ | ||||
int poptSaneFile(const char * fn) | ||||
/*@globals errno, internalState @*/ | ||||
/*@modifies errno, internalState @*/; | ||||
/** | ||||
* Read a file into a buffer. | ||||
* @param fn file name | ||||
* @retval *bp buffer (malloc'd) (or NULL) | ||||
* @retval *nbp no. of bytes in buffer (including final NUL) | ||||
(or NULL) | ||||
* @param flags 1 to trim escaped newlines | ||||
* return 0 on success | ||||
*/ | ||||
int poptReadFile(const char * fn, /*@null@*/ /*@out@*/ char ** bp, | ||||
/*@null@*/ /*@out@*/ size_t * nbp, int flags) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies *bp, *nbp, errno, fileSystem, internalState @*/; | ||||
#define POPT_READFILE_TRIMNEWLINES 1 | ||||
/** \ingroup popt | ||||
* Read configuration file. | * Read configuration file. | |||
* @param con context | * @param con context | |||
* @param fn file name to read | * @param fn file name to read | |||
* @return 0 on success, POPT_ERROR_ERRNO on failure | * @return 0 on success, POPT_ERROR_ERRNO on failure | |||
*/ | */ | |||
int poptReadConfigFile(poptContext con, const char * fn) | int poptReadConfigFile(poptContext con, const char * fn) | |||
/*@globals errno, fileSystem, internalState @*/ | /*@globals errno, fileSystem, internalState @*/ | |||
/*@modifies con->execs, con->numExecs, | /*@modifies con->execs, con->numExecs, | |||
errno, fileSystem, internalState @*/; | errno, fileSystem, internalState @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Read configuration file(s). | ||||
* Colon separated files to read, looping over poptReadConfigFile(). | ||||
* Note that an '@' character preceeding a path in the list will | ||||
* also perform additional sanity checks on the file before reading. | ||||
* @param con context | ||||
* @param paths colon separated file name(s) to read | ||||
* @return 0 on success, POPT_ERROR_BADCONFIG on failure | ||||
*/ | ||||
int poptReadConfigFiles(poptContext con, /*@null@*/ const char * paths) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies con->execs, con->numExecs, | ||||
errno, fileSystem, internalState @*/; | ||||
/** \ingroup popt | ||||
* Read default configuration from /etc/popt and $HOME/.popt. | * Read default configuration from /etc/popt and $HOME/.popt. | |||
* @param con context | * @param con context | |||
* @param useEnv (unused) | * @param useEnv (unused) | |||
* @return 0 on success, POPT_ERROR_ERRNO on failure | * @return 0 on success, POPT_ERROR_ERRNO on failure | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) | int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) | |||
/*@globals fileSystem, internalState @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies con->execs, con->numExecs, | /*@modifies con->execs, con->numExecs, | |||
fileSystem, internalState @*/; | fileSystem, internalState @*/; | |||
End of changes. 8 change blocks. | ||||
12 lines changed or deleted | 82 lines changed or added | |||