summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--support/popt-gnome.h1
-rw-r--r--support/popt.c6
-rw-r--r--support/popt.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/support/popt-gnome.h b/support/popt-gnome.h
index e2160494..069cab11 100644
--- a/support/popt-gnome.h
+++ b/support/popt-gnome.h
@@ -22,6 +22,7 @@
for this table and any
included tables; arg points
to the domain string */
+#define POPT_ARG_VAL 7 /* arg should take value val */
#define POPT_ARG_MASK 0x0000FFFF
#define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */
diff --git a/support/popt.c b/support/popt.c
index ca97e5de..f9e61538 100644
--- a/support/popt.c
+++ b/support/popt.c
@@ -392,6 +392,10 @@ int poptGetNextOpt(poptContext con) {
*((char **) opt->arg) = con->os->nextArg;
break;
+ case POPT_ARG_VAL:
+ *((int *) opt->arg) = opt->val;
+ break;
+
case POPT_ARG_INT:
case POPT_ARG_LONG:
aLong = strtol(con->os->nextArg, &end, 0);
@@ -419,7 +423,7 @@ int poptGetNextOpt(poptContext con) {
if (cb)
cb(con, POPT_CALLBACK_REASON_OPTION, opt, con->os->nextArg, cbData);
- else if (opt->val)
+ else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL))
done = 1;
if ((con->finalArgvCount + 2) >= (con->finalArgvAlloced)) {
diff --git a/support/popt.h b/support/popt.h
index e2160494..069cab11 100644
--- a/support/popt.h
+++ b/support/popt.h
@@ -22,6 +22,7 @@
for this table and any
included tables; arg points
to the domain string */
+#define POPT_ARG_VAL 7 /* arg should take value val */
#define POPT_ARG_MASK 0x0000FFFF
#define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */