Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #ifndef HAVE_SNPRINTF |
michael@0 | 2 | |
michael@0 | 3 | #include <sys/types.h> |
michael@0 | 4 | #include <stddef.h> |
michael@0 | 5 | #include <stdio.h> |
michael@0 | 6 | |
michael@0 | 7 | #ifdef HAVE_SYS_CDEFS_H |
michael@0 | 8 | #include <sys/cdefs.h> |
michael@0 | 9 | #else |
michael@0 | 10 | #include "cdefs.h" |
michael@0 | 11 | #endif |
michael@0 | 12 | |
michael@0 | 13 | #include "prtypes.h" |
michael@0 | 14 | |
michael@0 | 15 | #include <ncompat.h> |
michael@0 | 16 | |
michael@0 | 17 | #ifdef __STDC__ |
michael@0 | 18 | #include <stdarg.h> |
michael@0 | 19 | #else |
michael@0 | 20 | #include <varargs.h> |
michael@0 | 21 | #endif |
michael@0 | 22 | |
michael@0 | 23 | int |
michael@0 | 24 | #ifdef __STDC__ |
michael@0 | 25 | snprintf(char *str, size_t n, const char *fmt, ...) |
michael@0 | 26 | #else |
michael@0 | 27 | snprintf(str, n, fmt, va_alist) |
michael@0 | 28 | char *str; |
michael@0 | 29 | size_t n; |
michael@0 | 30 | const char *fmt; |
michael@0 | 31 | va_dcl |
michael@0 | 32 | #endif |
michael@0 | 33 | { |
michael@0 | 34 | va_list ap; |
michael@0 | 35 | #ifdef VSPRINTF_CHARSTAR |
michael@0 | 36 | char *rp; |
michael@0 | 37 | #else |
michael@0 | 38 | int rval; |
michael@0 | 39 | #endif |
michael@0 | 40 | #ifdef __STDC__ |
michael@0 | 41 | va_start(ap, fmt); |
michael@0 | 42 | #else |
michael@0 | 43 | va_start(ap); |
michael@0 | 44 | #endif |
michael@0 | 45 | #ifdef VSPRINTF_CHARSTAR |
michael@0 | 46 | rp = vsprintf(str, fmt, ap); |
michael@0 | 47 | va_end(ap); |
michael@0 | 48 | return (strlen(rp)); |
michael@0 | 49 | #else |
michael@0 | 50 | rval = vsprintf(str, fmt, ap); |
michael@0 | 51 | va_end(ap); |
michael@0 | 52 | return (rval); |
michael@0 | 53 | #endif |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | int |
michael@0 | 57 | vsnprintf(str, n, fmt, ap) |
michael@0 | 58 | char *str; |
michael@0 | 59 | size_t n; |
michael@0 | 60 | const char *fmt; |
michael@0 | 61 | va_list ap; |
michael@0 | 62 | { |
michael@0 | 63 | #ifdef VSPRINTF_CHARSTAR |
michael@0 | 64 | return (strlen(vsprintf(str, fmt, ap))); |
michael@0 | 65 | #else |
michael@0 | 66 | return (vsprintf(str, fmt, ap)); |
michael@0 | 67 | #endif |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | #endif /* HAVE_SNPRINTF */ |
michael@0 | 71 | |
michael@0 | 72 | /* Some compilers don't like an empty source file. */ |
michael@0 | 73 | static int dummy = 0; |