Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / nvi / clib / snprintf.c
blob4756fb25540d6bcb56422d8b294ff9fe4a1962aa
1 /* $NetBSD$ */
3 #include "config.h"
5 #include <sys/types.h>
7 #include <stdio.h>
9 #ifdef __STDC__
10 #include <stdarg.h>
11 #else
12 #include <varargs.h>
13 #endif
16 * PUBLIC: #ifndef HAVE_SNPRINTF
17 * PUBLIC: int snprintf __P((char *, size_t, const char *, ...));
18 * PUBLIC: #endif
20 int
21 #ifdef __STDC__
22 snprintf(char *str, size_t n, const char *fmt, ...)
23 #else
24 snprintf(str, n, fmt, va_alist)
25 char *str;
26 size_t n;
27 const char *fmt;
28 va_dcl
29 #endif
31 va_list ap;
32 int rval;
33 #ifdef __STDC__
34 va_start(ap, fmt);
35 #else
36 va_start(ap);
37 #endif
38 #ifdef SPRINTF_RET_CHARPNT
39 (void)vsprintf(str, fmt, ap);
40 va_end(ap);
41 return (strlen(str));
42 #else
43 rval = vsprintf(str, fmt, ap);
44 va_end(ap);
45 return (rval);
46 #endif