summaryrefslogtreecommitdiff
path: root/popthelp.c
diff options
context:
space:
mode:
authorjbj <jbj>2007-08-15 12:56:06 +0000
committerjbj <jbj>2007-08-15 12:56:06 +0000
commit0486d0350f56a4037b94468ae3c81084985bcc51 (patch)
tree3e27a84982ae53d8e71a509b6891aa0a7e513c9c /popthelp.c
parenta7632962d025bc72c8f62fbf0e53010d88cf3a70 (diff)
downloadlibpopt-0486d0350f56a4037b94468ae3c81084985bcc51.tar.gz
- help formatting for POPT_ARG_MAINCALL.
Diffstat (limited to 'popthelp.c')
-rw-r--r--popthelp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/popthelp.c b/popthelp.c
index 737f614..a5357d3 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -119,6 +119,9 @@ getArgDescrip(const struct poptOption * opt,
{
if (!(opt->argInfo & POPT_ARG_MASK)) return NULL;
+ if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_MAINCALL)
+ return opt->argDescrip;
+
if (opt->argDescrip) {
/* Some strings need popt library, not application, i18n domain. */
if (opt == (poptHelpOptions + 1)
@@ -143,6 +146,7 @@ getArgDescrip(const struct poptOption * opt,
case POPT_ARG_STRING: return POPT_("STRING");
case POPT_ARG_FLOAT: return POPT_("FLOAT");
case POPT_ARG_DOUBLE: return POPT_("DOUBLE");
+ case POPT_ARG_MAINCALL: return NULL;
default: return POPT_("ARG");
}
}
@@ -192,6 +196,9 @@ singleOptionDefaultValue(size_t lineLength,
{ double aDouble = *((double *)opt->arg);
le += sprintf(le, "%g", aDouble);
} break;
+ case POPT_ARG_MAINCALL:
+ le += sprintf(le, "%p", opt->arg);
+ break;
case POPT_ARG_STRING:
{ const char * s = *(const char **)opt->arg;
if (s == NULL) {
@@ -260,7 +267,8 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
sprintf(left, "-%c", opt->shortName);
else if (opt->longName)
sprintf(left, "%s%s",
- ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
+ ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_MAINCALL ? "" :
+ ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--")),
opt->longName);
if (!*left) goto out;
@@ -342,7 +350,8 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
} else {
size_t lelen;
- *le++ = '=';
+ *le++ = ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_MAINCALL)
+ ? ' ' : '=';
strcpy(le, argDescrip);
lelen = strlen(le);
le += lelen;