C Standard Library Extensions 1.3.1
snprintf.h
1/*
2 * This file is part of the ESO C Extension Library
3 * Copyright (C) 2001-2026 European Southern Observatory
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
17 */
18
19#ifndef CX_SNPRINTF_H
20#define CX_SNPRINTF_H
21
22#ifdef HAVE_CONFIG_H
23# include "config.h"
24#endif
25
26#ifdef HAVE_STDDEF_H
27# include <stdarg.h>
28#endif
29
30#ifdef HAVE_STDDEF_H
31# include <stddef.h>
32#endif
33
34/* Just for defining the CX_BEGIN_DECLS and CX_END_DECLS symbols. */
35#include "cxmacros.h"
36
37
38/* Define aliases for the replacement functions */
39
40#if !defined(HAVE_SNPRINTF)
41# define snprintf rpl_snprintf
42#endif
43
44#if !defined(HAVE_VSNPRINTF)
45# define vsnprintf rpl_vsnprintf
46#endif
47
48#if !defined(HAVE_ASPRINTF)
49# define asprintf rpl_asprintf
50#endif
51
52#if !defined(HAVE_VASPRINTF)
53# define vasprintf rpl_vasprintf
54#endif
55
56
57CX_BEGIN_DECLS
58
59#if !defined(HAVE_SNPRINTF)
60int rpl_snprintf(char *str, size_t size, const char *fmt, ...);
61#endif
62
63#if !defined(HAVE_VSNPRINTF)
64int rpl_vsnprintf(char *str, size_t size, const char *fmt, va_list args);
65#endif
66
67#if !defined(HAVE_ASPRINTF)
68int rpl_asprintf(char **str, const char *fmt, ...);
69#endif
70
71#if !defined(HAVE_VASPRINTF)
72int rpl_vasprintf(char **str, const char *fmt, va_list args);
73#endif
74
75CX_END_DECLS
76
77#endif /* CX_SNPRINTF_H */