xref: /illumos-gate/usr/src/head/iso/stdio_iso.h (revision b4203d757c7c247e39c94c09a94021a3a8121062)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
244870e0a7SRichard PALO  * Copyright 2014 PALO, Richard.
25ba3594baSGarrett D'Amore  *
2650b37527Smuffin  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
3050b37527Smuffin /*	Copyright (c) 1988 AT&T	*/
31*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
3250b37527Smuffin 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * An application should not include this header directly.  Instead it
357c478bd9Sstevel@tonic-gate  * should be included only through the inclusion of other Sun headers.
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  * The contents of this header is limited to identifiers specified in the
387c478bd9Sstevel@tonic-gate  * C Standard.  Any new identifiers specified in future amendments to the
397c478bd9Sstevel@tonic-gate  * C Standard must be placed in this header.  If these new identifiers
407c478bd9Sstevel@tonic-gate  * are required to also be in the C++ Standard "std" namespace, then for
417c478bd9Sstevel@tonic-gate  * anything other than macro definitions, corresponding "using" directives
427c478bd9Sstevel@tonic-gate  * must also be added to <stdio.h>.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * User-visible pieces of the ANSI C standard I/O package.
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifndef _ISO_STDIO_ISO_H
507c478bd9Sstevel@tonic-gate #define	_ISO_STDIO_ISO_H
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
534870e0a7SRichard PALO #include <sys/null.h>
547c478bd9Sstevel@tonic-gate #include <sys/va_list.h>
557c478bd9Sstevel@tonic-gate #include <stdio_tag.h>
567c478bd9Sstevel@tonic-gate #include <stdio_impl.h>
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * If feature test macros are set that enable interfaces that use types
607c478bd9Sstevel@tonic-gate  * defined in <sys/types.h>, get those types by doing the include.
617c478bd9Sstevel@tonic-gate  *
627c478bd9Sstevel@tonic-gate  * Note that in asking for the interfaces associated with this feature test
637c478bd9Sstevel@tonic-gate  * macro one also asks for definitions of the POSIX types.
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
677c478bd9Sstevel@tonic-gate extern "C" {
687c478bd9Sstevel@tonic-gate #endif
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * The following typedefs are adopted from ones in <sys/types.h> (with leading
737c478bd9Sstevel@tonic-gate  * underscores added to avoid polluting the ANSI C name space).  See the
747c478bd9Sstevel@tonic-gate  * commentary there for further explanation.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE)
777c478bd9Sstevel@tonic-gate typedef	long long	__longlong_t;
787c478bd9Sstevel@tonic-gate #else
797c478bd9Sstevel@tonic-gate /* used to reserve space and generate alignment */
807c478bd9Sstevel@tonic-gate typedef union {
817c478bd9Sstevel@tonic-gate 	double	_d;
827c478bd9Sstevel@tonic-gate 	int	_l[2];
837c478bd9Sstevel@tonic-gate } __longlong_t;
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
887c478bd9Sstevel@tonic-gate namespace std {
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #if !defined(_FILEDEFED) || __cplusplus >= 199711L
927c478bd9Sstevel@tonic-gate #define	_FILEDEFED
937c478bd9Sstevel@tonic-gate typedef	__FILE FILE;
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L
977c478bd9Sstevel@tonic-gate #define	_SIZE_T
987c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
997c478bd9Sstevel@tonic-gate typedef unsigned long	size_t;		/* size of something in bytes */
1007c478bd9Sstevel@tonic-gate #else
1017c478bd9Sstevel@tonic-gate typedef unsigned int	size_t;		/* (historical version) */
1027c478bd9Sstevel@tonic-gate #endif
1037c478bd9Sstevel@tonic-gate #endif	/* !_SIZE_T */
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
1067c478bd9Sstevel@tonic-gate typedef long		fpos_t;
1077c478bd9Sstevel@tonic-gate #else
1087c478bd9Sstevel@tonic-gate typedef	__longlong_t	fpos_t;
1097c478bd9Sstevel@tonic-gate #endif
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate #endif /* end of namespace std */
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #define	BUFSIZ	1024
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /*
1187c478bd9Sstevel@tonic-gate  * The value of _NFILE is defined in the Processor Specific ABI.  The value
1197c478bd9Sstevel@tonic-gate  * is chosen for historical reasons rather than for truly processor related
1207c478bd9Sstevel@tonic-gate  * attribute.  Note that the SPARC Processor Specific ABI uses the common
1217c478bd9Sstevel@tonic-gate  * UNIX historical value of 20 so it is allowed to fall through.
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate #if defined(__i386)
1247c478bd9Sstevel@tonic-gate #define	_NFILE	60	/* initial number of streams: Intel x86 ABI */
1257c478bd9Sstevel@tonic-gate #else
1267c478bd9Sstevel@tonic-gate #define	_NFILE	20	/* initial number of streams: SPARC ABI and default */
1277c478bd9Sstevel@tonic-gate #endif
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate #define	_SBFSIZ	8	/* compatibility with shared libs */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #define	_IOFBF		0000	/* full buffered */
1327c478bd9Sstevel@tonic-gate #define	_IOLBF		0100	/* line buffered */
1337c478bd9Sstevel@tonic-gate #define	_IONBF		0004	/* not buffered */
1347c478bd9Sstevel@tonic-gate #define	_IOEOF		0020	/* EOF reached on read */
1357c478bd9Sstevel@tonic-gate #define	_IOERR		0040	/* I/O error from system */
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate #define	_IOREAD		0001	/* currently reading */
1387c478bd9Sstevel@tonic-gate #define	_IOWRT		0002	/* currently writing */
1397c478bd9Sstevel@tonic-gate #define	_IORW		0200	/* opened for reading and writing */
1407c478bd9Sstevel@tonic-gate #define	_IOMYBUF	0010	/* stdio malloc()'d buffer */
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #ifndef EOF
1437c478bd9Sstevel@tonic-gate #define	EOF	(-1)
1447c478bd9Sstevel@tonic-gate #endif
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #define	FOPEN_MAX	_NFILE
1477c478bd9Sstevel@tonic-gate #define	FILENAME_MAX    1024	/* max # of characters in a path name */
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate #define	SEEK_SET	0
1507c478bd9Sstevel@tonic-gate #define	SEEK_CUR	1
1517c478bd9Sstevel@tonic-gate #define	SEEK_END	2
1527c478bd9Sstevel@tonic-gate #define	TMP_MAX		17576	/* 26 * 26 * 26 */
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #define	L_tmpnam	25	/* (sizeof(P_tmpdir) + 15) */
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate extern __FILE	__iob[_NFILE];
1577c478bd9Sstevel@tonic-gate #define	stdin	(&__iob[0])
1587c478bd9Sstevel@tonic-gate #define	stdout	(&__iob[1])
1597c478bd9Sstevel@tonic-gate #define	stderr	(&__iob[2])
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
1627c478bd9Sstevel@tonic-gate namespace std {
1637c478bd9Sstevel@tonic-gate #endif
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
1687c478bd9Sstevel@tonic-gate #pragma redefine_extname fprintf	_fprintf_c89
1697c478bd9Sstevel@tonic-gate #pragma redefine_extname printf		_printf_c89
1707c478bd9Sstevel@tonic-gate #pragma redefine_extname sprintf	_sprintf_c89
1717c478bd9Sstevel@tonic-gate #pragma redefine_extname vfprintf	_vfprintf_c89
1727c478bd9Sstevel@tonic-gate #pragma redefine_extname vprintf	_vprintf_c89
1737c478bd9Sstevel@tonic-gate #pragma redefine_extname vsprintf	_vsprintf_c89
1747c478bd9Sstevel@tonic-gate #pragma redefine_extname fscanf		_fscanf_c89
1757c478bd9Sstevel@tonic-gate #pragma redefine_extname scanf		_scanf_c89
1767c478bd9Sstevel@tonic-gate #pragma redefine_extname sscanf		_sscanf_c89
1777c478bd9Sstevel@tonic-gate #else
1787c478bd9Sstevel@tonic-gate #define	fprintf		_fprintf_c89
1797c478bd9Sstevel@tonic-gate #define	printf		_printf_c89
1807c478bd9Sstevel@tonic-gate #define	sprintf		_sprintf_c89
1817c478bd9Sstevel@tonic-gate #define	vfprintf	_vfprintf_c89
1827c478bd9Sstevel@tonic-gate #define	vprintf		_vprintf_c89
1837c478bd9Sstevel@tonic-gate #define	vsprintf	_vsprintf_c89
1847c478bd9Sstevel@tonic-gate #define	fscanf		_fscanf_c89
1857c478bd9Sstevel@tonic-gate #define	scanf		_scanf_c89
1867c478bd9Sstevel@tonic-gate #define	sscanf		_sscanf_c89
1877c478bd9Sstevel@tonic-gate #endif
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate extern int	remove(const char *);
1927c478bd9Sstevel@tonic-gate extern int	rename(const char *, const char *);
1937c478bd9Sstevel@tonic-gate extern FILE	*tmpfile(void);
1947c478bd9Sstevel@tonic-gate extern char	*tmpnam(char *);
1957c478bd9Sstevel@tonic-gate extern int	fclose(FILE *);
1967c478bd9Sstevel@tonic-gate extern int	fflush(FILE *);
1977c478bd9Sstevel@tonic-gate extern FILE	*fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
1987c478bd9Sstevel@tonic-gate extern FILE	*freopen(const char *_RESTRICT_KYWD,
1997c478bd9Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
2007c478bd9Sstevel@tonic-gate extern void	setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
2017c478bd9Sstevel@tonic-gate extern int	setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
2027c478bd9Sstevel@tonic-gate 			size_t);
2037c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
2047c478bd9Sstevel@tonic-gate extern int	fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2057c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
2067c478bd9Sstevel@tonic-gate extern int	fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2077c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
2087c478bd9Sstevel@tonic-gate extern int	printf(const char *_RESTRICT_KYWD, ...);
2097c478bd9Sstevel@tonic-gate /* SCANFLIKE1 */
2107c478bd9Sstevel@tonic-gate extern int	scanf(const char *_RESTRICT_KYWD, ...);
2117c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
2127c478bd9Sstevel@tonic-gate extern int	sprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2137c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
2147c478bd9Sstevel@tonic-gate extern int	sscanf(const char *_RESTRICT_KYWD,
2157c478bd9Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, ...);
2167c478bd9Sstevel@tonic-gate extern int	vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2177c478bd9Sstevel@tonic-gate 			__va_list);
2187c478bd9Sstevel@tonic-gate extern int	vprintf(const char *_RESTRICT_KYWD, __va_list);
2197c478bd9Sstevel@tonic-gate extern int	vsprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2207c478bd9Sstevel@tonic-gate 			__va_list);
2217c478bd9Sstevel@tonic-gate extern int	fgetc(FILE *);
2227c478bd9Sstevel@tonic-gate extern char	*fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD);
2237c478bd9Sstevel@tonic-gate extern int	fputc(int, FILE *);
2247c478bd9Sstevel@tonic-gate extern int	fputs(const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
2257c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
2267c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2277c478bd9Sstevel@tonic-gate extern int	getc(FILE *);
2287c478bd9Sstevel@tonic-gate extern int	putc(int, FILE *);
2297c478bd9Sstevel@tonic-gate #endif
2307c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && defined(_REENTRANT)) || \
2317c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2327c478bd9Sstevel@tonic-gate extern int	getchar(void);
2337c478bd9Sstevel@tonic-gate extern int	putchar(int);
2347c478bd9Sstevel@tonic-gate #endif
235fc2512cfSRobert Mustacchi 
236fc2512cfSRobert Mustacchi /*
237fc2512cfSRobert Mustacchi  * ISO/IEC C11 removed gets from the standard library. Therefore if a strict C11
238fc2512cfSRobert Mustacchi  * environment has been requested, we remove it.
239fc2512cfSRobert Mustacchi  */
240fc2512cfSRobert Mustacchi #if !defined(_STDC_C11) || defined(__EXTENSIONS__)
2417c478bd9Sstevel@tonic-gate extern char	*gets(char *);
242fc2512cfSRobert Mustacchi #endif
2437c478bd9Sstevel@tonic-gate extern int	puts(const char *);
2447c478bd9Sstevel@tonic-gate extern int	ungetc(int, FILE *);
2457c478bd9Sstevel@tonic-gate extern size_t	fread(void *_RESTRICT_KYWD, size_t, size_t,
2467c478bd9Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
2477c478bd9Sstevel@tonic-gate extern size_t	fwrite(const void *_RESTRICT_KYWD, size_t, size_t,
2487c478bd9Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
2497c478bd9Sstevel@tonic-gate #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
2507c478bd9Sstevel@tonic-gate extern int	fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
2517c478bd9Sstevel@tonic-gate extern int	fsetpos(FILE *, const fpos_t *);
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate extern int	fseek(FILE *, long, int);
2547c478bd9Sstevel@tonic-gate extern long	ftell(FILE *);
2557c478bd9Sstevel@tonic-gate extern void	rewind(FILE *);
2567c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
2577c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2587c478bd9Sstevel@tonic-gate extern void	clearerr(FILE *);
2597c478bd9Sstevel@tonic-gate extern int	feof(FILE *);
2607c478bd9Sstevel@tonic-gate extern int	ferror(FILE *);
2617c478bd9Sstevel@tonic-gate #endif
2627c478bd9Sstevel@tonic-gate extern void	perror(const char *);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate #ifndef	_LP64
2657c478bd9Sstevel@tonic-gate extern int	__filbuf(FILE *);
2667c478bd9Sstevel@tonic-gate extern int	__flsbuf(int, FILE *);
2677c478bd9Sstevel@tonic-gate #endif	/*	_LP64	*/
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
2707c478bd9Sstevel@tonic-gate }
2717c478bd9Sstevel@tonic-gate #endif /* end of namespace std */
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate #if !defined(__lint)
2747c478bd9Sstevel@tonic-gate 
275693e4d84SAlexander Pyhalov #if	!defined(_REENTRANT) && !defined(_LP64)
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
2787c478bd9Sstevel@tonic-gate namespace std {
2797c478bd9Sstevel@tonic-gate inline int getc(FILE *_p) {
2807c478bd9Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
2817c478bd9Sstevel@tonic-gate inline int putc(int _x, FILE *_p) {
2827c478bd9Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
2837c478bd9Sstevel@tonic-gate 		: (int)(*_p->_ptr++ = (unsigned char) _x)); }
2847c478bd9Sstevel@tonic-gate }
2857c478bd9Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
2867c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
2877c478bd9Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
2887c478bd9Sstevel@tonic-gate 				: (int)(*(p)->_ptr++ = (unsigned char) (x)))
2897c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
29050b37527Smuffin 
291693e4d84SAlexander Pyhalov #endif /* !defined(_REENTRANT) && !defined(_LP64) */
29250b37527Smuffin 
29350b37527Smuffin #ifndef	_REENTRANT
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
2967c478bd9Sstevel@tonic-gate namespace std {
2977c478bd9Sstevel@tonic-gate inline int getchar() { return getc(stdin); }
2987c478bd9Sstevel@tonic-gate inline int putchar(int _x) { return putc(_x, stdout); }
2997c478bd9Sstevel@tonic-gate }
3007c478bd9Sstevel@tonic-gate #else
3017c478bd9Sstevel@tonic-gate #define	getchar()	getc(stdin)
3027c478bd9Sstevel@tonic-gate #define	putchar(x)	putc((x), stdout)
3037c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate #ifndef	_LP64
3067c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
3077c478bd9Sstevel@tonic-gate namespace std {
3087c478bd9Sstevel@tonic-gate inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
3097c478bd9Sstevel@tonic-gate inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
3107c478bd9Sstevel@tonic-gate inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
3117c478bd9Sstevel@tonic-gate }
3127c478bd9Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
3137c478bd9Sstevel@tonic-gate #define	clearerr(p)	((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
3147c478bd9Sstevel@tonic-gate #define	feof(p)		((p)->_flag & _IOEOF)
3157c478bd9Sstevel@tonic-gate #define	ferror(p)	((p)->_flag & _IOERR)
3167c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
3177c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate #endif	/* _REENTRANT */
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate #endif	/* !defined(__lint) */
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3247c478bd9Sstevel@tonic-gate }
3257c478bd9Sstevel@tonic-gate #endif
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate #endif	/* _ISO_STDIO_ISO_H */
328