From e9a026bfe5aacafb9a96f8a817c6b72ff4cb74c9 Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 7 Jul 2001 19:15:17 +0000 Subject: - popthelp.c: don't use stpcpy to avoid portability grief (#47500). - permit alias/exec description/arg text to be set from popt config. - use rpmqv.c, not rpm.c, as rpm's main() routine. --- popt.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'popt.h') diff --git a/popt.h b/popt.h index a4c60e9..cf61498 100644 --- a/popt.h +++ b/popt.h @@ -126,6 +126,7 @@ struct poptOption { }; /** \ingroup popt + * A popt alias argument for poptAddAlias(). */ struct poptAlias { /*@owned@*/ /*@null@*/ const char * longName; /*!< may be NULL */ @@ -134,13 +135,34 @@ struct poptAlias { /*@owned@*/ const char ** argv; /*!< must be free()able */ }; +/** \ingroup popt + * A popt alias or exec argument for poptAddItem(). + */ +typedef struct poptItem_s { + struct poptOption option; /*!< alias/exec name(s) and description. */ + int argc; /*!< (alias) no. of args. */ +/*@owned@*/ const char ** argv; /*!< (alias) args, must be free()able. */ +} * poptItem; + /** \ingroup popt * \name Auto-generated help/usage */ /*@{*/ + +/** + * Empty table marker to enable displaying popt alias/exec options. + */ +extern struct poptOption poptAliasOptions[]; +#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \ + 0, "Options implemented via popt alias/exec:", NULL }, + +/** + * Auto help table options. + */ extern struct poptOption poptHelpOptions[]; #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \ 0, "Help options:", NULL }, + #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } /*@}*/ @@ -268,14 +290,26 @@ int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv) /** \ingroup popt * Add alias to context. * @todo Pass alias by reference, not value. + * @deprecated Use poptAddItem instead. * @param con context * @param alias alias to add * @param flags (unused) - * @return 0 always + * @return 0 on success */ +/*@unused@*/ int poptAddAlias(poptContext con, struct poptAlias alias, int flags) /*@modifies con @*/; +/** \ingroup popt + * Add alias/exec item to context. + * @param con context + * @param item alias/exec item to add + * @param flags 0 for alias, 1 for exec + * @return 0 on success + */ +int poptAddItem(poptContext con, poptItem newItem, int flags) + /*@modifies con @*/; + /** \ingroup popt * Read configuration file. * @param con context -- cgit v1.2.1