Subject: Re: CVS commit: basesrc
To: Lennart Augustsson <lennart@mail.augustsson.net>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: source-changes
Date: 10/10/2000 15:54:49
it was my intent to run this change by you before committing it, but
it was part of a large diff collection which ignatios has been chewing
through and revieweing.
The "right" answer here appears to be to define a "format checking"
function in libc, which verifies that two formats are "compatible"
with respect to what arguments they expect. the function would be
declared to be a format pass-through function (like gettext or catgets).
A number of the more intractable format-checking problems would be
solved by this; libusb could then use that function to check that the
supplied format was compatible with "%s".
usage would look something like:
snprintf(buf, sizeof(buf), fmtcheck(user_supplied_format, "%s%d"),
"string", NUMBER);
synopsys:
char *fmtcheck(const char *f1, const char *f2):
if f1 and f2 are compatible format strings, f1 is be returned;
otherwise f2 is returned.
- Bill