pkgsrc/shells/es/patches/patch-ag
joerg 1aea045b09 Fix build on amd64. I'm taking the aggressive approach of using va_copy
here, the #if can be easily modified for those platforms missing it.
2008-09-19 20:02:23 +00:00

47 lines
999 B
Text

$NetBSD: patch-ag,v 1.2 2008/09/19 20:02:23 joerg Exp $
--- print.c.orig 1995-05-30 13:13:51.000000000 +0200
+++ print.c
@@ -3,6 +3,8 @@
#include "es.h"
#include "print.h"
+#include <stdarg.h>
+
#define MAXCONV 256
/*
@@ -90,7 +92,7 @@ static void intconv(Format *format, unsi
if (flags & FMT_long)
n = va_arg(format->args, long);
else if (flags & FMT_short)
- n = va_arg(format->args, short);
+ n = va_arg(format->args, int);
else
n = va_arg(format->args, int);
@@ -267,12 +269,23 @@ extern int printfmt(Format *format, cons
extern int fmtprint VARARGS2(Format *, format, const char *, fmt) {
int n = -format->flushed;
- va_list saveargs = format->args;
+ va_list saveargs;
+
+#if 1
+ va_copy(saveargs, format->args);
+#else
+ saveargs = format->args;
+#endif
VA_START(format->args, fmt);
n += printfmt(format, fmt);
va_end(format->args);
+
+#if 1
+ va_copy(format->args, saveargs);
+#else
format->args = saveargs;
+#endif
return n + format->flushed;
}