eo301@0: /*- eo301@0: * Copyright (c) 1990, 1993 eo301@0: * The Regents of the University of California. All rights reserved. eo301@0: * eo301@0: * This code is derived from software contributed to Berkeley by eo301@0: * Chris Torek. eo301@0: * eo301@0: * Redistribution and use in source and binary forms, with or without eo301@0: * modification, are permitted provided that the following conditions eo301@0: * are met: eo301@0: * 1. Redistributions of source code must retain the above copyright eo301@0: * notice, this list of conditions and the following disclaimer. eo301@0: * 2. Redistributions in binary form must reproduce the above copyright eo301@0: * notice, this list of conditions and the following disclaimer in the eo301@0: * documentation and/or other materials provided with the distribution. eo301@0: * 3. All advertising materials mentioning features or use of this software eo301@0: * must display the following acknowledgement: eo301@0: * This product includes software developed by the University of eo301@0: * California, Berkeley and its contributors. eo301@0: * 4. Neither the name of the University nor the names of its contributors eo301@0: * may be used to endorse or promote products derived from this software eo301@0: * without specific prior written permission. eo301@0: * eo301@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND eo301@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE eo301@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE eo301@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE eo301@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL eo301@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS eo301@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) eo301@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT eo301@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY eo301@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF eo301@0: * SUCH DAMAGE. eo301@0: * eo301@0: * @(#)stdio.h 8.5 (Berkeley) 4/29/95 eo301@0: * $FreeBSD$ eo301@0: */ eo301@0: eo301@0: #ifndef _STDIO_H_ eo301@0: #define _STDIO_H_ eo301@0: eo301@0: #include eo301@0: #include eo301@0: #include eo301@0: eo301@0: typedef __off_t fpos_t; eo301@0: eo301@0: #ifndef _SIZE_T_DECLARED eo301@0: typedef __size_t size_t; eo301@0: #define _SIZE_T_DECLARED eo301@0: #endif eo301@0: eo301@0: #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 eo301@0: #ifndef _OFF_T_DECLARED eo301@0: #define _OFF_T_DECLARED eo301@0: typedef __off_t off_t; eo301@0: #endif eo301@0: #ifndef _SSIZE_T_DECLARED eo301@0: #define _SSIZE_T_DECLARED eo301@0: typedef __ssize_t ssize_t; eo301@0: #endif eo301@0: #endif eo301@0: eo301@0: #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE eo301@0: #ifndef _VA_LIST_DECLARED eo301@0: typedef __va_list va_list; eo301@0: #define _VA_LIST_DECLARED eo301@0: #endif eo301@0: #endif eo301@0: eo301@0: #define _FSTDIO /* Define for new stdio with functions. */ eo301@0: eo301@0: /* eo301@0: * NB: to fit things in six character monocase externals, the stdio eo301@0: * code uses the prefix `__s' for stdio objects, typically followed eo301@0: * by a three-character attempt at a mnemonic. eo301@0: */ eo301@0: eo301@0: /* stdio buffers */ eo301@0: struct __sbuf { eo301@0: unsigned char *_base; eo301@0: int _size; eo301@0: }; eo301@0: eo301@0: /* eo301@0: * stdio state variables. eo301@0: * eo301@0: * The following always hold: eo301@0: * eo301@0: * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), eo301@0: * _lbfsize is -_bf._size, else _lbfsize is 0 eo301@0: * if _flags&__SRD, _w is 0 eo301@0: * if _flags&__SWR, _r is 0 eo301@0: * eo301@0: * This ensures that the getc and putc macros (or inline functions) never eo301@0: * try to write or read from a file that is in `read' or `write' mode. eo301@0: * (Moreover, they can, and do, automatically switch from read mode to eo301@0: * write mode, and back, on "r+" and "w+" files.) eo301@0: * eo301@0: * _lbfsize is used only to make the inline line-buffered output stream eo301@0: * code as compact as possible. eo301@0: * eo301@0: * _ub, _up, and _ur are used when ungetc() pushes back more characters eo301@0: * than fit in the current _bf, or when ungetc() pushes back a character eo301@0: * that does not match the previous one in _bf. When this happens, eo301@0: * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff eo301@0: * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. eo301@0: * eo301@0: * Certain members of __sFILE are accessed directly via macros or eo301@0: * inline functions. To preserve ABI compat, these members must not eo301@0: * be disturbed. These members are marked below with (*). eo301@0: */ eo301@0: typedef struct __sFILE { eo301@0: unsigned char *_p; /* (*) current position in (some) buffer */ eo301@0: int _r; /* (*) read space left for getc() */ eo301@0: int _w; /* (*) write space left for putc() */ eo301@0: short _flags; /* (*) flags, below; this FILE is free if 0 */ eo301@0: short _file; /* (*) fileno, if Unix descriptor, else -1 */ eo301@0: struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */ eo301@0: int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */ eo301@0: eo301@0: /* operations */ eo301@0: void *_cookie; /* (*) cookie passed to io functions */ eo301@0: int (*_close)(void *); eo301@0: int (*_read)(void *, char *, int); eo301@0: fpos_t (*_seek)(void *, fpos_t, int); eo301@0: int (*_write)(void *, const char *, int); eo301@0: eo301@0: /* separate buffer for long sequences of ungetc() */ eo301@0: struct __sbuf _ub; /* ungetc buffer */ eo301@0: unsigned char *_up; /* saved _p when _p is doing ungetc data */ eo301@0: int _ur; /* saved _r when _r is counting ungetc data */ eo301@0: eo301@0: /* tricks to meet minimum requirements even when malloc() fails */ eo301@0: unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ eo301@0: unsigned char _nbuf[1]; /* guarantee a getc() buffer */ eo301@0: eo301@0: /* separate buffer for fgetln() when line crosses buffer boundary */ eo301@0: struct __sbuf _lb; /* buffer for fgetln() */ eo301@0: eo301@0: /* Unix stdio files get aligned to block boundaries on fseek() */ eo301@0: int _blksize; /* stat.st_blksize (may be != _bf._size) */ eo301@0: fpos_t _offset; /* current lseek offset */ eo301@0: eo301@0: struct pthread_mutex *_fl_mutex; /* used for MT-safety */ eo301@0: struct pthread *_fl_owner; /* current owner */ eo301@0: int _fl_count; /* recursive lock count */ eo301@0: int _orientation; /* orientation for fwide() */ eo301@0: __mbstate_t _mbstate; /* multibyte conversion state */ eo301@0: } FILE; eo301@0: eo301@0: #ifndef _STDSTREAM_DECLARED eo301@0: __BEGIN_DECLS eo301@0: extern FILE *__stdinp; eo301@0: extern FILE *__stdoutp; eo301@0: extern FILE *__stderrp; eo301@0: __END_DECLS eo301@0: #define _STDSTREAM_DECLARED eo301@0: #endif eo301@0: eo301@0: #define __SLBF 0x0001 /* line buffered */ eo301@0: #define __SNBF 0x0002 /* unbuffered */ eo301@0: #define __SRD 0x0004 /* OK to read */ eo301@0: #define __SWR 0x0008 /* OK to write */ eo301@0: /* RD and WR are never simultaneously asserted */ eo301@0: #define __SRW 0x0010 /* open for reading & writing */ eo301@0: #define __SEOF 0x0020 /* found EOF */ eo301@0: #define __SERR 0x0040 /* found error */ eo301@0: #define __SMBF 0x0080 /* _buf is from malloc */ eo301@0: #define __SAPP 0x0100 /* fdopen()ed in append mode */ eo301@0: #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ eo301@0: #define __SOPT 0x0400 /* do fseek() optimization */ eo301@0: #define __SNPT 0x0800 /* do not do fseek() optimization */ eo301@0: #define __SOFF 0x1000 /* set iff _offset is in fact correct */ eo301@0: #define __SMOD 0x2000 /* true => fgetln modified _p text */ eo301@0: #define __SALC 0x4000 /* allocate string space dynamically */ eo301@0: #define __SIGN 0x8000 /* ignore this file in _fwalk */ eo301@0: eo301@0: /* eo301@0: * The following three definitions are for ANSI C, which took them eo301@0: * from System V, which brilliantly took internal interface macros and eo301@0: * made them official arguments to setvbuf(), without renaming them. eo301@0: * Hence, these ugly _IOxxx names are *supposed* to appear in user code. eo301@0: * eo301@0: * Although numbered as their counterparts above, the implementation eo301@0: * does not rely on this. eo301@0: */ eo301@0: #define _IOFBF 0 /* setvbuf should set fully buffered */ eo301@0: #define _IOLBF 1 /* setvbuf should set line buffered */ eo301@0: #define _IONBF 2 /* setvbuf should set unbuffered */ eo301@0: eo301@0: #define BUFSIZ 1024 /* size of buffer used by setbuf */ eo301@0: #define EOF (-1) eo301@0: eo301@0: /* eo301@0: * FOPEN_MAX is a minimum maximum, and is the number of streams that eo301@0: * stdio can provide without attempting to allocate further resources eo301@0: * (which could fail). Do not use this for anything. eo301@0: */ eo301@0: /* must be == _POSIX_STREAM_MAX */ eo301@0: #ifndef FOPEN_MAX eo301@0: #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ eo301@0: #endif eo301@0: #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ eo301@0: eo301@0: /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ eo301@0: #if __XSI_VISIBLE eo301@0: #define P_tmpdir "/var/tmp/" eo301@0: #endif eo301@0: #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ eo301@0: #define TMP_MAX 308915776 eo301@0: eo301@0: #ifndef SEEK_SET eo301@0: #define SEEK_SET 0 /* set file offset to offset */ eo301@0: #endif eo301@0: #ifndef SEEK_CUR eo301@0: #define SEEK_CUR 1 /* set file offset to current plus offset */ eo301@0: #endif eo301@0: #ifndef SEEK_END eo301@0: #define SEEK_END 2 /* set file offset to EOF plus offset */ eo301@0: #endif eo301@0: eo301@0: #define stdin __stdinp eo301@0: #define stdout __stdoutp eo301@0: #define stderr __stderrp eo301@0: eo301@0: __BEGIN_DECLS eo301@0: /* eo301@0: * Functions defined in ANSI C standard. eo301@0: */ eo301@0: void clearerr(FILE *); eo301@0: int fclose(FILE *); eo301@0: int feof(FILE *); eo301@0: int ferror(FILE *); eo301@0: int fflush(FILE *); eo301@0: int fgetc(FILE *); eo301@0: int fgetpos(FILE * __restrict, fpos_t * __restrict); eo301@0: char *fgets(char * __restrict, int, FILE * __restrict); eo301@0: FILE *fopen(const char * __restrict, const char * __restrict); eo301@0: int fprintf(FILE * __restrict, const char * __restrict, ...); eo301@0: int fputc(int, FILE *); eo301@0: int fputs(const char * __restrict, FILE * __restrict); eo301@0: size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); eo301@0: FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); eo301@0: int fscanf(FILE * __restrict, const char * __restrict, ...); eo301@0: int fseek(FILE *, long, int); eo301@0: int fsetpos(FILE *, const fpos_t *); eo301@0: long ftell(FILE *); eo301@0: size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); eo301@0: int getc(FILE *); eo301@0: int getchar(void); eo301@0: char *gets(char *); eo301@0: void perror(const char *); eo301@0: int printf(const char * __restrict, ...); eo301@0: int putc(int, FILE *); eo301@0: int putchar(int); eo301@0: int puts(const char *); eo301@0: int remove(const char *); eo301@0: int rename(const char *, const char *); eo301@0: void rewind(FILE *); eo301@0: int scanf(const char * __restrict, ...); eo301@0: void setbuf(FILE * __restrict, char * __restrict); eo301@0: int setvbuf(FILE * __restrict, char * __restrict, int, size_t); eo301@0: int sprintf(char * __restrict, const char * __restrict, ...); eo301@0: int sscanf(const char * __restrict, const char * __restrict, ...); eo301@0: FILE *tmpfile(void); eo301@0: char *tmpnam(char *); eo301@0: int ungetc(int, FILE *); eo301@0: int vfprintf(FILE * __restrict, const char * __restrict, eo301@0: __va_list); eo301@0: int vprintf(const char * __restrict, __va_list); eo301@0: int vsprintf(char * __restrict, const char * __restrict, eo301@0: __va_list); eo301@0: eo301@0: #if __ISO_C_VISIBLE >= 1999 eo301@0: int snprintf(char * __restrict, size_t, const char * __restrict, eo301@0: ...) __printflike(3, 4); eo301@0: int vfscanf(FILE * __restrict, const char * __restrict, __va_list) eo301@0: __scanflike(2, 0); eo301@0: int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); eo301@0: int vsnprintf(char * __restrict, size_t, const char * __restrict, eo301@0: __va_list) __printflike(3, 0); eo301@0: int vsscanf(const char * __restrict, const char * __restrict, __va_list) eo301@0: __scanflike(2, 0); eo301@0: #endif eo301@0: eo301@0: /* eo301@0: * Functions defined in all versions of POSIX 1003.1. eo301@0: */ eo301@0: #if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 eo301@0: /* size for cuserid(3); UT_NAMESIZE + 1, see */ eo301@0: #define L_cuserid 17 /* legacy */ eo301@0: #endif eo301@0: eo301@0: #if __POSIX_VISIBLE eo301@0: #define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ eo301@0: eo301@0: char *ctermid(char *); eo301@0: FILE *fdopen(int, const char *); eo301@0: int fileno(FILE *); eo301@0: #endif /* __POSIX_VISIBLE */ eo301@0: eo301@0: #if __POSIX_VISIBLE >= 199209 eo301@0: int pclose(FILE *); eo301@0: FILE *popen(const char *, const char *); eo301@0: #endif eo301@0: eo301@0: #if __POSIX_VISIBLE >= 199506 eo301@0: int ftrylockfile(FILE *); eo301@0: void flockfile(FILE *); eo301@0: void funlockfile(FILE *); eo301@0: eo301@0: /* eo301@0: * These are normally used through macros as defined below, but POSIX eo301@0: * requires functions as well. eo301@0: */ eo301@0: int getc_unlocked(FILE *); eo301@0: int getchar_unlocked(void); eo301@0: int putc_unlocked(int, FILE *); eo301@0: int putchar_unlocked(int); eo301@0: #endif eo301@0: #if __BSD_VISIBLE eo301@0: void clearerr_unlocked(FILE *); eo301@0: int feof_unlocked(FILE *); eo301@0: int ferror_unlocked(FILE *); eo301@0: int fileno_unlocked(FILE *); eo301@0: #endif eo301@0: eo301@0: #if __POSIX_VISIBLE >= 200112 eo301@0: int fseeko(FILE *, __off_t, int); eo301@0: __off_t ftello(FILE *); eo301@0: #endif eo301@0: eo301@0: #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 eo301@0: int getw(FILE *); eo301@0: int putw(int, FILE *); eo301@0: #endif /* BSD or X/Open before issue 6 */ eo301@0: eo301@0: #if __XSI_VISIBLE eo301@0: char *tempnam(const char *, const char *); eo301@0: #endif eo301@0: eo301@0: #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 eo301@0: ssize_t getdelim(char ** __restrict, size_t * __restrict, int, eo301@0: FILE * __restrict); eo301@0: int renameat(int, const char *, int, const char *); eo301@0: int vdprintf(int, const char * __restrict, __va_list); eo301@0: eo301@0: /* eo301@0: * Every programmer and his dog wrote functions called getline() and dprintf() eo301@0: * before POSIX.1-2008 came along and decided to usurp the names, so we eo301@0: * don't prototype them by default unless one of the following is true: eo301@0: * a) the app has requested them specifically by defining _WITH_GETLINE or eo301@0: * _WITH_DPRINTF, respectively eo301@0: * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE eo301@0: * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE eo301@0: */ eo301@0: #ifndef _WITH_GETLINE eo301@0: #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) eo301@0: #define _WITH_GETLINE eo301@0: #elif defined(_POSIX_C_SOURCE) eo301@0: #if _POSIX_C_SOURCE >= 200809 eo301@0: #define _WITH_GETLINE eo301@0: #endif eo301@0: #endif eo301@0: #endif eo301@0: eo301@0: #ifdef _WITH_GETLINE eo301@0: ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); eo301@0: #endif eo301@0: eo301@0: #ifndef _WITH_DPRINTF eo301@0: #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) eo301@0: #define _WITH_DPRINTF eo301@0: #elif defined(_POSIX_C_SOURCE) eo301@0: #if _POSIX_C_SOURCE >= 200809 eo301@0: #define _WITH_DPRINTF eo301@0: #endif eo301@0: #endif eo301@0: #endif eo301@0: eo301@0: #ifdef _WITH_DPRINTF eo301@0: int (dprintf)(int, const char * __restrict, ...); eo301@0: #endif eo301@0: eo301@0: #endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ eo301@0: eo301@0: /* eo301@0: * Routines that are purely local. eo301@0: */ eo301@0: #if __BSD_VISIBLE eo301@0: int asprintf(char **, const char *, ...) __printflike(2, 3); eo301@0: char *ctermid_r(char *); eo301@0: void fcloseall(void); eo301@0: char *fgetln(FILE *, size_t *); eo301@0: const char *fmtcheck(const char *, const char *) __format_arg(2); eo301@0: int fpurge(FILE *); eo301@0: void setbuffer(FILE *, char *, int); eo301@0: int setlinebuf(FILE *); eo301@0: int vasprintf(char **, const char *, __va_list) eo301@0: __printflike(2, 0); eo301@0: eo301@0: /* eo301@0: * The system error table contains messages for the first sys_nerr eo301@0: * positive errno values. Use strerror() or strerror_r() from eo301@0: * instead. eo301@0: */ eo301@0: extern __const int sys_nerr; eo301@0: extern __const char *__const sys_errlist[]; eo301@0: eo301@0: /* eo301@0: * Stdio function-access interface. eo301@0: */ eo301@0: FILE *funopen(const void *, eo301@0: int (*)(void *, char *, int), eo301@0: int (*)(void *, const char *, int), eo301@0: fpos_t (*)(void *, fpos_t, int), eo301@0: int (*)(void *)); eo301@0: #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) eo301@0: #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) eo301@0: eo301@0: /* eo301@0: * Portability hacks. See . eo301@0: */ eo301@0: #ifndef _FTRUNCATE_DECLARED eo301@0: #define _FTRUNCATE_DECLARED eo301@0: int ftruncate(int, __off_t); eo301@0: #endif eo301@0: #ifndef _LSEEK_DECLARED eo301@0: #define _LSEEK_DECLARED eo301@0: __off_t lseek(int, __off_t, int); eo301@0: #endif eo301@0: #ifndef _MMAP_DECLARED eo301@0: #define _MMAP_DECLARED eo301@0: void *mmap(void *, size_t, int, int, int, __off_t); eo301@0: #endif eo301@0: #ifndef _TRUNCATE_DECLARED eo301@0: #define _TRUNCATE_DECLARED eo301@0: int truncate(const char *, __off_t); eo301@0: #endif eo301@0: #endif /* __BSD_VISIBLE */ eo301@0: eo301@0: /* eo301@0: * Functions internal to the implementation. eo301@0: */ eo301@0: int __srget(FILE *); eo301@0: int __swbuf(int, FILE *); eo301@0: eo301@0: /* eo301@0: * The __sfoo macros are here so that we can eo301@0: * define function versions in the C library. eo301@0: */ eo301@0: #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) eo301@0: #if defined(__GNUC__) && defined(__STDC__) eo301@0: static __inline int __sputc(int _c, FILE *_p) { eo301@0: if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) eo301@0: return (*_p->_p++ = _c); eo301@0: else eo301@0: return (__swbuf(_c, _p)); eo301@0: } eo301@0: #else eo301@0: /* eo301@0: * This has been tuned to generate reasonable code on the vax using pcc. eo301@0: */ eo301@0: #define __sputc(c, p) \ eo301@0: (--(p)->_w < 0 ? \ eo301@0: (p)->_w >= (p)->_lbfsize ? \ eo301@0: (*(p)->_p = (c)), *(p)->_p != '\n' ? \ eo301@0: (int)*(p)->_p++ : \ eo301@0: __swbuf('\n', p) : \ eo301@0: __swbuf((int)(c), p) : \ eo301@0: (*(p)->_p = (c), (int)*(p)->_p++)) eo301@0: #endif eo301@0: eo301@0: #define __sfeof(p) (((p)->_flags & __SEOF) != 0) eo301@0: #define __sferror(p) (((p)->_flags & __SERR) != 0) eo301@0: #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) eo301@0: #define __sfileno(p) ((p)->_file) eo301@0: eo301@0: extern int __isthreaded; eo301@0: eo301@0: #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) eo301@0: #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) eo301@0: #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) eo301@0: eo301@0: #if __POSIX_VISIBLE eo301@0: #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) eo301@0: #endif eo301@0: eo301@0: #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) eo301@0: #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) eo301@0: eo301@0: #define getchar() getc(stdin) eo301@0: #define putchar(x) putc(x, stdout) eo301@0: eo301@0: #if __BSD_VISIBLE eo301@0: /* eo301@0: * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 eo301@0: * B.8.2.7 for the rationale behind the *_unlocked() macros. eo301@0: */ eo301@0: #define feof_unlocked(p) __sfeof(p) eo301@0: #define ferror_unlocked(p) __sferror(p) eo301@0: #define clearerr_unlocked(p) __sclearerr(p) eo301@0: #define fileno_unlocked(p) __sfileno(p) eo301@0: #endif eo301@0: #if __POSIX_VISIBLE >= 199506 eo301@0: #define getc_unlocked(fp) __sgetc(fp) eo301@0: #define putc_unlocked(x, fp) __sputc(x, fp) eo301@0: eo301@0: #define getchar_unlocked() getc_unlocked(stdin) eo301@0: #define putchar_unlocked(x) putc_unlocked(x, stdout) eo301@0: #endif eo301@0: eo301@0: __END_DECLS eo301@0: #endif /* !_STDIO_H_ */