snprintf_2.2/snprintf.h

changeset 35
5a71d53d0228
equal deleted inserted replaced
34:828f3afd5c76 35:5a71d53d0228
1 #ifndef _PORTABLE_SNPRINTF_H_
2 #define _PORTABLE_SNPRINTF_H_
3
4 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2
5 #define PORTABLE_SNPRINTF_VERSION_MINOR 2
6
7 #ifdef HAVE_SNPRINTF
8 #include <stdio.h>
9 #else
10 extern int snprintf(char *, size_t, const char *, /*args*/ ...);
11 extern int vsnprintf(char *, size_t, const char *, va_list);
12 #endif
13
14 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
15 extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
16 extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
17 #define snprintf portable_snprintf
18 #define vsnprintf portable_vsnprintf
19 #endif
20
21 extern int asprintf (char **ptr, const char *fmt, /*args*/ ...);
22 extern int vasprintf (char **ptr, const char *fmt, va_list ap);
23 extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
24 extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
25
26 #endif

mercurial