Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: net.lang.c Subject: Re: Another printf-type question Message-ID: <463@mcgill-vision.UUCP> Date: Mon, 21-Jul-86 22:27:44 EDT Article-I.D.: mcgill-v.463 Posted: Mon Jul 21 22:27:44 1986 Date-Received: Mon, 28-Jul-86 05:03:36 EDT References: <2138@brl-smoke.ARPA> <2153@brl-smoke.ARPA> Organization: McGill University, Montreal Lines: 52 >> invprintf(fmt,args) >> { >> printf(); >> printf(fmt,args); >> printf(); >> } > 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(); printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8); printf(); } 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@uw-beaver.arpa "Come with me a few minutes, mortal, and we shall talk."