summaryrefslogtreecommitdiff
path: root/popt.h
diff options
context:
space:
mode:
authorjbj <jbj>2001-07-07 19:15:17 +0000
committerjbj <jbj>2001-07-07 19:15:17 +0000
commite9a026bfe5aacafb9a96f8a817c6b72ff4cb74c9 (patch)
treeb59228f5a6ea16e4df1cca119d536197496db712 /popt.h
parentf979616341bf58f0a8bdc1939aaeed9b7254f71b (diff)
downloadlibpopt-e9a026bfe5aacafb9a96f8a817c6b72ff4cb74c9.tar.gz
- 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.
Diffstat (limited to 'popt.h')
-rw-r--r--popt.h36
1 files changed, 35 insertions, 1 deletions
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 */
@@ -135,12 +136,33 @@ struct poptAlias {
};
/** \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,15 +290,27 @@ 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
* @param fn file name to read