tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Fwd: Re: fmtcheck() query
On 2017/12/14 0:06, Valery Ushakov wrote:
Christos Zoulas <christos%zoulas.com@localhost> wrote:
| Yes, I'm so sorry for this breakage of file(1). It clearly indicates
| possible risks of changing the behavior of fmtcheck(3).
Thank you very much. I think that adding a new function is preferrable
in this case because we are adding significant new functionality (by the
positional arguments handling). We should leave the old fmtcheck(3) alone
(so that existing code does not break) and just document its deficiencies
and say to use fmtmatch(3) instead.
If the new function provides a flag that controls whether unused
trailing ares are ok, then fmtcheck() can be just a trivial wrapper.
I agree with this. fmtcheck(3) can be something like
const char *
fmtcheck(const char *s1, const char *s2)
{
return fmtmatch(s1, s2, 0);
}
One thing I sort of never figured out properly is convenient error
reporting. My current code uses a fixed-size buffer in the
user-supplied struct, but asprintf(3) may be a better option.
I think error messages are important here, as visually matching the
rejected format and the template is a pain and is kidna stupid anwyay
since the function already knows exactly what's wrong.
Sure, I'll try to implement it :-).
rin
Home |
Main Index |
Thread Index |
Old Index