Fix how keywords are picked up.
[nvi.git] / clib / snprintf.c
blob935522ce54362c0c755be695bf995efec7917a33
1 #include "config.h"
3 #include <sys/types.h>
5 #include <stdio.h>
7 #ifdef __STDC__
8 #include <stdarg.h>
9 #else
10 #include <varargs.h>
11 #endif
14 * PUBLIC: #ifndef HAVE_SNPRINTF
15 * PUBLIC: int snprintf __P((char *, size_t, const char *, ...));
16 * PUBLIC: #endif
18 int
19 #ifdef __STDC__
20 snprintf(char *str, size_t n, const char *fmt, ...)
21 #else
22 snprintf(str, n, fmt, va_alist)
23 char *str;
24 size_t n;
25 const char *fmt;
26 va_dcl
27 #endif
29 va_list ap;
30 int rval;
31 #ifdef __STDC__
32 va_start(ap, fmt);
33 #else
34 va_start(ap);
35 #endif
36 #ifdef SPRINTF_RET_CHARPNT
37 (void)vsprintf(str, fmt, ap);
38 va_end(ap);
39 return (strlen(str));
40 #else
41 rval = vsprintf(str, fmt, ap);
42 va_end(ap);
43 return (rval);
44 #endif