This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
support for %m format argument to printf?
- From: Jeremy Elson <jelson at cs dot ucla dot edu>
- To: newlib at sources dot redhat dot com
- Date: Thu, 28 Oct 2004 17:48:58 -0700
- Subject: support for %m format argument to printf?
Hi,
Gnu C allows you to specify "%m" in printf format strings; newlib
doesn't. Is there any plan to add support? If not, I can work on a
patch.
If you're not familiar with it -- Gnu C lets you substitute %m for
strerror(errno). It's similar to using perror(), except that you can
construct more meaningful error messages, e.g.:
printf("couldn't open %s: %m", filename);
I'm porting software that extensively uses this idiom to newlib.
Regards,
Jeremy