]>
The Tcpdump Group git mirrors - libpcap/blob - missing/win_snprintf.c
f42240352920b380add9ef2c740d9c2b0ffc13b9
4 #include "portability.h"
7 pcap_vsnprintf(char *str
, size_t str_size
, const char *format
, va_list args
)
11 ret
= _vsnprintf_s(str
, str_size
, _TRUNCATE
, format
, args
);
14 * XXX - _vsnprintf() and _snprintf() do *not* guarantee
15 * that str is null-terminated, but C99's vsnprintf()
16 * and snprintf() do, and we want to offer C99 behavior,
17 * so forcibly null-terminate the string.
19 * We don't, however, offer C99 behavior for the return
20 * value; _vsnprintf_s() returns -1, not the number of
21 * characters that would have been put into the buffer
22 * had it been large enough, if the string is truncated.
23 * The only way to get that value is to use _vscprintf();
24 * getting that count isn't worth the re-formatting.
26 * XXX - does _vsnprintf_s() return -1 on a formatting
29 str
[str_size
- 1] = '\0';
34 pcap_snprintf(char *str
, size_t str_size
, const char *format
, ...)
39 va_start(args
, format
);
40 ret
= pcap_vsnprintf(str
, str_size
, format
, args
);