diff options
author | Erik Troan <ewt@src.gnome.org> | 1998-10-27 05:38:38 +0000 |
---|---|---|
committer | Erik Troan <ewt@src.gnome.org> | 1998-10-27 05:38:38 +0000 |
commit | 99204a68db9ff740b150c752c1d7dd62bbebcf8f (patch) | |
tree | 2ea57c956c393b283120ac416d0767fe1de0b040 /support | |
parent | 64abb889bd8f202bcb03e12e590c0fcd93de2d3d (diff) | |
download | shared-mime-info-99204a68db9ff740b150c752c1d7dd62bbebcf8f.tar.gz |
implemented POPT_ARGINFO_INC_DATA
svn path=/trunk/; revision=456
Diffstat (limited to 'support')
-rw-r--r-- | support/popt-gnome.h | 3 | ||||
-rw-r--r-- | support/popt.c | 13 | ||||
-rw-r--r-- | support/popt.h | 3 |
3 files changed, 13 insertions, 6 deletions
diff --git a/support/popt-gnome.h b/support/popt-gnome.h index ba3a815d..9bac7972 100644 --- a/support/popt-gnome.h +++ b/support/popt-gnome.h @@ -23,6 +23,8 @@ #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */ #define POPT_CBFLAG_PRE 0x80000000 /* call the callback before parse */ #define POPT_CBFLAG_POST 0x40000000 /* call the callback after parse */ +#define POPT_CBFLAG_INC_DATA 0x20000000 /* use data from the include line, + not the subtable */ #define POPT_ERROR_NOARG -10 #define POPT_ERROR_BADOPT -11 @@ -66,7 +68,6 @@ typedef struct poptContext_s * poptContext; typedef struct poptOption * poptOption; #endif -#define POPT_CB_USE_INCLUDE_DATA ((void *) -1) enum poptCallbackReason { POPT_CALLBACK_REASON_PRE, POPT_CALLBACK_REASON_POST, POPT_CALLBACK_REASON_OPTION }; diff --git a/support/popt.c b/support/popt.c index 47f0d008..9ebc81bb 100644 --- a/support/popt.c +++ b/support/popt.c @@ -242,7 +242,11 @@ static const struct poptOption * findOption(const struct poptOption * table, if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { opt2 = findOption(opt->arg, longName, shortName, callback, callbackData, singleDash); - if (opt2) return opt2; + if (opt2) { + if (*callback && !*callbackData) + *callbackData = opt->descrip; + return opt2; + } } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) { cb = opt; } else if (longName && opt->longName && @@ -256,11 +260,12 @@ static const struct poptOption * findOption(const struct poptOption * table, } if (!opt->longName && !opt->shortName) return NULL; + *callbackData = NULL; + *callback = NULL; if (cb) { *callback = cb->arg; - *callbackData = cb->descrip; - } else { - *callback = NULL; + if (!(cb->argInfo & POPT_CBFLAG_INC_DATA)) + *callbackData = cb->descrip; } return opt; diff --git a/support/popt.h b/support/popt.h index ba3a815d..9bac7972 100644 --- a/support/popt.h +++ b/support/popt.h @@ -23,6 +23,8 @@ #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */ #define POPT_CBFLAG_PRE 0x80000000 /* call the callback before parse */ #define POPT_CBFLAG_POST 0x40000000 /* call the callback after parse */ +#define POPT_CBFLAG_INC_DATA 0x20000000 /* use data from the include line, + not the subtable */ #define POPT_ERROR_NOARG -10 #define POPT_ERROR_BADOPT -11 @@ -66,7 +68,6 @@ typedef struct poptContext_s * poptContext; typedef struct poptOption * poptOption; #endif -#define POPT_CB_USE_INCLUDE_DATA ((void *) -1) enum poptCallbackReason { POPT_CALLBACK_REASON_PRE, POPT_CALLBACK_REASON_POST, POPT_CALLBACK_REASON_OPTION }; |