Simon, you need to type: man 3 printf to read about printf() the C function.
Argh! Indeed I was reading the wrong manpage. That probably means almost everything I've concluded and said was wrong :/ Apparently, throwing your two cents in can reduce the total value of a discussion.
According to the page you cite, printf and fprintf "shall return the number of bytes transmitted". When Olivier first suggested this, my original thought was the same as yours because I remembered the huge mess in the VAX days with sprintf (does it return int or char *?), but I've looked at lots of man pages (including ancient ones) and can't find anything that says anything else about the return of printf.
Perhaps that's just cargo cult portability talking then...
> Or just add a call to _set_printf_count_output in the relevant > place, since AFAIK %n is still a standard-mandated printf format > flag. Where is the "relevant place"? This would be a really messy host-dependent call and I think it far better to eliminate the usage in *some* way than to do this.
Perhaps it could be something for libiberty to take care of?