C Standard Library Extensions  1.2
snprintf.h
1 /* $Id: snprintf.h,v 1.8 2012-03-06 16:35:50 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef CX_SNPRINTF_H
22 #define CX_SNPRINTF_H
23 
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27 
28 #ifdef HAVE_STDDEF_H
29 # include <stdarg.h>
30 #endif
31 
32 #ifdef HAVE_STDDEF_H
33 # include <stddef.h>
34 #endif
35 
36 /* Just for defining the CX_BEGIN_DECLS and CX_END_DECLS symbols. */
37 #include <cxtypes.h>
38 
39 
40 /* Define aliases for the replacement functions */
41 
42 #if ! defined(HAVE_SNPRINTF)
43 # define snprintf rpl_snprintf
44 #endif
45 
46 #if ! defined(HAVE_VSNPRINTF)
47 # define vsnprintf rpl_vsnprintf
48 #endif
49 
50 #if ! defined(HAVE_ASPRINTF)
51 # define asprintf rpl_asprintf
52 #endif
53 
54 #if ! defined(HAVE_VASPRINTF)
55 # define vasprintf rpl_vasprintf
56 #endif
57 
58 
59 CX_BEGIN_DECLS
60 
61 #if ! defined(HAVE_SNPRINTF)
62 int rpl_snprintf(char *str, size_t size, const char *fmt, ...);
63 #endif
64 
65 #if ! defined(HAVE_VSNPRINTF)
66 int rpl_vsnprintf(char *str, size_t size, const char *fmt, va_list args);
67 #endif
68 
69 #if ! defined(HAVE_ASPRINTF)
70 int rpl_asprintf(char **str, const char *fmt, ...);
71 #endif
72 
73 #if ! defined(HAVE_VASPRINTF)
74 int rpl_vasprintf(char **str, const char *fmt, va_list args);
75 #endif
76 
77 CX_END_DECLS
78 
79 #endif /* CX_SNPRINTF_H */