Need help on VARARGS and RCS

Chris Torek chris at umcp-cs.UUCP
Fri Apr 18 05:54:40 AEST 1986


In article <198 at butler.UUCP> chinn at butler.UUCP (David Chinn) writes:
>We have a copy of RCS [which] core dumps when you do a  'ci f.c'.
>[...] the coredump occurs during a routine called "diagnose",
>[which] looks like:
>
>diagnose(va_alist)
>va_dcl
>{
>        if (!quietflag) {
>                fprintf(stderr,va_alist);
>                putc('\n',stderr);
>        }
>}
>
>The question is, how is this supposed to work? I found a mention
>of 'va_alist' under varargs, but the usage example grabs the 
>arguments in the called routine.

Passing the list to fprintf (or printf) is incorrect usage.  In
System V, there is a `vfprintf', which does indeed take a variable
argument list.

>We are running ULTRIX 1.0 on a VAX-11/750.

On a Vax running 4.2BSD-equivalent code (Ultrix) the following
version of `diagnose' will work.  Please note that this is *not*
portable.

diagnose(fmt, arg)
	char *fmt;
{

	if (!quietflag) {
		_doprnt(fmt, &arg, stderr);	/* magic */
		(void) putc('\n', stderr);
	}
}
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list