From: Denys Vlasenko > Sent: 25 February 2024 00:06 > > I think we can simply stop the truncation, like this: > > - column += printf("%-8.8s %-8.8s ", > + column += printf("%-8s %-8s ", > > without additional loop to measure max length.
That code isn't safe with a standard libc. If printf() actually does a write() for any reason and the write fails then printf() returns -1 not the length. If you want to check for error (eg disk full) then checking the return value of printf() is also fairly pointless. You really need to call fflush() and then ferror(). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox