The hack-ish tricks to make the ANSI-style va_start macro work in

non-ANSI mode were not quite complete.  This makes non-ANSI work.
Perhaps it would be better to eliminate this hack altogether...
This commit is contained in:
gwr 1996-10-27 20:30:52 +00:00
parent 9b8d79eeed
commit a0d9bd5bb2
2 changed files with 25 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_prf.c,v 1.33 1996/10/25 22:01:44 cgd Exp $ */
/* $NetBSD: subr_prf.c,v 1.34 1996/10/27 20:30:52 gwr Exp $ */
/*-
* Copyright (c) 1986, 1988, 1991, 1993
@ -62,6 +62,11 @@
* ANSI and traditional C compilers.
*/
#include <machine/stdarg.h>
/* XXX - This is a total hack! */
#ifndef va_alist
#define va_alist __builtin_va_alist
#define va_dcl long va_alist; ...
#endif
#include "ipkdb.h"
@ -536,12 +541,12 @@ int
sprintf(char *buf, const char *cfmt, ...)
#else
sprintf(buf, cfmt, va_alist)
char *buf,
const char *cfmt;
char *buf;
char *cfmt;
va_dcl
#endif
{
register const char *fmt = cfmt;
register __const char *fmt = cfmt;
register char *p, *bp;
register int ch, base;
u_long ul;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_glue.c,v 1.60 1996/10/23 07:20:09 matthias Exp $ */
/* $NetBSD: vm_glue.c,v 1.61 1996/10/27 20:31:48 gwr Exp $ */
/*
* Copyright (c) 1991, 1993
@ -600,30 +600,32 @@ thread_wakeup(event)
int indent = 0;
#include <machine/stdarg.h> /* see subr_prf.c */
/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
* ANSI and traditional C compilers. (Same as subr_prf.c does.)
*/
#include <machine/stdarg.h>
/* XXX - This is a total hack! */
#ifndef va_alist
#define va_alist __builtin_va_alist
#define va_dcl long va_alist; ...
#endif
/*ARGSUSED2*/
void
#if __STDC__
#ifdef __STDC__
iprintf(void (*pr)(const char *, ...), const char *fmt, ...)
#else
iprintf(va_alist)
iprintf(pr, fmt, va_alist)
void (*pr)();
char *fmt;
va_dcl
#endif
{
register int i;
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
void (*pr) __P((const char *, ...));
const char *fmt;
va_start(ap);
pr = va_arg(ap, void (*) __P((const char *, ...)));
fmt = va_arg(ap, const char *);
#endif
for (i = indent; i >= 8; i -= 8)
(*pr)("\t");
while (--i >= 0)