diff options
author | Erik Troan <ewt@src.gnome.org> | 1998-10-21 21:44:21 +0000 |
---|---|---|
committer | Erik Troan <ewt@src.gnome.org> | 1998-10-21 21:44:21 +0000 |
commit | 0fe1a70475dfa7889d61c1b58b277d9317c79934 (patch) | |
tree | 399df9da5158539223f908a98836d1f5d3b277ef /support/popthelp.c | |
parent | c01ab27ea73e74fe353df354b8e7e0bb9fde01e7 (diff) | |
download | shared-mime-info-0fe1a70475dfa7889d61c1b58b277d9317c79934.tar.gz |
implemented POPT_ARGFLAG_DOC_HIDDEN, POPT_CBFLAG_PRE, POPT_CBFLAG_POST
svn path=/trunk/; revision=451
Diffstat (limited to 'support/popthelp.c')
-rw-r--r-- | support/popthelp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/support/popthelp.c b/support/popthelp.c index 17f110e2..df5ed267 100644 --- a/support/popthelp.c +++ b/support/popthelp.c @@ -14,7 +14,8 @@ #include "popt.h" #include "poptint.h" -static void displayArgs(poptContext con, struct poptOption * key, +static void displayArgs(poptContext con, enum poptCallbackReason foo, + struct poptOption * key, const char * arg, void * data) { if (key->shortName== '?') poptPrintHelp(con, stderr, 0); @@ -94,7 +95,8 @@ static int maxArgWidth(const struct poptOption * opt) { while (opt->longName || opt->shortName || opt->arg) { if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { this = maxArgWidth(opt->arg); - } else { + if (this > max) max = this; + } else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) { this = opt->shortName ? 2 : 0; if (opt->longName) { if (this) this += 2; @@ -104,10 +106,9 @@ static int maxArgWidth(const struct poptOption * opt) { s = getArgDescrip(opt); if (s) this += strlen(s) + 1; + if (this > max) max = this; } - if (this > max) max = this; - opt++; } @@ -120,7 +121,8 @@ static void singleTableHelp(FILE * f, const struct poptOption * table, opt = table; while (opt->longName || opt->shortName || opt->arg) { - if (opt->longName || opt->shortName) + if ((opt->longName || opt->shortName) && + !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) singleOptionHelp(f, left, opt); opt++; } @@ -204,7 +206,8 @@ int singleTableUsage(FILE * f, int cursor, const struct poptOption * table) { opt = table; while (opt->longName || opt->shortName || opt->arg) { - if (opt->longName || opt->shortName) + if ((opt->longName || opt->shortName) && + !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) cursor = singleOptionUsage(f, cursor, opt); else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) cursor = singleTableUsage(f, cursor, opt->arg); |