- fix: short option help missing string terminator.

CVS patchset: 6704
CVS date: 2003/03/18 17:48:19
This commit is contained in:
jbj 2003-03-18 17:48:19 +00:00
parent 5fe1914a15
commit d2a425e015
3 changed files with 15 additions and 16 deletions

View File

@ -2,6 +2,8 @@
- upgrade to zlib-1.2.beta7.
- pass structure pointer, not args, through headerSprintf call chain.
- add ":xml" header format modifier.
- --queryformat '[%%{*:xml}\n]' to dump header content in XML.
- fix: short option help missing string terminator.
4.1 -> 4.2:
- set cachesize without a dbenv, the default is far too small.

View File

@ -677,33 +677,29 @@ static int showShortOptions(const struct poptOption * opt, FILE * fp,
/*@null@*/ char * str)
/*@globals fileSystem @*/
/*@modifies *str, *fp, fileSystem @*/
/*@requires maxRead(str) >= 0 @*/
{
char * s = alloca(300); /* larger then the ascii set */
s[0] = '\0';
/*@-branchstate@*/ /* FIX: W2DO? */
if (str == NULL) {
memset(s, 0, sizeof(s));
str = s;
}
/*@=branchstate@*/
/* bufsize larger then the ascii set, lazy alloca on top level call. */
char * s = (str != NULL ? str : memset(alloca(300), 0, 300));
int len = 0;
/*@-boundswrite@*/
if (opt != NULL)
for (; (opt->longName || opt->shortName || opt->arg); opt++) {
if (opt->shortName && !(opt->argInfo & POPT_ARG_MASK))
str[strlen(str)] = opt->shortName;
s[strlen(s)] = opt->shortName;
else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE)
if (opt->arg) /* XXX program error */
(void) showShortOptions(opt->arg, fp, str);
len = showShortOptions(opt->arg, fp, s);
}
/*@=boundswrite@*/
if (s != str || *s != '\0')
return 0;
fprintf(fp, " [-%s]", s);
return strlen(s) + 4;
/* On return to top level, print the short options, return print length. */
if (s == str && *s != '\0') {
fprintf(fp, " [-%s]", s);
len = strlen(s) + sizeof(" [-]")-1;
}
return len;
}
void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ int flags)

View File

@ -475,3 +475,4 @@ exit 0
- pass structure pointer, not args, through headerSprintf call chain.
- add ":xml" tag format modifier.
- --queryformat '[%%{*:xml}\n]' to dump header content in XML.
- fix: short option help missing string terminator.