summaryrefslogtreecommitdiff
path: root/popthelp.c
diff options
context:
space:
mode:
authorsopwith <sopwith>1999-04-07 18:57:23 +0000
committersopwith <sopwith>1999-04-07 18:57:23 +0000
commita29ab6b3d587c5afac791e4148497ca77601268b (patch)
tree9c380b6682ad0ed62f332a34414c564b709b5db4 /popthelp.c
parentdc4f62fe874e7734def1ca71034d1fbab19990a8 (diff)
downloadlibpopt-a29ab6b3d587c5afac791e4148497ca77601268b.tar.gz
Merge (most) changes from the GNOME version of popt. The remaining changesPOST_GNOME_MERGE
are GNOME-specific.
Diffstat (limited to 'popthelp.c')
-rw-r--r--popthelp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/popthelp.c b/popthelp.c
index fb945d4..ca86f34 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -73,10 +73,12 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
int helpLength;
const char * ch;
char format[10];
- char * left = alloca(maxLeftCol + 1);
+ char * left;
const char * argDescrip = getArgDescrip(opt, translation_domain);
+ left = malloc(maxLeftCol + 1);
*left = '\0';
+
if (opt->longName && opt->shortName)
sprintf(left, "-%c, --%s", opt->shortName, opt->longName);
else if (opt->shortName)
@@ -93,7 +95,7 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
fprintf(f," %-*s ", maxLeftCol, left);
else {
fprintf(f," %s\n", left);
- return;
+ goto out;
}
helpLength = strlen(help);
@@ -112,6 +114,9 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
}
if (helpLength) fprintf(f, "%s\n", help);
+
+out:
+ free(left);
}
static int maxArgWidth(const struct poptOption * opt,