1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
$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;
}
|