michael@0: #ifndef HAVE_SNPRINTF michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #ifdef HAVE_SYS_CDEFS_H michael@0: #include michael@0: #else michael@0: #include "cdefs.h" michael@0: #endif michael@0: michael@0: #include "prtypes.h" michael@0: michael@0: #include michael@0: michael@0: #ifdef __STDC__ michael@0: #include michael@0: #else michael@0: #include michael@0: #endif michael@0: michael@0: int michael@0: #ifdef __STDC__ michael@0: snprintf(char *str, size_t n, const char *fmt, ...) michael@0: #else michael@0: snprintf(str, n, fmt, va_alist) michael@0: char *str; michael@0: size_t n; michael@0: const char *fmt; michael@0: va_dcl michael@0: #endif michael@0: { michael@0: va_list ap; michael@0: #ifdef VSPRINTF_CHARSTAR michael@0: char *rp; michael@0: #else michael@0: int rval; michael@0: #endif michael@0: #ifdef __STDC__ michael@0: va_start(ap, fmt); michael@0: #else michael@0: va_start(ap); michael@0: #endif michael@0: #ifdef VSPRINTF_CHARSTAR michael@0: rp = vsprintf(str, fmt, ap); michael@0: va_end(ap); michael@0: return (strlen(rp)); michael@0: #else michael@0: rval = vsprintf(str, fmt, ap); michael@0: va_end(ap); michael@0: return (rval); michael@0: #endif michael@0: } michael@0: michael@0: int michael@0: vsnprintf(str, n, fmt, ap) michael@0: char *str; michael@0: size_t n; michael@0: const char *fmt; michael@0: va_list ap; michael@0: { michael@0: #ifdef VSPRINTF_CHARSTAR michael@0: return (strlen(vsprintf(str, fmt, ap))); michael@0: #else michael@0: return (vsprintf(str, fmt, ap)); michael@0: #endif michael@0: } michael@0: michael@0: #endif /* HAVE_SNPRINTF */ michael@0: michael@0: /* Some compilers don't like an empty source file. */ michael@0: static int dummy = 0;