diff options
author | Elliot Lee <sopwith@src.gnome.org> | 1999-07-06 20:29:42 +0000 |
---|---|---|
committer | Elliot Lee <sopwith@src.gnome.org> | 1999-07-06 20:29:42 +0000 |
commit | c3885daa46991d1e4fb2f2aa7b49c8df5b26e204 (patch) | |
tree | 5c2c77e8c8dedbc6dcbce7ae656b640ccb2c4b42 /support/popthelp.c | |
parent | 984258c935552744012274d80886b4e72e25b4a0 (diff) | |
download | shared-mime-info-c3885daa46991d1e4fb2f2aa7b49c8df5b26e204.tar.gz |
libgnorba: Remove GnomeObject stuff.
libgnorba: Remove GnomeObject stuff.
support: Merge newer popt in from canonical source.
svn path=/trunk/; revision=842
Diffstat (limited to 'support/popthelp.c')
-rw-r--r-- | support/popthelp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/support/popthelp.c b/support/popthelp.c index 618f8a21..bde26c96 100644 --- a/support/popthelp.c +++ b/support/popthelp.c @@ -31,7 +31,7 @@ static void displayArgs(poptContext con, enum poptCallbackReason foo, } struct poptOption poptHelpOptions[] = { - { NULL, '\0', POPT_ARG_CALLBACK, &displayArgs, '\0', NULL }, + { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL }, { "help", '?', 0, NULL, '?', N_("Show this help message") }, { "usage", '\0', 0, NULL, 'u', N_("Display brief usage message") }, { NULL, '\0', 0, NULL, 0 } @@ -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, @@ -237,7 +242,7 @@ static int singleOptionUsage(FILE * f, int cursor, return cursor + len + 1; } -int singleTableUsage(FILE * f, int cursor, const struct poptOption * table, +static int singleTableUsage(FILE * f, int cursor, const struct poptOption * table, const char *translation_domain) { const struct poptOption * opt; @@ -265,7 +270,7 @@ static int showShortOptions(const struct poptOption * opt, FILE * f, if (!str) { str = s; - memset(str, 0, sizeof(str)); + memset(str, 0, sizeof(s)); } while (opt->longName || opt->shortName || opt->arg) { |