fmtcheck.c
fmtcheck.c
- Subject: fmtcheck.c
- From: Steve Checkoway <email@hidden>
- Date: Fri, 1 Jul 2005 17:50:58 -0700
I was using fmtcheck(3) in some code and I noticed that it choked on
any format specifier that includes positional arguments (for lack of
a better term).
For example,
const char *f1 = "%2$d %1$d";
const char *f2 = "%d %d";
printf(fmtcheck(f1, f2), 1, 2);
will print "1 2" since fmtcheck() cannot tell that they consume the
same arguments.
It also contains a few bugs such as considering %f and %lf to be
different. In fact, it doesn't even recognize %lf.
This was unacceptable, so I wrote my own based (loosely) upon the
fmtcheck.c used in NetBSD written by Allen Briggs in 2000. (This
appears to be the same version used in Darwin.)
If anyone would care to take a look at what I wrote, the file is
http://www.cs.washington.edu/homes/steve/fmtcheck.c
I note in the fmtcheck(3) man page, under BUGS, it says, "The fmtcheck
() function does not understand all of the conversions that printf(3)
does." I'm not 100% positive yet, but I think that mine does.
Would it be worth filing a bug report with Apple about this?
Here is a (far from exhaustive) test file:
http://www.cs.washington.edu/homes/steve/fcheck.c
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden