1258945Sroberto/*
2258945Sroberto * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3258945Sroberto * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
4258945Sroberto *
5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any
6258945Sroberto * purpose with or without fee is hereby granted, provided that the above
7258945Sroberto * copyright notice and this permission notice appear in all copies.
8258945Sroberto *
9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11258945Sroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15258945Sroberto * PERFORMANCE OF THIS SOFTWARE.
16258945Sroberto */
17258945Sroberto
18258945Sroberto/* $Id: print.h,v 1.26 2007/06/19 23:47:18 tbox Exp $ */
19258945Sroberto
20258945Sroberto#ifndef ISC_PRINT_H
21258945Sroberto#define ISC_PRINT_H 1
22258945Sroberto
23258945Sroberto/*! \file isc/print.h */
24258945Sroberto
25258945Sroberto/***
26258945Sroberto *** Imports
27258945Sroberto ***/
28258945Sroberto
29258945Sroberto#include <isc/formatcheck.h>    /* Required for ISC_FORMAT_PRINTF() macro. */
30258945Sroberto#include <isc/lang.h>
31258945Sroberto#include <isc/platform.h>
32258945Sroberto
33258945Sroberto/*!
34258945Sroberto * This block allows lib/isc/print.c to be cleanly compiled even if
35258945Sroberto * the platform does not need it.  The standard Makefile will still
36258945Sroberto * not compile print.c or archive print.o, so this is just to make test
37258945Sroberto * compilation ("make print.o") easier.
38258945Sroberto */
39258945Sroberto#if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE)
40258945Sroberto#define ISC_PLATFORM_NEEDVSNPRINTF
41258945Sroberto#endif
42258945Sroberto
43258945Sroberto#if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE)
44258945Sroberto#define ISC_PLATFORM_NEEDSPRINTF
45258945Sroberto#endif
46258945Sroberto
47258945Sroberto/***
48258945Sroberto *** Macros
49258945Sroberto ***/
50258945Sroberto#define ISC_PRINT_QUADFORMAT ISC_PLATFORM_QUADFORMAT
51258945Sroberto
52258945Sroberto/***
53258945Sroberto *** Functions
54258945Sroberto ***/
55258945Sroberto
56258945Sroberto#ifdef ISC_PLATFORM_NEEDVSNPRINTF
57258945Sroberto#include <stdarg.h>
58258945Sroberto#include <stddef.h>
59258945Sroberto#endif
60258945Sroberto#ifdef ISC_PLATFORM_NEEDSPRINTF
61258945Sroberto#include <stdio.h>
62258945Sroberto#endif
63258945Sroberto
64258945Sroberto
65258945SrobertoISC_LANG_BEGINDECLS
66258945Sroberto
67258945Sroberto#ifdef ISC_PLATFORM_NEEDVSNPRINTF
68258945Srobertoint
69258945Srobertoisc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
70258945Sroberto     ISC_FORMAT_PRINTF(3, 0);
71258945Sroberto#define vsnprintf isc_print_vsnprintf
72258945Sroberto
73258945Srobertoint
74258945Srobertoisc_print_snprintf(char *str, size_t size, const char *format, ...)
75258945Sroberto     ISC_FORMAT_PRINTF(3, 4);
76258945Sroberto#define snprintf isc_print_snprintf
77258945Sroberto#endif /* ISC_PLATFORM_NEEDVSNPRINTF */
78258945Sroberto
79258945Sroberto#ifdef ISC_PLATFORM_NEEDSPRINTF
80258945Srobertoint
81258945Srobertoisc_print_sprintf(char *str, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
82258945Sroberto#define sprintf isc_print_sprintf
83258945Sroberto#endif
84258945Sroberto
85258945SrobertoISC_LANG_ENDDECLS
86258945Sroberto
87258945Sroberto#endif /* ISC_PRINT_H */
88