Limited-length variant of
vsprintf() for Q3VM.
Original bg_lib.c lacks
vsnprintf() (and thus a
This patch also includes the hexadecimal printing patch.
An exchange on IRC prompted me to make a
vsnprintf() targeted for Q3VM.
snprintf(char *buf, size_t size, const char *fmt, ...);
vsnprintf(char *buf, size_t size, const char *fmt, va_list argptr);
The return value is the number of characters needed in
buf (C99 semantics).
This either reflects the number of characters actually written (if enough space was available) or the total number of charaters needed to completely write out the formatted string (if not enough space).
No additional functional limitations added to those already existent in bg_lib.c's
Maybe this should be called
Q_snprintf() or a
Com_snprintf() as well?
AddString() are modified to accept an extra parameter, based on `
size' passed to
vsnprintf() is basically just a modified variant of the extant
vsprintf() is still in there,
#ifdef'd out, but won't work, as the supporting routines
AddString() have been modified to take an additional parameter.
vsprintf() is just a wrapper around
vsnprintf() with `
There's probably room for optimization, but oh well.