1118e757roberto/*
2d54cfbdroberto * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3d54cfbdroberto * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
4118e757roberto *
5d54cfbdroberto * Permission to use, copy, modify, and/or distribute this software for any
6118e757roberto * purpose with or without fee is hereby granted, provided that the above
7118e757roberto * copyright notice and this permission notice appear in all copies.
8118e757roberto *
9d54cfbdroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10d54cfbdroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11d54cfbdroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12d54cfbdroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13d54cfbdroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14d54cfbdroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15d54cfbdroberto * PERFORMANCE OF THIS SOFTWARE.
16118e757roberto */
17118e757roberto
18d54cfbdroberto/* $Id: print.h,v 1.26 2007/06/19 23:47:18 tbox Exp $ */
19118e757roberto
20118e757roberto#ifndef ISC_PRINT_H
21118e757roberto#define ISC_PRINT_H 1
22118e757roberto
23d54cfbdroberto/*! \file isc/print.h */
24d54cfbdroberto
25118e757roberto/***
26118e757roberto *** Imports
27118e757roberto ***/
28118e757roberto
29118e757roberto#include <isc/formatcheck.h>    /* Required for ISC_FORMAT_PRINTF() macro. */
30118e757roberto#include <isc/lang.h>
31118e757roberto#include <isc/platform.h>
32118e757roberto
33d54cfbdroberto/*!
34118e757roberto * This block allows lib/isc/print.c to be cleanly compiled even if
35118e757roberto * the platform does not need it.  The standard Makefile will still
36118e757roberto * not compile print.c or archive print.o, so this is just to make test
37118e757roberto * compilation ("make print.o") easier.
38118e757roberto */
39118e757roberto#if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE)
40118e757roberto#define ISC_PLATFORM_NEEDVSNPRINTF
41118e757roberto#endif
42118e757roberto
43d54cfbdroberto#if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE)
44d54cfbdroberto#define ISC_PLATFORM_NEEDSPRINTF
45d54cfbdroberto#endif
46d54cfbdroberto
47118e757roberto/***
48118e757roberto *** Macros
49118e757roberto ***/
50118e757roberto#define ISC_PRINT_QUADFORMAT ISC_PLATFORM_QUADFORMAT
51118e757roberto
52118e757roberto/***
53118e757roberto *** Functions
54118e757roberto ***/
55118e757roberto
56118e757roberto#ifdef ISC_PLATFORM_NEEDVSNPRINTF
57118e757roberto#include <stdarg.h>
58118e757roberto#include <stddef.h>
59d54cfbdroberto#endif
60d54cfbdroberto#ifdef ISC_PLATFORM_NEEDSPRINTF
61d54cfbdroberto#include <stdio.h>
62d54cfbdroberto#endif
63d54cfbdroberto
64118e757roberto
65118e757robertoISC_LANG_BEGINDECLS
66118e757roberto
67d54cfbdroberto#ifdef ISC_PLATFORM_NEEDVSNPRINTF
68118e757robertoint
69118e757robertoisc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
70118e757roberto     ISC_FORMAT_PRINTF(3, 0);
71118e757roberto#define vsnprintf isc_print_vsnprintf
72118e757roberto
73118e757robertoint
74118e757robertoisc_print_snprintf(char *str, size_t size, const char *format, ...)
75118e757roberto     ISC_FORMAT_PRINTF(3, 4);
76118e757roberto#define snprintf isc_print_snprintf
77d54cfbdroberto#endif /* ISC_PLATFORM_NEEDVSNPRINTF */
78d54cfbdroberto
79d54cfbdroberto#ifdef ISC_PLATFORM_NEEDSPRINTF
80d54cfbdrobertoint
81d54cfbdrobertoisc_print_sprintf(char *str, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
82d54cfbdroberto#define sprintf isc_print_sprintf
83d54cfbdroberto#endif
84118e757roberto
85118e757robertoISC_LANG_ENDDECLS
86118e757roberto
87118e757roberto#endif /* ISC_PRINT_H */
88