CARMA C++
slprintf.h
1 #ifndef slprintf_h
2 #define slprintf_h
3 
4 #include <stddef.h>
5 #include <stdarg.h>
6 
7 /*-----------------------------------------------------------------------
8  * This modules provides the slprintf and vslprintf functions. These
9  * are designed to act like the currently non-standard snprintf()
10  * and vsnprintf(). The latter functions will be part of the
11  * next C standard, but are not currently available in some OS's
12  * (including Solaris).
13  *-----------------------------------------------------------------------*/
14 
15 /*
16  * When this header is compiled with gcc, the following macro
17  * is expanded at the end of the prototype of lprintf. The
18  * result informs gcc that the format and trailing arguments should
19  * be checked as though the function were printf().
20  */
21 #undef CHECK_FORMAT
22 #ifdef __GNUC__
23 #define CHECK_FORMAT __attribute__ ((format (printf, 3, 4)))
24 #else
25 #define CHECK_FORMAT
26 #endif
27 
28 int slprintf(char *s, size_t n, const char *format, ...) CHECK_FORMAT;
29 int vslprintf(char *s, size_t n, const char *format, va_list ap);
30 
31 #endif