popt.h | popt.h | |||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING | /* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING | |||
file accompanying popt source distributions, available from | file accompanying popt source distributions, available from | |||
ftp://ftp.rpm.org/pub/rpm/dist. */ | ftp://ftp.rpm.org/pub/rpm/dist. */ | |||
#ifndef H_POPT | #ifndef H_POPT | |||
#define H_POPT | #define H_POPT | |||
#include <stdio.h> /* for FILE * */ | #include <stdio.h> /* for FILE * */ | |||
#define POPT_OPTION_DEPTH 10 | ||||
/** \ingroup popt | /** \ingroup popt | |||
* \name Arg type identifiers | * \name Arg type identifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_ARG_NONE 0U /*!< no arg */ | #define POPT_ARG_NONE 0U /*!< no arg */ | |||
#define POPT_ARG_STRING 1U /*!< arg will be saved as st ring */ | #define POPT_ARG_STRING 1U /*!< arg will be saved as st ring */ | |||
#define POPT_ARG_INT 2U /*!< arg ==> int */ | #define POPT_ARG_INT 2U /*!< arg ==> int */ | |||
#define POPT_ARG_LONG 3U /*!< arg ==> long */ | #define POPT_ARG_LONG 3U /*!< arg ==> long */ | |||
#define POPT_ARG_INCLUDE_TABLE 4U /*!< arg points to table */ | #define POPT_ARG_INCLUDE_TABLE 4U /*!< arg points to table */ | |||
#define POPT_ARG_CALLBACK 5U /*!< table-wide callback... must be | #define POPT_ARG_CALLBACK 5U /*!< table-wide callback... must be | |||
skipping to change at line 74 | skipping to change at line 72 | |||
(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 ,arg] */ | #define POPT_ARGFLAG_RANDOM 0x00400000U /*!< random value in [1 ,arg] */ | |||
#define POPT_ARGFLAG_TOGGLE 0x00200000U /*!< permit --[no]opt p refix toggle */ | #define POPT_ARGFLAG_TOGGLE 0x00200000U /*!< permit --[no]opt p refix toggle */ | |||
#define POPT_ARGFLAG_CALCULATOR 0x00100000U /*!< argDescr has RPN s tring */ | ||||
/*@}*/ | /*@}*/ | |||
/** \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 104 | skipping to change at line 103 | |||
#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 */ | #define POPT_ERROR_BADCONFIG -22 /*!< config file failed sani ty test */ | |||
#define POPT_ERROR_UNWANTEDARG -23 /*!< option does not take an | ||||
argument */ | ||||
#define POPT_ERROR_STACKUNDERFLOW -24 /*!< stack underflow | ||||
*/ | ||||
#define POPT_ERROR_STACKOVERFLOW -25 /*!< stack overflow | ||||
*/ | ||||
/*@}*/ | /*@}*/ | |||
/** \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 168 | skipping to change at line 170 | |||
/*@owned@*/ | /*@owned@*/ | |||
const char ** argv; /*!< (alias) args, must be free()abl e. */ | const char ** argv; /*!< (alias) args, must be free()abl e. */ | |||
} * poptItem; | } * poptItem; | |||
/*@=exporttype@*/ | /*@=exporttype@*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Auto-generated help/usage | * \name Auto-generated help/usage | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* Empty table marker to enable displaying popt alias/exec options. | * Empty table marker to enable displaying popt alias/exec options. | |||
*/ | */ | |||
/*@-exportvar@*/ | /*@-exportvar@*/ | |||
/*@unchecked@*/ /*@observer@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern struct poptOption poptAliasOptions[]; | extern struct poptOption poptAliasOptions[]; | |||
/*@=exportvar@*/ | /*@=exportvar@*/ | |||
#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptio ns, \ | #define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptio ns, \ | |||
0, "Options implemented via popt alias/exec:", NULL }, | 0, "Options implemented via popt alias/exec:", NULL }, | |||
skipping to change at line 221 | skipping to change at line 227 | |||
/** \ingroup popt | /** \ingroup popt | |||
*/ | */ | |||
/*@-exportconst@*/ | /*@-exportconst@*/ | |||
enum poptCallbackReason { | enum poptCallbackReason { | |||
POPT_CALLBACK_REASON_PRE = 0, | POPT_CALLBACK_REASON_PRE = 0, | |||
POPT_CALLBACK_REASON_POST = 1, | POPT_CALLBACK_REASON_POST = 1, | |||
POPT_CALLBACK_REASON_OPTION = 2 | POPT_CALLBACK_REASON_OPTION = 2 | |||
}; | }; | |||
/*@=exportconst@*/ | /*@=exportconst@*/ | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/*@-type@*/ | /*@-type@*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* Table callback prototype. | * Table callback prototype. | |||
* @param con context | * @param con context | |||
* @param reason reason for callback | * @param reason reason for callback | |||
* @param opt option that triggered callback | * @param opt option that triggered callback | |||
* @param arg @todo Document. | * @param arg arg value | |||
* @param data @todo Document. | * @param data callback data | |||
*/ | */ | |||
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 | |||
skipping to change at line 427 | skipping to change at line 430 | |||
* @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). | * Read configuration file(s). | |||
* Colon separated files to read, looping over poptReadConfigFile(). | * Colon separated files to read, looping over poptReadConfigFile(). | |||
* Note that an '@' character preceeding a path in the list will | * Note that an '@' character preceding a path in the list will | |||
* also perform additional sanity checks on the file before reading. | * also perform additional sanity checks on the file before reading. | |||
* @param con context | * @param con context | |||
* @param paths colon separated file name(s) to read | * @param paths colon separated file name(s) to read | |||
* @return 0 on success, POPT_ERROR_BADCONFIG on failure | * @return 0 on success, POPT_ERROR_BADCONFIG on failure | |||
*/ | */ | |||
int poptReadConfigFiles(poptContext con, /*@null@*/ const char * paths) | int poptReadConfigFiles(poptContext con, /*@null@*/ const char * paths) | |||
/*@globals errno, fileSystem, internalState @*/ | /*@globals errno, fileSystem, internalState @*/ | |||
/*@modifies con->execs, con->numExecs, | /*@modifies con->execs, con->numExecs, | |||
errno, fileSystem, internalState @*/; | errno, fileSystem, internalState @*/; | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 14 lines changed or added | |||