xref: /titanic_44/usr/src/head/iso/stdio_iso.h (revision 693e4d84eb49b987c3d66cbcd4b13a5c6e9059bf)
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 /*
2350b37527Smuffin  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
2750b37527Smuffin /*	Copyright (c) 1988 AT&T	*/
2850b37527Smuffin /*	  All Rights Reserved  	*/
2950b37527Smuffin 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * An application should not include this header directly.  Instead it
327c478bd9Sstevel@tonic-gate  * should be included only through the inclusion of other Sun headers.
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  * The contents of this header is limited to identifiers specified in the
357c478bd9Sstevel@tonic-gate  * C Standard.  Any new identifiers specified in future amendments to the
367c478bd9Sstevel@tonic-gate  * C Standard must be placed in this header.  If these new identifiers
377c478bd9Sstevel@tonic-gate  * are required to also be in the C++ Standard "std" namespace, then for
387c478bd9Sstevel@tonic-gate  * anything other than macro definitions, corresponding "using" directives
397c478bd9Sstevel@tonic-gate  * must also be added to <stdio.h>.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * User-visible pieces of the ANSI C standard I/O package.
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifndef _ISO_STDIO_ISO_H
477c478bd9Sstevel@tonic-gate #define	_ISO_STDIO_ISO_H
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
507c478bd9Sstevel@tonic-gate #include <sys/va_list.h>
517c478bd9Sstevel@tonic-gate #include <stdio_tag.h>
527c478bd9Sstevel@tonic-gate #include <stdio_impl.h>
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * If feature test macros are set that enable interfaces that use types
567c478bd9Sstevel@tonic-gate  * defined in <sys/types.h>, get those types by doing the include.
577c478bd9Sstevel@tonic-gate  *
587c478bd9Sstevel@tonic-gate  * Note that in asking for the interfaces associated with this feature test
597c478bd9Sstevel@tonic-gate  * macro one also asks for definitions of the POSIX types.
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
637c478bd9Sstevel@tonic-gate extern "C" {
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * The following typedefs are adopted from ones in <sys/types.h> (with leading
697c478bd9Sstevel@tonic-gate  * underscores added to avoid polluting the ANSI C name space).  See the
707c478bd9Sstevel@tonic-gate  * commentary there for further explanation.
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE)
737c478bd9Sstevel@tonic-gate typedef	long long	__longlong_t;
747c478bd9Sstevel@tonic-gate #else
757c478bd9Sstevel@tonic-gate /* used to reserve space and generate alignment */
767c478bd9Sstevel@tonic-gate typedef union {
777c478bd9Sstevel@tonic-gate 	double	_d;
787c478bd9Sstevel@tonic-gate 	int	_l[2];
797c478bd9Sstevel@tonic-gate } __longlong_t;
807c478bd9Sstevel@tonic-gate #endif
817c478bd9Sstevel@tonic-gate #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
847c478bd9Sstevel@tonic-gate namespace std {
857c478bd9Sstevel@tonic-gate #endif
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #if !defined(_FILEDEFED) || __cplusplus >= 199711L
887c478bd9Sstevel@tonic-gate #define	_FILEDEFED
897c478bd9Sstevel@tonic-gate typedef	__FILE FILE;
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L
937c478bd9Sstevel@tonic-gate #define	_SIZE_T
947c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
957c478bd9Sstevel@tonic-gate typedef unsigned long	size_t;		/* size of something in bytes */
967c478bd9Sstevel@tonic-gate #else
977c478bd9Sstevel@tonic-gate typedef unsigned int	size_t;		/* (historical version) */
987c478bd9Sstevel@tonic-gate #endif
997c478bd9Sstevel@tonic-gate #endif	/* !_SIZE_T */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
1027c478bd9Sstevel@tonic-gate typedef long		fpos_t;
1037c478bd9Sstevel@tonic-gate #else
1047c478bd9Sstevel@tonic-gate typedef	__longlong_t	fpos_t;
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
1087c478bd9Sstevel@tonic-gate }
1097c478bd9Sstevel@tonic-gate #endif /* end of namespace std */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #ifndef	NULL
1127c478bd9Sstevel@tonic-gate #if defined(_LP64)
1137c478bd9Sstevel@tonic-gate #define	NULL	0L
1147c478bd9Sstevel@tonic-gate #else
1157c478bd9Sstevel@tonic-gate #define	NULL	0
1167c478bd9Sstevel@tonic-gate #endif
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #define	BUFSIZ	1024
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * The value of _NFILE is defined in the Processor Specific ABI.  The value
1237c478bd9Sstevel@tonic-gate  * is chosen for historical reasons rather than for truly processor related
1247c478bd9Sstevel@tonic-gate  * attribute.  Note that the SPARC Processor Specific ABI uses the common
1257c478bd9Sstevel@tonic-gate  * UNIX historical value of 20 so it is allowed to fall through.
1267c478bd9Sstevel@tonic-gate  */
1277c478bd9Sstevel@tonic-gate #if defined(__i386)
1287c478bd9Sstevel@tonic-gate #define	_NFILE	60	/* initial number of streams: Intel x86 ABI */
1297c478bd9Sstevel@tonic-gate #else
1307c478bd9Sstevel@tonic-gate #define	_NFILE	20	/* initial number of streams: SPARC ABI and default */
1317c478bd9Sstevel@tonic-gate #endif
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #define	_SBFSIZ	8	/* compatibility with shared libs */
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #define	_IOFBF		0000	/* full buffered */
1367c478bd9Sstevel@tonic-gate #define	_IOLBF		0100	/* line buffered */
1377c478bd9Sstevel@tonic-gate #define	_IONBF		0004	/* not buffered */
1387c478bd9Sstevel@tonic-gate #define	_IOEOF		0020	/* EOF reached on read */
1397c478bd9Sstevel@tonic-gate #define	_IOERR		0040	/* I/O error from system */
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #define	_IOREAD		0001	/* currently reading */
1427c478bd9Sstevel@tonic-gate #define	_IOWRT		0002	/* currently writing */
1437c478bd9Sstevel@tonic-gate #define	_IORW		0200	/* opened for reading and writing */
1447c478bd9Sstevel@tonic-gate #define	_IOMYBUF	0010	/* stdio malloc()'d buffer */
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #ifndef EOF
1477c478bd9Sstevel@tonic-gate #define	EOF	(-1)
1487c478bd9Sstevel@tonic-gate #endif
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #define	FOPEN_MAX	_NFILE
1517c478bd9Sstevel@tonic-gate #define	FILENAME_MAX    1024	/* max # of characters in a path name */
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	SEEK_SET	0
1547c478bd9Sstevel@tonic-gate #define	SEEK_CUR	1
1557c478bd9Sstevel@tonic-gate #define	SEEK_END	2
1567c478bd9Sstevel@tonic-gate #define	TMP_MAX		17576	/* 26 * 26 * 26 */
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate #define	L_tmpnam	25	/* (sizeof(P_tmpdir) + 15) */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #if defined(__STDC__)
1617c478bd9Sstevel@tonic-gate extern __FILE	__iob[_NFILE];
1627c478bd9Sstevel@tonic-gate #define	stdin	(&__iob[0])
1637c478bd9Sstevel@tonic-gate #define	stdout	(&__iob[1])
1647c478bd9Sstevel@tonic-gate #define	stderr	(&__iob[2])
1657c478bd9Sstevel@tonic-gate #else
1667c478bd9Sstevel@tonic-gate extern __FILE	_iob[_NFILE];
1677c478bd9Sstevel@tonic-gate #define	stdin	(&_iob[0])
1687c478bd9Sstevel@tonic-gate #define	stdout	(&_iob[1])
1697c478bd9Sstevel@tonic-gate #define	stderr	(&_iob[2])
1707c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
1737c478bd9Sstevel@tonic-gate namespace std {
1747c478bd9Sstevel@tonic-gate #endif
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
1797c478bd9Sstevel@tonic-gate #pragma redefine_extname fprintf	_fprintf_c89
1807c478bd9Sstevel@tonic-gate #pragma redefine_extname printf		_printf_c89
1817c478bd9Sstevel@tonic-gate #pragma redefine_extname sprintf	_sprintf_c89
1827c478bd9Sstevel@tonic-gate #pragma redefine_extname vfprintf	_vfprintf_c89
1837c478bd9Sstevel@tonic-gate #pragma redefine_extname vprintf	_vprintf_c89
1847c478bd9Sstevel@tonic-gate #pragma redefine_extname vsprintf	_vsprintf_c89
1857c478bd9Sstevel@tonic-gate #pragma redefine_extname fscanf		_fscanf_c89
1867c478bd9Sstevel@tonic-gate #pragma redefine_extname scanf		_scanf_c89
1877c478bd9Sstevel@tonic-gate #pragma redefine_extname sscanf		_sscanf_c89
1887c478bd9Sstevel@tonic-gate #else
1897c478bd9Sstevel@tonic-gate #define	fprintf		_fprintf_c89
1907c478bd9Sstevel@tonic-gate #define	printf		_printf_c89
1917c478bd9Sstevel@tonic-gate #define	sprintf		_sprintf_c89
1927c478bd9Sstevel@tonic-gate #define	vfprintf	_vfprintf_c89
1937c478bd9Sstevel@tonic-gate #define	vprintf		_vprintf_c89
1947c478bd9Sstevel@tonic-gate #define	vsprintf	_vsprintf_c89
1957c478bd9Sstevel@tonic-gate #define	fscanf		_fscanf_c89
1967c478bd9Sstevel@tonic-gate #define	scanf		_scanf_c89
1977c478bd9Sstevel@tonic-gate #define	sscanf		_sscanf_c89
1987c478bd9Sstevel@tonic-gate #endif
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate #if defined(__STDC__)
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate extern int	remove(const char *);
2057c478bd9Sstevel@tonic-gate extern int	rename(const char *, const char *);
2067c478bd9Sstevel@tonic-gate extern FILE	*tmpfile(void);
2077c478bd9Sstevel@tonic-gate extern char	*tmpnam(char *);
2087c478bd9Sstevel@tonic-gate extern int	fclose(FILE *);
2097c478bd9Sstevel@tonic-gate extern int	fflush(FILE *);
2107c478bd9Sstevel@tonic-gate extern FILE	*fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
2117c478bd9Sstevel@tonic-gate extern FILE	*freopen(const char *_RESTRICT_KYWD,
2127c478bd9Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
2137c478bd9Sstevel@tonic-gate extern void	setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
2147c478bd9Sstevel@tonic-gate extern int	setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
2157c478bd9Sstevel@tonic-gate 			size_t);
2167c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
2177c478bd9Sstevel@tonic-gate extern int	fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2187c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
2197c478bd9Sstevel@tonic-gate extern int	fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2207c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
2217c478bd9Sstevel@tonic-gate extern int	printf(const char *_RESTRICT_KYWD, ...);
2227c478bd9Sstevel@tonic-gate /* SCANFLIKE1 */
2237c478bd9Sstevel@tonic-gate extern int	scanf(const char *_RESTRICT_KYWD, ...);
2247c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
2257c478bd9Sstevel@tonic-gate extern int	sprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
2267c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
2277c478bd9Sstevel@tonic-gate extern int	sscanf(const char *_RESTRICT_KYWD,
2287c478bd9Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, ...);
2297c478bd9Sstevel@tonic-gate extern int	vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2307c478bd9Sstevel@tonic-gate 			__va_list);
2317c478bd9Sstevel@tonic-gate extern int	vprintf(const char *_RESTRICT_KYWD, __va_list);
2327c478bd9Sstevel@tonic-gate extern int	vsprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2337c478bd9Sstevel@tonic-gate 			__va_list);
2347c478bd9Sstevel@tonic-gate extern int	fgetc(FILE *);
2357c478bd9Sstevel@tonic-gate extern char	*fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD);
2367c478bd9Sstevel@tonic-gate extern int	fputc(int, FILE *);
2377c478bd9Sstevel@tonic-gate extern int	fputs(const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
2387c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
2397c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2407c478bd9Sstevel@tonic-gate extern int	getc(FILE *);
2417c478bd9Sstevel@tonic-gate extern int	putc(int, FILE *);
2427c478bd9Sstevel@tonic-gate #endif
2437c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && defined(_REENTRANT)) || \
2447c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2457c478bd9Sstevel@tonic-gate extern int	getchar(void);
2467c478bd9Sstevel@tonic-gate extern int	putchar(int);
2477c478bd9Sstevel@tonic-gate #endif
2487c478bd9Sstevel@tonic-gate extern char	*gets(char *);
2497c478bd9Sstevel@tonic-gate extern int	puts(const char *);
2507c478bd9Sstevel@tonic-gate extern int	ungetc(int, FILE *);
2517c478bd9Sstevel@tonic-gate extern size_t	fread(void *_RESTRICT_KYWD, size_t, size_t,
2527c478bd9Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
2537c478bd9Sstevel@tonic-gate extern size_t	fwrite(const void *_RESTRICT_KYWD, size_t, size_t,
2547c478bd9Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
2557c478bd9Sstevel@tonic-gate #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
2567c478bd9Sstevel@tonic-gate extern int	fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
2577c478bd9Sstevel@tonic-gate extern int	fsetpos(FILE *, const fpos_t *);
2587c478bd9Sstevel@tonic-gate #endif
2597c478bd9Sstevel@tonic-gate extern int	fseek(FILE *, long, int);
2607c478bd9Sstevel@tonic-gate extern long	ftell(FILE *);
2617c478bd9Sstevel@tonic-gate extern void	rewind(FILE *);
2627c478bd9Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
2637c478bd9Sstevel@tonic-gate 	__cplusplus < 199711L
2647c478bd9Sstevel@tonic-gate extern void	clearerr(FILE *);
2657c478bd9Sstevel@tonic-gate extern int	feof(FILE *);
2667c478bd9Sstevel@tonic-gate extern int	ferror(FILE *);
2677c478bd9Sstevel@tonic-gate #endif
2687c478bd9Sstevel@tonic-gate extern void	perror(const char *);
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate #ifndef	_LP64
2717c478bd9Sstevel@tonic-gate extern int	__filbuf(FILE *);
2727c478bd9Sstevel@tonic-gate extern int	__flsbuf(int, FILE *);
2737c478bd9Sstevel@tonic-gate #endif	/*	_LP64	*/
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #else	/* !defined __STDC__ */
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate extern int	remove();
2787c478bd9Sstevel@tonic-gate extern int	rename();
2797c478bd9Sstevel@tonic-gate extern FILE	*tmpfile();
2807c478bd9Sstevel@tonic-gate extern char	*tmpnam();
2817c478bd9Sstevel@tonic-gate extern int	fclose();
2827c478bd9Sstevel@tonic-gate extern int	fflush();
2837c478bd9Sstevel@tonic-gate extern FILE	*fopen();
2847c478bd9Sstevel@tonic-gate extern FILE	*freopen();
2857c478bd9Sstevel@tonic-gate extern void	setbuf();
2867c478bd9Sstevel@tonic-gate extern int	setvbuf();
2877c478bd9Sstevel@tonic-gate extern int	fprintf();
2887c478bd9Sstevel@tonic-gate extern int	fscanf();
2897c478bd9Sstevel@tonic-gate extern int	printf();
2907c478bd9Sstevel@tonic-gate extern int	scanf();
2917c478bd9Sstevel@tonic-gate extern int	sprintf();
2927c478bd9Sstevel@tonic-gate extern int	sscanf();
2937c478bd9Sstevel@tonic-gate extern int	vfprintf();
2947c478bd9Sstevel@tonic-gate extern int	vprintf();
2957c478bd9Sstevel@tonic-gate extern int	vsprintf();
2967c478bd9Sstevel@tonic-gate extern int	fgetc();
2977c478bd9Sstevel@tonic-gate extern char	*fgets();
2987c478bd9Sstevel@tonic-gate extern int	fputc();
2997c478bd9Sstevel@tonic-gate extern int	fputs();
3007c478bd9Sstevel@tonic-gate extern int	getc();
3017c478bd9Sstevel@tonic-gate extern int	getchar();
3027c478bd9Sstevel@tonic-gate extern char	*gets();
3037c478bd9Sstevel@tonic-gate extern int	putc();
3047c478bd9Sstevel@tonic-gate extern int	putchar();
3057c478bd9Sstevel@tonic-gate extern int	puts();
3067c478bd9Sstevel@tonic-gate extern int	ungetc();
3077c478bd9Sstevel@tonic-gate extern size_t	fread();
3087c478bd9Sstevel@tonic-gate extern size_t	fwrite();
3097c478bd9Sstevel@tonic-gate extern int	fgetpos();
3107c478bd9Sstevel@tonic-gate extern int	fseek();
3117c478bd9Sstevel@tonic-gate extern int	fsetpos();
3127c478bd9Sstevel@tonic-gate extern long	ftell();
3137c478bd9Sstevel@tonic-gate extern void	rewind();
3147c478bd9Sstevel@tonic-gate extern void	clearerr();
3157c478bd9Sstevel@tonic-gate extern int	feof();
3167c478bd9Sstevel@tonic-gate extern int	ferror();
3177c478bd9Sstevel@tonic-gate extern void	perror();
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate #ifndef	_LP64
3207c478bd9Sstevel@tonic-gate extern int	_filbuf();
3217c478bd9Sstevel@tonic-gate extern int	_flsbuf();
3227c478bd9Sstevel@tonic-gate #endif	/*	_LP64	*/
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate #endif /* end of namespace std */
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #if !defined(__lint)
3317c478bd9Sstevel@tonic-gate 
332*693e4d84SAlexander Pyhalov #if	!defined(_REENTRANT) && !defined(_LP64)
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate #ifdef	__STDC__
3357c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
3367c478bd9Sstevel@tonic-gate namespace std {
3377c478bd9Sstevel@tonic-gate inline int getc(FILE *_p) {
3387c478bd9Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
3397c478bd9Sstevel@tonic-gate inline int putc(int _x, FILE *_p) {
3407c478bd9Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
3417c478bd9Sstevel@tonic-gate 		: (int)(*_p->_ptr++ = (unsigned char) _x)); }
3427c478bd9Sstevel@tonic-gate }
3437c478bd9Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
3447c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
3457c478bd9Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
3467c478bd9Sstevel@tonic-gate 				: (int)(*(p)->_ptr++ = (unsigned char) (x)))
3477c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
3487c478bd9Sstevel@tonic-gate #else /* __STDC__ */
3497c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
3507c478bd9Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
3517c478bd9Sstevel@tonic-gate 				(int)(*(p)->_ptr++ = (unsigned char) (x)))
3527c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
35350b37527Smuffin 
354*693e4d84SAlexander Pyhalov #endif /* !defined(_REENTRANT) && !defined(_LP64) */
35550b37527Smuffin 
35650b37527Smuffin #ifndef	_REENTRANT
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
3597c478bd9Sstevel@tonic-gate namespace std {
3607c478bd9Sstevel@tonic-gate inline int getchar() { return getc(stdin); }
3617c478bd9Sstevel@tonic-gate inline int putchar(int _x) { return putc(_x, stdout); }
3627c478bd9Sstevel@tonic-gate }
3637c478bd9Sstevel@tonic-gate #else
3647c478bd9Sstevel@tonic-gate #define	getchar()	getc(stdin)
3657c478bd9Sstevel@tonic-gate #define	putchar(x)	putc((x), stdout)
3667c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #ifndef	_LP64
3697c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
3707c478bd9Sstevel@tonic-gate namespace std {
3717c478bd9Sstevel@tonic-gate inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
3727c478bd9Sstevel@tonic-gate inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
3737c478bd9Sstevel@tonic-gate inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
3747c478bd9Sstevel@tonic-gate }
3757c478bd9Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
3767c478bd9Sstevel@tonic-gate #define	clearerr(p)	((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
3777c478bd9Sstevel@tonic-gate #define	feof(p)		((p)->_flag & _IOEOF)
3787c478bd9Sstevel@tonic-gate #define	ferror(p)	((p)->_flag & _IOERR)
3797c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
3807c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate #endif	/* _REENTRANT */
3837c478bd9Sstevel@tonic-gate 
3847c478bd9Sstevel@tonic-gate #endif	/* !defined(__lint) */
3857c478bd9Sstevel@tonic-gate 
3867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3877c478bd9Sstevel@tonic-gate }
3887c478bd9Sstevel@tonic-gate #endif
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate #endif	/* _ISO_STDIO_ISO_H */
391