Another printf-type question
der Mouse
mouse at mcgill-vision.UUCP
Tue Jul 22 12:27:44 AEST 1986
>> invprintf(fmt,args)
>> {
>> printf(<string to go into inverse video mode>);
>> printf(fmt,args);
>> printf(<string to leave inverse mode>);
>> }
> Assuming you're using UNIX System V Release 2.0 for sake of concreteness,
> [...solution involving....
> (void)vprintf( fmt, args ); /* warning! not printf(va_arg etc. */
> ]
Sounds to me more like assuming SVR2 for the sake of possibility. Many
Unices do not have vprintf(), much though AT&T may wish it otherwise.
Absent some indication of what flavor of UNIX the solution is desired
for, an "answer" using vprintf() not much of an answer. I doubt that
the original poster is prepared to change operating systems just to get
a portable version of invprintf().
By the way, when I need something like this I write it as follows:
/* VARARGS 1 */
invprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8)
char *fmt;
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
{
printf(<inverse-video-string>);
printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8);
printf(<exit-inverse-video-string>);
}
Anyone out there care to enlighten me as to all the ways in which this
can fail (besides wanting to print more than eight arguments)? It works
on enough machines that I don't feel *too* guilty using it. I would
guess that it works on substantially more machines than the vprintf()
solution.
--
der Mouse
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
philabs!micomvax!musocs!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
mcvax!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse
ARPAnet: utcsri!mcgill-vision!mouse at uw-beaver.arpa
"Come with me a few minutes, mortal, and we shall talk."
More information about the Comp.lang.c
mailing list