]> git.saurik.com Git - apple/libc.git/blame - include/stdio.h
Libc-1439.40.11.tar.gz
[apple/libc.git] / include / stdio.h
CommitLineData
5b2abdfb 1/*
1f2f436a 2 * Copyright (c) 2000, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved.
5b2abdfb
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
224c7076 5 *
734aad71
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
224c7076 12 *
734aad71
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
5b2abdfb
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
224c7076 20 *
5b2abdfb
A
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1990, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * This code is derived from software contributed to Berkeley by
28 * Chris Torek.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
58 * @(#)stdio.h 8.5 (Berkeley) 4/29/95
59 */
60
61#ifndef _STDIO_H_
62#define _STDIO_H_
63
e07eda1a 64#include <_stdio.h>
5b2abdfb 65
507116e3 66#ifndef UNIFDEF_DRIVERKIT
5b2abdfb 67__BEGIN_DECLS
3d9156a7
A
68extern FILE *__stdinp;
69extern FILE *__stdoutp;
70extern FILE *__stderrp;
5b2abdfb
A
71__END_DECLS
72
73#define __SLBF 0x0001 /* line buffered */
74#define __SNBF 0x0002 /* unbuffered */
75#define __SRD 0x0004 /* OK to read */
76#define __SWR 0x0008 /* OK to write */
77 /* RD and WR are never simultaneously asserted */
78#define __SRW 0x0010 /* open for reading & writing */
79#define __SEOF 0x0020 /* found EOF */
80#define __SERR 0x0040 /* found error */
81#define __SMBF 0x0080 /* _buf is from malloc */
82#define __SAPP 0x0100 /* fdopen()ed in append mode */
83#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
84#define __SOPT 0x0400 /* do fseek() optimisation */
85#define __SNPT 0x0800 /* do not do fseek() optimisation */
86#define __SOFF 0x1000 /* set iff _offset is in fact correct */
87#define __SMOD 0x2000 /* true => fgetln modified _p text */
88#define __SALC 0x4000 /* allocate string space dynamically */
9385eb3d 89#define __SIGN 0x8000 /* ignore this file in _fwalk */
5b2abdfb
A
90
91/*
92 * The following three definitions are for ANSI C, which took them
93 * from System V, which brilliantly took internal interface macros and
94 * made them official arguments to setvbuf(), without renaming them.
95 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
96 *
97 * Although numbered as their counterparts above, the implementation
98 * does not rely on this.
99 */
100#define _IOFBF 0 /* setvbuf should set fully buffered */
101#define _IOLBF 1 /* setvbuf should set line buffered */
102#define _IONBF 2 /* setvbuf should set unbuffered */
103
104#define BUFSIZ 1024 /* size of buffer used by setbuf */
105#define EOF (-1)
106
5b2abdfb
A
107 /* must be == _POSIX_STREAM_MAX <limits.h> */
108#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
109#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
110
111/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
112#ifndef _ANSI_SOURCE
113#define P_tmpdir "/var/tmp/"
114#endif
115#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
116#define TMP_MAX 308915776
117
118#ifndef SEEK_SET
119#define SEEK_SET 0 /* set file offset to offset */
120#endif
121#ifndef SEEK_CUR
122#define SEEK_CUR 1 /* set file offset to current plus offset */
123#endif
124#ifndef SEEK_END
125#define SEEK_END 2 /* set file offset to EOF plus offset */
126#endif
127
3d9156a7
A
128#define stdin __stdinp
129#define stdout __stdoutp
130#define stderr __stderrp
5b2abdfb 131
1f2f436a
A
132#ifdef _DARWIN_UNLIMITED_STREAMS
133#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
134#error "_DARWIN_UNLIMITED_STREAMS specified, but -miphoneos-version-min version does not support it."
135#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
136#error "_DARWIN_UNLIMITED_STREAMS specified, but -mmacosx-version-min version does not support it."
137#endif
138#endif
139
140/* ANSI-C */
141
5b2abdfb 142__BEGIN_DECLS
9385eb3d
A
143void clearerr(FILE *);
144int fclose(FILE *);
145int feof(FILE *);
146int ferror(FILE *);
147int fflush(FILE *);
148int fgetc(FILE *);
59e0d9fe
A
149int fgetpos(FILE * __restrict, fpos_t *);
150char *fgets(char * __restrict, int, FILE *);
1f2f436a 151#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE)
974e3884 152FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fopen));
1f2f436a 153#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */
34e8f829
A
154//Begin-Libc
155#ifndef LIBC_ALIAS_FOPEN
156//End-Libc
974e3884 157FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fopen));
34e8f829
A
158//Begin-Libc
159#else /* LIBC_ALIAS_FOPEN */
974e3884 160FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) LIBC_ALIAS(fopen);
34e8f829
A
161#endif /* !LIBC_ALIAS_FOPEN */
162//End-Libc
1f2f436a 163#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */
ad3c9f2a 164int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3);
9385eb3d 165int fputc(int, FILE *);
224c7076
A
166//Begin-Libc
167#ifndef LIBC_ALIAS_FPUTS
168//End-Libc
169int fputs(const char * __restrict, FILE * __restrict) __DARWIN_ALIAS(fputs);
170//Begin-Libc
171#else /* LIBC_ALIAS_FPUTS */
172int fputs(const char * __restrict, FILE * __restrict) LIBC_ALIAS(fputs);
173#endif /* !LIBC_ALIAS_FPUTS */
174//End-Libc
974e3884 175size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream);
224c7076
A
176//Begin-Libc
177#ifndef LIBC_ALIAS_FREOPEN
178//End-Libc
59e0d9fe 179FILE *freopen(const char * __restrict, const char * __restrict,
1f2f436a 180 FILE * __restrict) __DARWIN_ALIAS(freopen);
224c7076
A
181//Begin-Libc
182#else /* LIBC_ALIAS_FREOPEN */
183FILE *freopen(const char * __restrict, const char * __restrict,
1f2f436a 184 FILE * __restrict) LIBC_ALIAS(freopen);
224c7076
A
185#endif /* !LIBC_ALIAS_FREOPEN */
186//End-Libc
ad3c9f2a 187int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3);
9385eb3d
A
188int fseek(FILE *, long, int);
189int fsetpos(FILE *, const fpos_t *);
190long ftell(FILE *);
224c7076
A
191//Begin-Libc
192#ifndef LIBC_ALIAS_FWRITE
193//End-Libc
974e3884 194size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite);
224c7076
A
195//Begin-Libc
196#else /* LIBC_ALIAS_FWRITE */
974e3884 197size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) LIBC_ALIAS(fwrite);
224c7076
A
198#endif /* !LIBC_ALIAS_FWRITE */
199//End-Libc
9385eb3d
A
200int getc(FILE *);
201int getchar(void);
202char *gets(char *);
507116e3 203void perror(const char *) __cold;
ad3c9f2a 204int printf(const char * __restrict, ...) __printflike(1, 2);
9385eb3d
A
205int putc(int, FILE *);
206int putchar(int);
207int puts(const char *);
208int remove(const char *);
974e3884 209int rename (const char *__old, const char *__new);
9385eb3d 210void rewind(FILE *);
ad3c9f2a 211int scanf(const char * __restrict, ...) __scanflike(1, 2);
59e0d9fe
A
212void setbuf(FILE * __restrict, char * __restrict);
213int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
974e3884 214int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3) __swift_unavailable("Use snprintf instead.");
ad3c9f2a 215int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
9385eb3d 216FILE *tmpfile(void);
6465356a 217
974e3884 218__swift_unavailable("Use mkstemp(3) instead.")
6465356a
A
219#if !defined(_POSIX_C_SOURCE)
220__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
221#endif
9385eb3d
A
222char *tmpnam(char *);
223int ungetc(int, FILE *);
ad3c9f2a
A
224int vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0);
225int vprintf(const char * __restrict, va_list) __printflike(1, 0);
974e3884 226int vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0) __swift_unavailable("Use vsnprintf instead.");
5b2abdfb
A
227__END_DECLS
228
1f2f436a
A
229
230
231/* Additional functionality provided by:
232 * POSIX.1-1988
5b2abdfb 233 */
1f2f436a
A
234
235#if __DARWIN_C_LEVEL >= 198808L
5b2abdfb
A
236#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
237
238__BEGIN_DECLS
507116e3 239#include <_ctermid.h>
1f2f436a
A
240
241#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE)
242FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fdopen));
243#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */
34e8f829
A
244//Begin-Libc
245#ifndef LIBC_ALIAS_FDOPEN
246//End-Libc
1f2f436a 247FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
34e8f829
A
248//Begin-Libc
249#else /* LIBC_ALIAS_FDOPEN */
250FILE *fdopen(int, const char *) LIBC_ALIAS(fdopen);
251#endif /* !LIBC_ALIAS_FDOPEN */
252//End-Libc
1f2f436a 253#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */
59e0d9fe 254int fileno(FILE *);
1f2f436a
A
255__END_DECLS
256#endif /* __DARWIN_C_LEVEL >= 198808L */
257
258
259/* Additional functionality provided by:
260 * POSIX.2-1992 C Language Binding Option
261 */
a9aaacca 262#if TARGET_OS_IPHONE
974e3884
A
263#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
264#else
265#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg)
266#endif
1f2f436a
A
267
268#if __DARWIN_C_LEVEL >= 199209L
269__BEGIN_DECLS
974e3884 270int pclose(FILE *) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable.");
1f2f436a 271#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE)
974e3884 272FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(popen)) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable.");
1f2f436a 273#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */
34e8f829
A
274//Begin-Libc
275#ifndef LIBC_ALIAS_POPEN
276//End-Libc
974e3884 277FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(popen)) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable.");
34e8f829
A
278//Begin-Libc
279#else /* LIBC_ALIAS_POPEN */
280FILE *popen(const char *, const char *) LIBC_ALIAS(popen);
281#endif /* !LIBC_ALIAS_POPEN */
282//End-Libc
1f2f436a 283#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */
5b2abdfb 284__END_DECLS
1f2f436a 285#endif /* __DARWIN_C_LEVEL >= 199209L */
5b2abdfb 286
974e3884 287#undef __swift_unavailable_on
1f2f436a
A
288
289/* Additional functionality provided by:
290 * POSIX.1c-1995,
291 * POSIX.1i-1995,
292 * and the omnibus ISO/IEC 9945-1: 1996
5b2abdfb 293 */
1f2f436a
A
294
295#if __DARWIN_C_LEVEL >= 199506L
296
297/* Functions internal to the implementation. */
5b2abdfb 298__BEGIN_DECLS
9385eb3d 299int __srget(FILE *);
ad3c9f2a 300int __svfscanf(FILE *, const char *, va_list) __scanflike(2, 0);
9385eb3d 301int __swbuf(int, FILE *);
5b2abdfb
A
302__END_DECLS
303
304/*
224c7076 305 * The __sfoo macros are here so that we can
5b2abdfb
A
306 * define function versions in the C library.
307 */
308#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
309#if defined(__GNUC__) && defined(__STDC__)
6465356a 310__header_always_inline int __sputc(int _c, FILE *_p) {
5b2abdfb
A
311 if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
312 return (*_p->_p++ = _c);
313 else
314 return (__swbuf(_c, _p));
315}
316#else
317/*
318 * This has been tuned to generate reasonable code on the vax using pcc.
319 */
320#define __sputc(c, p) \
321 (--(p)->_w < 0 ? \
322 (p)->_w >= (p)->_lbfsize ? \
323 (*(p)->_p = (c)), *(p)->_p != '\n' ? \
324 (int)*(p)->_p++ : \
325 __swbuf('\n', p) : \
326 __swbuf((int)(c), p) : \
327 (*(p)->_p = (c), (int)*(p)->_p++))
328#endif
329
330#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
331#define __sferror(p) (((p)->_flags & __SERR) != 0)
332#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
333#define __sfileno(p) ((p)->_file)
334
1f2f436a
A
335__BEGIN_DECLS
336void flockfile(FILE *);
337int ftrylockfile(FILE *);
338void funlockfile(FILE *);
339int getc_unlocked(FILE *);
340int getchar_unlocked(void);
341int putc_unlocked(int, FILE *);
342int putchar_unlocked(int);
343
344/* Removed in Issue 6 */
345#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
346int getw(FILE *);
347int putw(int, FILE *);
348#endif
349
974e3884 350__swift_unavailable("Use mkstemp(3) instead.")
6465356a
A
351#if !defined(_POSIX_C_SOURCE)
352__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.")
353#endif
1f2f436a
A
354//Begin-Libc
355#ifndef LIBC_ALIAS_TEMPNAM
356//End-Libc
974e3884 357char *tempnam(const char *__dir, const char *__prefix) __DARWIN_ALIAS(tempnam);
1f2f436a
A
358//Begin-Libc
359#else /* LIBC_ALIAS_TEMPNAM */
974e3884 360char *tempnam(const char *__dir, const char *__prefix) LIBC_ALIAS(tempnam);
1f2f436a
A
361#endif /* !LIBC_ALIAS_TEMPNAM */
362//End-Libc
363__END_DECLS
5b2abdfb
A
364
365#ifndef lint
9385eb3d
A
366#define getc_unlocked(fp) __sgetc(fp)
367#define putc_unlocked(x, fp) __sputc(x, fp)
5b2abdfb
A
368#endif /* lint */
369
9385eb3d
A
370#define getchar_unlocked() getc_unlocked(stdin)
371#define putchar_unlocked(x) putc_unlocked(x, stdout)
1f2f436a
A
372#endif /* __DARWIN_C_LEVEL >= 199506L */
373
374
375
376/* Additional functionality provided by:
377 * POSIX.1-2001
378 * ISO C99
379 */
380
381#if __DARWIN_C_LEVEL >= 200112L
6465356a 382#include <sys/_types/_off_t.h>
1f2f436a
A
383
384__BEGIN_DECLS
974e3884
A
385int fseeko(FILE * __stream, off_t __offset, int __whence);
386off_t ftello(FILE * __stream);
1f2f436a
A
387__END_DECLS
388#endif /* __DARWIN_C_LEVEL >= 200112L */
389
390#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus)
391__BEGIN_DECLS
974e3884
A
392int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4);
393int vfscanf(FILE * __restrict __stream, const char * __restrict __format, va_list) __scanflike(2, 0);
394int vscanf(const char * __restrict __format, va_list) __scanflike(1, 0);
395int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0);
396int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0);
1f2f436a
A
397__END_DECLS
398#endif /* __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) */
399
400
401
402/* Additional functionality provided by:
403 * POSIX.1-2008
404 */
405
406#if __DARWIN_C_LEVEL >= 200809L
6465356a 407#include <sys/_types/_ssize_t.h>
1f2f436a
A
408
409__BEGIN_DECLS
ad3c9f2a
A
410int dprintf(int, const char * __restrict, ...) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
411int vdprintf(int, const char * __restrict, va_list) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
974e3884
A
412ssize_t getdelim(char ** __restrict __linep, size_t * __restrict __linecapp, int __delimiter, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
413ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
b061a43b
A
414FILE *fmemopen(void * __restrict __buf, size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
415FILE *open_memstream(char **__bufp, size_t *__sizep) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
1f2f436a
A
416__END_DECLS
417#endif /* __DARWIN_C_LEVEL >= 200809L */
418
419
420
421/* Darwin extensions */
422
423#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
424__BEGIN_DECLS
425extern __const int sys_nerr; /* perror(3) external variables */
426extern __const char *__const sys_errlist[];
427
6465356a 428int asprintf(char ** __restrict, const char * __restrict, ...) __printflike(2, 3);
1f2f436a
A
429char *ctermid_r(char *);
430char *fgetln(FILE *, size_t *);
431__const char *fmtcheck(const char *, const char *);
432int fpurge(FILE *);
433void setbuffer(FILE *, char *, int);
434int setlinebuf(FILE *);
6465356a 435int vasprintf(char ** __restrict, const char * __restrict, va_list) __printflike(2, 0);
1f2f436a
A
436FILE *zopen(const char *, const char *, int);
437
438
439/*
440 * Stdio function-access interface.
441 */
442FILE *funopen(const void *,
974e3884
A
443 int (* _Nullable)(void *, char *, int),
444 int (* _Nullable)(void *, const char *, int),
445 fpos_t (* _Nullable)(void *, fpos_t, int),
446 int (* _Nullable)(void *));
1f2f436a
A
447__END_DECLS
448#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
449#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
450
451#define feof_unlocked(p) __sfeof(p)
452#define ferror_unlocked(p) __sferror(p)
453#define clearerr_unlocked(p) __sclearerr(p)
454#define fileno_unlocked(p) __sfileno(p)
455
456#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
457
507116e3
A
458#else /* UNIFDEF_DRIVERKIT */
459#define EOF (-1)
460
461__BEGIN_DECLS
462int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
463#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus)
464int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4);
465int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0);
466int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0);
467#endif /* __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) */
468#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
469int asprintf(char ** __restrict, const char * __restrict, ...) __printflike(2, 3);
470int vasprintf(char ** __restrict, const char * __restrict, va_list) __printflike(2, 0);
471#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
472__END_DECLS
473#endif /* UNIFDEF_DRIVERKIT */
59e0d9fe 474
3d9156a7
A
475#ifdef _USE_EXTENDED_LOCALES_
476#include <xlocale/_stdio.h>
477#endif /* _USE_EXTENDED_LOCALES_ */
478
224c7076
A
479#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
480/* Security checking functions. */
481#include <secure/_stdio.h>
482#endif
483
5b2abdfb 484#endif /* _STDIO_H_ */