4 * Poor substitute for a real vsnprintf() function for systems
5 * that don't have them...
17 #define BUFFER_SIZE 65536 /* Bigger than any string we might print... */
19 static char snprintf_buffer
[BUFFER_SIZE
];
21 int vsnprintf(char *str
, size_t size
, const char *format
, va_list ap
)
25 if (size
> BUFFER_SIZE
) {
26 nasm_panic(ERR_NOFILE
,
27 "vsnprintf: size (%d) > BUFFER_SIZE (%d)",
32 rv
= vsprintf(snprintf_buffer
, format
, ap
);
33 if (rv
>= BUFFER_SIZE
)
34 nasm_panic(ERR_NOFILE
, "vsnprintf buffer overflow");
37 if ((size_t)rv
< size
-1)
41 memcpy(str
, snprintf_buffer
, bytes
);