print.h 2.38 KB
Newer Older
1
/*
Mark Andrews's avatar
Mark Andrews committed
2
 * Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
3
 * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
4
 *
5 6 7
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
8
 *
Mark Andrews's avatar
Mark Andrews committed
9 10 11 12 13 14 15
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
16 17
 */

18
/* $Id: print.h,v 1.22 2005/06/08 02:07:00 marka Exp $ */
David Lawrence's avatar
David Lawrence committed
19

20
#ifndef ISC_PRINT_H
21
#define ISC_PRINT_H 1
22

23 24
/*! \file */

25 26 27 28
/***
 *** Imports
 ***/

29
#include <isc/formatcheck.h>    /* Required for ISC_FORMAT_PRINTF() macro. */
30
#include <isc/lang.h>
31
#include <isc/platform.h>
32

33
/*!
34 35 36 37 38
 * This block allows lib/isc/print.c to be cleanly compiled even if
 * the platform does not need it.  The standard Makefile will still
 * not compile print.c or archive print.o, so this is just to make test
 * compilation ("make print.o") easier.
 */
39
#if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE)
40 41 42
#define ISC_PLATFORM_NEEDVSNPRINTF
#endif

43 44 45 46
#if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE)
#define ISC_PLATFORM_NEEDSPRINTF
#endif

47 48 49
/***
 *** Macros
 ***/
50
#define ISC_PRINT_QUADFORMAT ISC_PLATFORM_QUADFORMAT
51

52 53 54 55
/***
 *** Functions
 ***/

56 57 58
#ifdef ISC_PLATFORM_NEEDVSNPRINTF
#include <stdarg.h>
#include <stddef.h>
59
#endif
60 61 62 63
#ifdef ISC_PLATFORM_NEEDSPRINTF
#include <stdio.h>
#endif

64

65 66
ISC_LANG_BEGINDECLS

67
#ifdef ISC_PLATFORM_NEEDVSNPRINTF
68
int
Michael Graff's avatar
Michael Graff committed
69 70
isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
     ISC_FORMAT_PRINTF(3, 0);
71 72 73
#define vsnprintf isc_print_vsnprintf

int
Michael Graff's avatar
Michael Graff committed
74 75
isc_print_snprintf(char *str, size_t size, const char *format, ...)
     ISC_FORMAT_PRINTF(3, 4);
76
#define snprintf isc_print_snprintf
77 78 79 80 81 82 83
#endif /* ISC_PLATFORM_NEEDVSNPRINTF */

#ifdef ISC_PLATFORM_NEEDSPRINTF
int
isc_print_sprintf(char *str, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
#define sprintf isc_print_sprintf
#endif
84 85

ISC_LANG_ENDDECLS
86

87
#endif /* ISC_PRINT_H */