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