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_malloc_error(ERR_PANIC
|ERR_NOFILE
,
27 "snprintf: size (%d) > BUFFER_SIZE (%d)",
32 rv
= vsprintf(snprintf_buffer
, format
, ap
);
33 if (rv
>= BUFFER_SIZE
) {
34 nasm_malloc_error(ERR_PANIC
|ERR_NOFILE
,
35 "snprintf buffer overflow");
39 if ((size_t)rv
< size
-1)
44 memcpy(str
, snprintf_buffer
, bytes
);