]> git.proxmox.com Git - mirror_ovs.git/blame - lib/stdio.h.in
stdio: New module, initially to provide working [v]snprintf() on Windows.
[mirror_ovs.git] / lib / stdio.h.in
CommitLineData
cde1c287
BP
1/*
2 * Copyright (c) 2013 Nicira, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#@INCLUDE_NEXT@ @NEXT_STDIO_H@
18
19#if !defined STDIO_H_WRAPPER
20#define STDIO_H_WRAPPER 1
21
22#ifdef _WIN32
23
24#include <stdarg.h>
25#include <stddef.h>
26
27/* Windows libc has defective snprintf() and vsnprintf():
28 *
29 * - They return -1 if the output won't fit.
30 *
31 * - They don't null-terminate the output if it won't fit.
32 *
33 * We need working versions so here we define substitutes. */
34#undef snprintf
35#define snprintf ovs_snprintf
36int ovs_snprintf(char *, size_t, const char *, ...);
37
38#undef vsnprintf
39#define vsnprintf ovs_vsnprintf
40int ovs_vsnprintf(char *, size_t, const char *, va_list);
41#endif /* _WIN32 */
42
43#endif /* stdio.h wrapper */