Here's a patch for a cosmetic oddity in the help texts.
(And yeah, seeing a popt-1.17 tag would be cool, too.)
input poptOption array:
  {NULL, 'A', POPT_ARG_STRING, &a, 0, "A", "GUID"},
  {NULL, 'C', POPT_ARG_STRING, &c, 0, "C"},

$ ./myapp -?
  -A=X GUID       A
  -C STRING       C
$ ./myapp --usage
Usage: myapp [-A=GUID] [-C=STRING]

'=' is generally not used with short options. Drop it.

---
 popthelp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: popt/popthelp.c
===================================================================
--- popt.orig/popthelp.c
+++ popt/popthelp.c
@@ -460,7 +460,8 @@ assert(t);	/* XXX can't happen */
 	    /* XXX argDescrip[0] determines "--foo=bar" or "--foo bar". */
 	    if (!strchr(" =(", argDescrip[0]))
 		*le++ = ((poptArgType(opt) == POPT_ARG_MAINCALL) ? ' ' :
-			 (poptArgType(opt) == POPT_ARG_ARGV) ? ' ' : '=');
+			 (poptArgType(opt) == POPT_ARG_ARGV) ? ' ' :
+			 opt->longName == NULL ? ' ' : '=');
 	    le = stpcpy(leo = le, argDescrip);
 
 	    /* Adjust for (possible) wide characters. */
@@ -754,7 +755,7 @@ static size_t singleOptionUsage(FILE * f
 
     if (argDescrip) {
 	/* XXX argDescrip[0] determines "--foo=bar" or "--foo bar". */
-	if (!strchr(" =(", argDescrip[0])) fprintf(fp, "=");
+	if (!strchr(" =(", argDescrip[0])) fputc(opt->longName == NULL ? ' ' : '=', fp);
 	fprintf(fp, "%s", argDescrip);
     }
     fprintf(fp, "]");

Reply via email to