summaryrefslogtreecommitdiff
path: root/popt
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-12-26 15:09:26 +0000
committerjbj <devnull@localhost>2003-12-26 15:09:26 +0000
commit23ddd50de97a301a7c7a402b8d3ee4b3cc26355b (patch)
tree333cbc632603ce259075f3889450fa6e44491e88 /popt
parenta3a26eb6687879e42d061c91021180ad55a68925 (diff)
downloadlibrpm-tizen-23ddd50de97a301a7c7a402b8d3ee4b3cc26355b.tar.gz
librpm-tizen-23ddd50de97a301a7c7a402b8d3ee4b3cc26355b.tar.bz2
librpm-tizen-23ddd50de97a301a7c7a402b8d3ee4b3cc26355b.zip
Sick hack to preserve the pretense that popt has an ABI.
CVS patchset: 7008 CVS date: 2003/12/26 15:09:26
Diffstat (limited to 'popt')
-rw-r--r--popt/popt.c20
-rw-r--r--popt/popt.h6
-rw-r--r--popt/popthelp.c15
3 files changed, 37 insertions, 4 deletions
diff --git a/popt/popt.c b/popt/popt.c
index f306bd2b7..357e01b2c 100644
--- a/popt/popt.c
+++ b/popt/popt.c
@@ -69,8 +69,11 @@ static void invokeCallbacksPRE(poptContext con, const struct poptOption * opt)
for (; opt->longName || opt->shortName || opt->arg; opt++) {
if (opt->arg == NULL) continue; /* XXX program error. */
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
+ void * arg = opt->arg;
+ /* XXX sick hack to preserve pretense of ABI. */
+ if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
/* Recurse on included sub-tables. */
- invokeCallbacksPRE(con, opt->arg);
+ invokeCallbacksPRE(con, arg);
} else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
(opt->argInfo & POPT_CBFLAG_PRE))
{ /*@-castfcnptr@*/
@@ -92,8 +95,11 @@ static void invokeCallbacksPOST(poptContext con, const struct poptOption * opt)
for (; opt->longName || opt->shortName || opt->arg; opt++) {
if (opt->arg == NULL) continue; /* XXX program error. */
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
+ void * arg = opt->arg;
+ /* XXX sick hack to preserve pretense of ABI. */
+ if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
/* Recurse on included sub-tables. */
- invokeCallbacksPOST(con, opt->arg);
+ invokeCallbacksPOST(con, arg);
} else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
(opt->argInfo & POPT_CBFLAG_POST))
{ /*@-castfcnptr@*/
@@ -119,6 +125,9 @@ static void invokeCallbacksOPTION(poptContext con,
if (opt != NULL)
for (; opt->longName || opt->shortName || opt->arg; opt++) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
+ void * arg = opt->arg;
+ /* XXX sick hack to preserve pretense of ABI. */
+ if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
/* Recurse on included sub-tables. */
if (opt->arg != NULL) /* XXX program error */
invokeCallbacksOPTION(con, opt->arg, myOpt, myData, shorty);
@@ -471,10 +480,13 @@ findOption(const struct poptOption * opt, /*@null@*/ const char * longName,
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
const struct poptOption * opt2;
+ void * arg = opt->arg;
+ /* XXX sick hack to preserve pretense of ABI. */
+ if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
/* Recurse on included sub-tables. */
- if (opt->arg == NULL) continue; /* XXX program error */
- opt2 = findOption(opt->arg, longName, shortName, callback,
+ if (arg == NULL) continue; /* XXX program error */
+ opt2 = findOption(arg, longName, shortName, callback,
callbackData, singleDash);
if (opt2 == NULL) continue;
/* Sub-table data will be inheirited if no data yet. */
diff --git a/popt/popt.h b/popt/popt.h
index 7be75de38..3eac333c6 100644
--- a/popt/popt.h
+++ b/popt/popt.h
@@ -171,6 +171,12 @@ extern struct poptOption poptAliasOptions[];
/*@unchecked@*/ /*@observer@*/
extern struct poptOption poptHelpOptions[];
/*@=exportvar@*/
+
+/*@-exportvar@*/
+/*@unchecked@*/ /*@observer@*/
+extern struct poptOption * poptHelpOptionsI18N;
+/*@=exportvar@*/
+
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options:", NULL },
diff --git a/popt/popthelp.c b/popt/popthelp.c
index 8d4ab6a3b..c8b98ab43 100644
--- a/popt/popthelp.c
+++ b/popt/popthelp.c
@@ -54,6 +54,18 @@ struct poptOption poptAliasOptions[] = {
/*@-castfcnptr@*/
/*@observer@*/ /*@unchecked@*/
struct poptOption poptHelpOptions[] = {
+ { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
+ { "help", '?', 0, NULL, '?', N_("Show this help message"), NULL },
+ { "usage", '\0', 0, NULL, 'u', N_("Display brief usage message"), NULL },
+#ifdef NOTYET
+ { "defaults", '\0', POPT_ARG_NONE, &show_option_defaults, 0,
+ N_("Display option defaults in message"), NULL },
+#endif
+ POPT_TABLEEND
+} ;
+
+/*@observer@*/ /*@unchecked@*/
+static struct poptOption poptHelpOptions2[] = {
/*@-readonlytrans@*/
{ NULL, '\0', POPT_ARG_INTL_DOMAIN, PACKAGE, 0, NULL, NULL},
/*@=readonlytrans@*/
@@ -66,6 +78,9 @@ struct poptOption poptHelpOptions[] = {
#endif
POPT_TABLEEND
} ;
+
+/*@observer@*/ /*@unchecked@*/
+struct poptOption * poptHelpOptionsI18N = poptHelpOptions2;
/*@=castfcnptr@*/
/**