1 | /** @file
|
---|
2 | * IPRT / No-CRT - Mostly empty stdio.h.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2022 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef IPRT_INCLUDED_nocrt_stdio_h
|
---|
27 | #define IPRT_INCLUDED_nocrt_stdio_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <iprt/stream.h>
|
---|
33 |
|
---|
34 | typedef RTFOFF fpos_t;
|
---|
35 |
|
---|
36 | #ifdef IPRT_NO_CRT_FOR_3RD_PARTY
|
---|
37 | /*
|
---|
38 | * Only for external libraries and such, but even then it would be best to
|
---|
39 | * check each printf and fprintf call as IPRT isn't 100% compatible...
|
---|
40 | */
|
---|
41 | typedef struct RTSTREAM FILE;
|
---|
42 | # define stdin g_pStdIn
|
---|
43 | # define stdout g_pStdOut
|
---|
44 | # define stderr g_pStdErr
|
---|
45 |
|
---|
46 | # define printf RTPrintf
|
---|
47 | # define vprintf RTPrintfV
|
---|
48 | # define fprintf RTStrmPrintf
|
---|
49 | # define vfprintf RTStrmPrintfV
|
---|
50 | int RT_NOCRT(snprintf)(char *, size_t, const char *, ...);
|
---|
51 | int RT_NOCRT(vsnprintf)(char *, size_t, const char *, va_list);
|
---|
52 | int RT_NOCRT(scprintf)(const char *, ...);
|
---|
53 | int RT_NOCRT(vscprintf)(const char *, va_list);
|
---|
54 |
|
---|
55 | FILE *RT_NOCRT(fopen)(const char *pszFilename, const char *pszMode);
|
---|
56 | FILE *RT_NOCRT(fdopen)(int fd, const char *pszMode);
|
---|
57 | int RT_NOCRT(fclose)(FILE *pFile);
|
---|
58 | int RT_NOCRT(fflush)(FILE *pFile);
|
---|
59 | int RT_NOCRT(setvbuf)(FILE *pFile, char *pchBuf, int iBufferingType, size_t cbBuf);
|
---|
60 | size_t RT_NOCRT(fwrite)(void const *pvBuf, size_t cbItem, size_t cItems, FILE *pFile);
|
---|
61 | size_t RT_NOCRT(fread)(void *pvBuf, size_t cbItem, size_t cItems, FILE *pFile);
|
---|
62 | int RT_NOCRT(fgetc)(FILE *pFile);
|
---|
63 | int RT_NOCRT(getc)(FILE *pFile);
|
---|
64 | int RT_NOCRT(ferror)(FILE *pFile);
|
---|
65 | void RT_NOCRT(clearerr)(FILE *pFile);
|
---|
66 | # ifndef RT_NOCRT_EOF /* also in string */
|
---|
67 | # define RT_NOCRT_EOF (-1)
|
---|
68 | # endif
|
---|
69 | # define EOF RT_NOCRT_EOF
|
---|
70 |
|
---|
71 | /* Underscored variants: */
|
---|
72 | # define _printf RTPrintf
|
---|
73 | # define _vprintf RTPrintfV
|
---|
74 | # define _fprintf RTStrmPrintf
|
---|
75 | # define _vfprintf RTStrmPrintfV
|
---|
76 | int RT_NOCRT(_snprintf)(char *, size_t, const char *, ...);
|
---|
77 | int RT_NOCRT(_vsnprintf)(char *, size_t, const char *, va_list);
|
---|
78 | int RT_NOCRT(_scprintf)(const char *, ...);
|
---|
79 | int RT_NOCRT(_vscprintf)(const char *, va_list);
|
---|
80 |
|
---|
81 | FILE *RT_NOCRT(_fopen)(const char *pszFilename, const char *pszMode);
|
---|
82 | FILE *RT_NOCRT(_fdopen)(int fd, const char *pszMode);
|
---|
83 | int RT_NOCRT(_fclose)(FILE *pFile);
|
---|
84 | int RT_NOCRT(_fflush)(FILE *pFile);
|
---|
85 | int RT_NOCRT(_setvbuf)(FILE *pFile, char *pchBuf, int iBufferingType, size_t cbBuf);
|
---|
86 | size_t RT_NOCRT(_fread)(void *pvBuf, size_t cbItem, size_t cItems, FILE *pFile);
|
---|
87 | size_t RT_NOCRT(_fwrite)(void const *pvBuf, size_t cbItem, size_t cItems, FILE *pFile);
|
---|
88 | int RT_NOCRT(_fgetc)(FILE *pFile);
|
---|
89 | int RT_NOCRT(_getc)(FILE *pFile);
|
---|
90 | int RT_NOCRT(_ferror)(FILE *pFile);
|
---|
91 | void RT_NOCRT(_clearerr)(FILE *pFile);
|
---|
92 |
|
---|
93 | # define _IONBF (1) /**< No buffering. */
|
---|
94 | # define _IOLBF (2) /**< Line buffered. */
|
---|
95 | # define _IOFBF (3) /**< Fully buffered. */
|
---|
96 |
|
---|
97 | /* Aliases: */
|
---|
98 | # if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
|
---|
99 | # define snprintf RT_NOCRT(snprintf)
|
---|
100 | # define vsnprintf RT_NOCRT(vsnprintf)
|
---|
101 | # define scprintf RT_NOCRT(scprintf)
|
---|
102 | # define vscprintf RT_NOCRT(vscprintf)
|
---|
103 |
|
---|
104 | # define fopen RT_NOCRT(fopen)
|
---|
105 | # define fdopen RT_NOCRT(fdopen)
|
---|
106 | # define fclose RT_NOCRT(fclose)
|
---|
107 | # define fflush RT_NOCRT(fflush)
|
---|
108 | # define setvbuf RT_NOCRT(setvbuf)
|
---|
109 | # define fread RT_NOCRT(fread)
|
---|
110 | # define fwrite RT_NOCRT(fwrite)
|
---|
111 | # define fgetc RT_NOCRT(fgetc)
|
---|
112 | # define getc RT_NOCRT(getc)
|
---|
113 | # define ferror RT_NOCRT(ferror)
|
---|
114 | # define clearerr RT_NOCRT(clearerr)
|
---|
115 |
|
---|
116 |
|
---|
117 | /* Underscored variants: */
|
---|
118 | # define _snprintf RT_NOCRT(snprintf)
|
---|
119 | # define _vsnprintf RT_NOCRT(vsnprintf)
|
---|
120 | # define _scprintf RT_NOCRT(scprintf)
|
---|
121 | # define _vscprintf RT_NOCRT(vscprintf)
|
---|
122 |
|
---|
123 | # define _fopen RT_NOCRT(fopen)
|
---|
124 | # define _fdopen RT_NOCRT(fdopen)
|
---|
125 | # define _fclose RT_NOCRT(fclose)
|
---|
126 | # define _flush RT_NOCRT(fflush)
|
---|
127 | # define _setvbuf RT_NOCRT(setvbuf)
|
---|
128 | # define _fread RT_NOCRT(fread)
|
---|
129 | # define _fwrite RT_NOCRT(fwrite)
|
---|
130 | # define _fgetc RT_NOCRT(fgetc)
|
---|
131 | # define _getc RT_NOCRT(getc)
|
---|
132 | # define _ferror RT_NOCRT(ferror)
|
---|
133 | # define _clearerr RT_NOCRT(clearerr)
|
---|
134 | # endif
|
---|
135 |
|
---|
136 | #endif
|
---|
137 |
|
---|
138 | #endif /* !IPRT_INCLUDED_nocrt_stdio_h */
|
---|
139 |
|
---|