[PATCH] stdio: Add %m

Rob Landley rob at landley.net
Tue Jun 20 18:09:47 UTC 2006


On Tuesday 20 June 2006 1:49 pm, Rich Felker wrote:
> > > Likewise I could consider adding code to silently ignore %m or print
> > > %m as "Error number %d", errno.. but I think it's an ugly hack to
> > > cater to broken code that's calling a standard C function in a
> > > nonstandard way and ignoring the fact that the behavior is undefined.
> >
> > I don't care.
>
> Would you object to replacing %m by a macro that would expand to
> either "%m" or some generic text depending on platform.h? I doubt my
> system is the only one without %m.

The difference between bb_error_msg() and bb_perror_msg() is that the p 
version appends the equivalent of ": %m" to its output, except it uses 
strerror() (see libbb/vperror_msg.c for the implementation).  So if you can 
shoehorn various error messages to use our libbb macros instead of trying to 
do the strerror() themselves, that'll take care of at least some of the 
problem.

And uClibc can be configured without %m, so I agree it's a good goal.  It's 
just not something worth making the code uglier for.  Come up with a clean 
solution and I'm much more interested...

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list