1 /* $NetBSD: print_p.h,v 1.4 2014/12/10 04:38:02 christos Exp $ */
4 * Copyright (C) 2004, 2007, 2010 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: print_p.h,v 1.6 2010/08/16 23:46:52 tbox Exp */
22 #ifndef LWRES_PRINT_P_H
23 #define LWRES_PRINT_P_H 1
29 #include <lwres/lang.h>
30 #include <lwres/platform.h>
33 * This block allows lib/lwres/print.c to be cleanly compiled even if
34 * the platform does not need it. The standard Makefile will still
35 * not compile print.c or archive print.o, so this is just to make test
36 * compilation ("make print.o") easier.
38 #if !defined(LWRES_PLATFORM_NEEDVSNPRINTF) && defined(LWRES__PRINT_SOURCE)
39 #define LWRES_PLATFORM_NEEDVSNPRINTF
42 #if !defined(LWRES_PLATFORM_NEEDSPRINTF) && defined(LWRES__PRINT_SOURCE)
43 #define LWRES_PLATFORM_NEEDSPRINTF
51 #define LWRES_FORMAT_PRINTF(fmt, args) \
52 __attribute__((__format__(__printf__, fmt, args)))
54 #define LWRES_FORMAT_PRINTF(fmt, args)
61 #ifdef LWRES_PLATFORM_NEEDVSNPRINTF
68 #ifdef LWRES_PLATFORM_NEEDVSNPRINTF
70 lwres__print_vsnprintf(char *str
, size_t size
, const char *format
, va_list ap
)
71 LWRES_FORMAT_PRINTF(3, 0);
75 #define vsnprintf lwres__print_vsnprintf
78 lwres__print_snprintf(char *str
, size_t size
, const char *format
, ...)
79 LWRES_FORMAT_PRINTF(3, 4);
83 #define snprintf lwres__print_snprintf
84 #endif /* LWRES_PLATFORM_NEEDVSNPRINTF */
86 #ifdef LWRES_PLATFORM_NEEDSPRINTF
88 lwres__print_sprintf(char *str
, const char *format
, ...) LWRES_FORMAT_PRINTF(2, 3);
92 #define sprintf lwres__print_sprintf
97 #endif /* LWRES_PRINT_P_H */