[Toybox] [CLEANUP] More thoughts on stat.c cleanup.

Rob Landley rob at landley.net
Wed Jun 5 21:33:05 PDT 2013


Catching up on email...

On 05/31/2013 04:37:16 PM, Felix Janda wrote:
> > What I really want is some variant of vprintf() that can start  
> reading
> > values from a pointer location instead of a va_list. Unfortunately,
> > libc hasn't got one. Nor has it got "I passed you a pointer,
> > dereference it" notation from the actual printf logic that knows the
> > size of the data type...
> 
> Hmm, I should have mentioned that I also had an idea along that line  
> and
> would also be happy if there was such a variant of vprintf(). On some
> systems va_list should actually be implemented in that way.

Alas, I've got to use what's in libc. I can do a bit of fiddling like  
error_msg()/verror_msg() but reimplementing large swaths of libc does  
not say 'simple' to me. Nor does relying heavily on nonstandard  
extensions.

> I didn't really check the format strings for correctness. It seemed  
> like
> it would get a headache to get them right on all architectures.

This is what a good test suite is for, combined with Aboriginal Linux  
system images. Once I get things implemented and the test suite to  
complete coverage, I can run it on emulated 32 bit and 64 bit systems,  
big endian and little endian, and ones that care about alignment...

Probably the best way to make sure it works on all these systems is to  
try all the relevant functionality on those systems.

> > Right. Looks like I have to hit it with a typecast, _and_ I might  
> have
> > to check the other types to see if they match up with what printf
> > expects...
> >
> > Lemme get back to this one. :)
> 
> It sounds like great fun.

I finished my stat cleanup and moved it to toys/posix. Anything still  
wrong with it is news to me. (Probably lots, but I didn't find it.)

Rob


More information about the Toybox mailing list