popt.h   popt.h 
skipping to change at line 115 skipping to change at line 115
/*@{*/ /*@{*/
#define POPT_CONTEXT_NO_EXEC (1 << 0) /*!< ignore exec expansions */ #define POPT_CONTEXT_NO_EXEC (1 << 0) /*!< ignore exec expansions */
#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /*!< pay attention to argv [0] */ #define POPT_CONTEXT_KEEP_FIRST (1 << 1) /*!< pay attention to argv [0] */
#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /*!< options can't follow args */ #define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /*!< options can't follow args */
#define POPT_CONTEXT_ARG_OPTS (1 << 4) /*!< return args as options with va lue 0 */ #define POPT_CONTEXT_ARG_OPTS (1 << 4) /*!< return args as options with va lue 0 */
/*@}*/ /*@}*/
/** \ingroup popt /** \ingroup popt
*/ */
struct poptOption { struct poptOption {
/*@observer@*/ /*@null@*/ const char * longName; /*!< may be NULL */ /*@observer@*/ /*@null@*/
char shortName; /*!< may be '\0' */ const char * longName; /*!< may be NULL */
char shortName; /*!< may be NUL */
int argInfo; int argInfo;
/*@shared@*/ /*@null@*/ void * arg; /*!< depends on argInfo */ /*@shared@*/ /*@null@*/
void * arg; /*!< depends on argInfo */
int val; /*!< 0 means don't return, just update flag */ int val; /*!< 0 means don't return, just update flag */
/*@observer@*/ /*@null@*/ const char * descrip; /*!< description for /*@observer@*/ /*@null@*/
autohelp -- may be NULL */ const char * descrip; /*!< description for autohelp -- may be NULL
/*@observer@*/ /*@null@*/ const char * argDescrip; /*!< argument descriptio */
n for autohelp */ /*@observer@*/ /*@null@*/
const char * argDescrip; /*!< argument description for autohelp */
}; };
/** \ingroup popt /** \ingroup popt
* A popt alias argument for poptAddAlias(). * A popt alias argument for poptAddAlias().
*/ */
struct poptAlias { struct poptAlias {
/*@owned@*/ /*@null@*/ const char * longName; /*!< may be NULL */ /*@owned@*/ /*@null@*/
char shortName; /*!< may be '\0' */ const char * longName; /*!< may be NULL */
char shortName; /*!< may be NUL */
int argc; int argc;
/*@owned@*/ const char ** argv; /*!< must be free()able */ /*@owned@*/
const char ** argv; /*!< must be free()able */
}; };
/** \ingroup popt /** \ingroup popt
* A popt alias or exec argument for poptAddItem(). * A popt alias or exec argument for poptAddItem().
*/ */
/*@-exporttype@*/ /*@-exporttype@*/
typedef struct poptItem_s { typedef struct poptItem_s {
struct poptOption option; /*!< alias/exec name(s) and description. */ struct poptOption option; /*!< alias/exec name(s) and description. */
int argc; /*!< (alias) no. of args. */ int argc; /*!< (alias) no. of args. */
/*@owned@*/ const char ** argv; /*!< (alias) args, must be free()abl /*@owned@*/
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
*/ */
/*@{*/ /*@{*/
/** /**
* Empty table marker to enable displaying popt alias/exec options. * Empty table marker to enable displaying popt alias/exec options.
skipping to change at line 167 skipping to change at line 174
#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 },
/** /**
* Auto help table options. * Auto help table options.
*/ */
/*@-exportvar@*/ /*@-exportvar@*/
/*@unchecked@*/ /*@observer@*/ /*@unchecked@*/ /*@observer@*/
extern struct poptOption poptHelpOptions[]; extern struct poptOption poptHelpOptions[];
/*@=exportvar@*/ /*@=exportvar@*/
/*@-exportvar@*/
/*@unchecked@*/ /*@observer@*/
extern struct poptOption * poptHelpOptionsI18N;
/*@=exportvar@*/
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions , \ #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions , \
0, "Help options:", NULL }, 0, "Help options:", NULL },
#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
/*@}*/ /*@}*/
/** \ingroup popt /** \ingroup popt
*/ */
/*@-exporttype@*/ /*@-exporttype@*/
typedef /*@abstract@*/ struct poptContext_s * poptContext; typedef /*@abstract@*/ struct poptContext_s * poptContext;
skipping to change at line 213 skipping to change at line 226
* @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 @todo Document.
* @param data @todo Document. * @param data @todo Document.
*/ */
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 @*/
/*@modifies internalState @*/;
/** \ingroup popt /** \ingroup popt
* Initialize popt context. * Initialize popt context.
* @param 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@*/ poptContext poptGetContext( /*@only@*/ /*@null@*/
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 ,
int flags) int flags)
/*@*/; /*@*/;
/** \ingroup popt /** \ingroup popt
* Reinitialize popt context. * Reinitialize popt context.
* @param con context * @param con context
*/ */
/*@-exportlocal@*/ /*@unused@*/
void poptResetContext(/*@null@*/poptContext con) void poptResetContext(/*@null@*/poptContext con)
/*@modifies con @*/; /*@modifies con @*/;
/*@=exportlocal@*/
/** \ingroup popt /** \ingroup popt
* Return value of next option found. * Return value of next option found.
* @param con context * @param con context
* @return next option val, -1 on last item, POPT_ERROR_* on er ror * @return next option val, -1 on last item, POPT_ERROR_* on er ror
*/ */
int poptGetNextOpt(/*@null@*/poptContext con) int poptGetNextOpt(/*@null@*/poptContext con)
/*@globals fileSystem, internalState @*/ /*@globals fileSystem, internalState @*/
/*@modifies con, fileSystem, internalState @*/; /*@modifies con, fileSystem, internalState @*/;
/*@-redecl@*/
/** \ingroup popt /** \ingroup popt
* Return next option argument (if any). * Return next option argument (if any).
* @param con context * @param con context
* @return option argument, NULL if no more options are availab le * @return option argument, NULL if no argument is available
*/ */
/*@observer@*/ /*@null@*/ const char * poptGetOptArg(/*@null@*/poptContext /*@observer@*/ /*@null@*/ /*@unused@*/
con) const char * poptGetOptArg(/*@null@*/poptContext con)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Return current option's argument. * Return next argument.
* @param con context * @param con context
* @return option argument, NULL if no more options are availab le * @return next argument, NULL if no argument is available
*/ */
/*@observer@*/ /*@null@*/ const char * poptGetArg(/*@null@*/poptContext con /*@observer@*/ /*@null@*/ /*@unused@*/
) const char * poptGetArg(/*@null@*/poptContext con)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Peek at current option's argument. * Peek at current argument.
* @param con context * @param con context
* @return option argument * @return current argument, NULL if no argument is available
*/ */
/*@observer@*/ /*@null@*/ const char * poptPeekArg(/*@null@*/poptContext co /*@observer@*/ /*@null@*/ /*@unused@*/
n) const char * poptPeekArg(/*@null@*/poptContext con)
/*@*/; /*@*/;
/** \ingroup popt /** \ingroup popt
* Return remaining arguments. * Return remaining arguments.
* @param con context * @param con context
* @return argument array, terminated with NULL * @return argument array, NULL terminated
*/ */
/*@observer@*/ /*@null@*/ const char ** poptGetArgs(/*@null@*/poptContext c /*@observer@*/ /*@null@*/
on) const char ** poptGetArgs(/*@null@*/poptContext con)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* 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@*/ const char * poptBadOption(/*@null@*/poptContext con, int fl /*@observer@*/
ags) const char * poptBadOption(/*@null@*/poptContext con, int flags)
/*@*/; /*@*/;
/*@=redecl@*/
/** \ingroup popt /** \ingroup popt
* Destroy context. * Destroy context.
* @param con context * @param con context
* @return NULL always * @return NULL always
*/ */
/*@null@*/ poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext c /*@null@*/
on) poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \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@*/
int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv) int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Add alias to context. * Add alias to context.
* @todo Pass alias by reference, not value. * @todo Pass alias by reference, not value.
* @deprecated Use poptAddItem instead. * @deprecated Use poptAddItem instead.
* @param con context * @param con context
* @param alias alias to add * @param alias alias to add
* @param flags (unused) * @param flags (unused)
skipping to change at line 339 skipping to change at line 358
int poptAddItem(poptContext con, poptItem newItem, int flags) int poptAddItem(poptContext con, poptItem newItem, int flags)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \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 fileSystem, internalState @*/ /*@globals errno, fileSystem, internalState @*/
/*@modifies con->execs, con->numExecs, /*@modifies con->execs, con->numExecs,
fileSystem, internalState @*/; errno, fileSystem, internalState @*/;
/** \ingroup popt /** \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@*/
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 @*/;
/** \ingroup popt /** \ingroup popt
* Duplicate an argument array. * Duplicate an argument array.
* @note: The argument array is malloc'd as a single area, so only argv mus t * @note: The argument array is malloc'd as a single area, so only argv mus t
* be free'd. * be free'd.
* *
skipping to change at line 442 skipping to change at line 462
int poptConfigFileToString(FILE *fp, /*@out@*/ char ** argstrp, int flags) int poptConfigFileToString(FILE *fp, /*@out@*/ char ** argstrp, int flags)
/*@globals fileSystem @*/ /*@globals fileSystem @*/
/*@modifies *fp, *argstrp, fileSystem @*/; /*@modifies *fp, *argstrp, fileSystem @*/;
/*@=fcnuse@*/ /*@=fcnuse@*/
/** \ingroup popt /** \ingroup popt
* Return formatted error string for popt failure. * Return formatted error string for popt failure.
* @param error popt error * @param error popt error
* @return error string * @return error string
*/ */
/*@-redecl@*/ /*@observer@*/
/*@observer@*/ const char *const poptStrerror(const int error) const char *const poptStrerror(const int error)
/*@*/; /*@*/;
/*@=redecl@*/
/** \ingroup popt /** \ingroup popt
* Limit search for executables. * Limit search for executables.
* @param con context * @param con context
* @param path single path to search for executables * @param path single path to search for executables
* @param allowAbsolute absolute paths only? * @param allowAbsolute absolute paths only?
*/ */
/*@unused@*/
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute) void poptSetExecPath(poptContext con, const char * path, int allowAbsolute)
/*@modifies con @*/; /*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Print detailed description of options. * Print detailed description of options.
* @param con context * @param con context
* @param fp ouput file handle * @param fp ouput file handle
* @param flags (unused) * @param flags (unused)
*/ */
void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags) void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags)
skipping to change at line 491 skipping to change at line 511
/*@-fcnuse@*/ /*@-fcnuse@*/
void poptSetOtherOptionHelp(poptContext con, const char * text) void poptSetOtherOptionHelp(poptContext con, const char * text)
/*@modifies con @*/; /*@modifies con @*/;
/*@=fcnuse@*/ /*@=fcnuse@*/
/** \ingroup popt /** \ingroup popt
* Return argv[0] from context. * Return argv[0] from context.
* @param con context * @param con context
* @return argv[0] * @return argv[0]
*/ */
/*@-redecl -fcnuse@*/ /*@-fcnuse@*/
/*@observer@*/ const char * poptGetInvocationName(poptContext con) /*@observer@*/
const char * poptGetInvocationName(poptContext con)
/*@*/; /*@*/;
/*@=redecl =fcnuse@*/ /*@=fcnuse@*/
/** \ingroup popt /** \ingroup popt
* Shuffle argv pointers to remove stripped args, returns new argc. * Shuffle argv pointers to remove stripped args, returns new argc.
* @param con context * @param con context
* @param argc no. of args * @param argc no. of args
* @param argv arg vector * @param argv arg vector
* @return new argc * @return new argc
*/ */
/*@-fcnuse@*/ /*@-fcnuse@*/
int poptStrippedArgv(poptContext con, int argc, char ** argv) int poptStrippedArgv(poptContext con, int argc, char ** argv)
skipping to change at line 517 skipping to change at line 538
/** /**
* Save a long, performing logical operation with value. * Save a long, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms. * @warning Alignment check may be too strict on certain platorms.
* @param arg integer pointer, aligned on int boundary. * @param arg integer pointer, aligned on int boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*) * @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLong value to use * @param aLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION
*/ */
/*@-incondefs@*/ /*@-incondefs@*/
/*@unused@*/
int poptSaveLong(/*@null@*/ long * arg, int argInfo, long aLong) int poptSaveLong(/*@null@*/ long * arg, int argInfo, long aLong)
/*@modifies *arg @*/ /*@modifies *arg @*/
/*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/;
/*@=incondefs@*/ /*@=incondefs@*/
/** /**
* Save an integer, performing logical operation with value. * Save an integer, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms. * @warning Alignment check may be too strict on certain platorms.
* @param arg integer pointer, aligned on int boundary. * @param arg integer pointer, aligned on int boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*) * @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLong value to use * @param aLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION
*/ */
/*@-incondefs@*/ /*@-incondefs@*/
/*@unused@*/
int poptSaveInt(/*@null@*/ int * arg, int argInfo, long aLong) int poptSaveInt(/*@null@*/ int * arg, int argInfo, long aLong)
/*@modifies *arg @*/ /*@modifies *arg @*/
/*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/;
/*@=incondefs@*/ /*@=incondefs@*/
/*@=type@*/ /*@=type@*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 37 change blocks. 
45 lines changed or deleted 61 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/