xref: /onnv-gate/usr/src/head/iso/stdio_iso.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
23*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*0Sstevel@tonic-gate  * Use is subject to license terms.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate /*
32*0Sstevel@tonic-gate  * An application should not include this header directly.  Instead it
33*0Sstevel@tonic-gate  * should be included only through the inclusion of other Sun headers.
34*0Sstevel@tonic-gate  *
35*0Sstevel@tonic-gate  * The contents of this header is limited to identifiers specified in the
36*0Sstevel@tonic-gate  * C Standard.  Any new identifiers specified in future amendments to the
37*0Sstevel@tonic-gate  * C Standard must be placed in this header.  If these new identifiers
38*0Sstevel@tonic-gate  * are required to also be in the C++ Standard "std" namespace, then for
39*0Sstevel@tonic-gate  * anything other than macro definitions, corresponding "using" directives
40*0Sstevel@tonic-gate  * must also be added to <stdio.h>.
41*0Sstevel@tonic-gate  */
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate /*
44*0Sstevel@tonic-gate  * User-visible pieces of the ANSI C standard I/O package.
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #ifndef _ISO_STDIO_ISO_H
48*0Sstevel@tonic-gate #define	_ISO_STDIO_ISO_H
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate #include <sys/feature_tests.h>
53*0Sstevel@tonic-gate #include <sys/va_list.h>
54*0Sstevel@tonic-gate #include <stdio_tag.h>
55*0Sstevel@tonic-gate #include <stdio_impl.h>
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate /*
58*0Sstevel@tonic-gate  * If feature test macros are set that enable interfaces that use types
59*0Sstevel@tonic-gate  * defined in <sys/types.h>, get those types by doing the include.
60*0Sstevel@tonic-gate  *
61*0Sstevel@tonic-gate  * Note that in asking for the interfaces associated with this feature test
62*0Sstevel@tonic-gate  * macro one also asks for definitions of the POSIX types.
63*0Sstevel@tonic-gate  */
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate #ifdef	__cplusplus
66*0Sstevel@tonic-gate extern "C" {
67*0Sstevel@tonic-gate #endif
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
70*0Sstevel@tonic-gate /*
71*0Sstevel@tonic-gate  * The following typedefs are adopted from ones in <sys/types.h> (with leading
72*0Sstevel@tonic-gate  * underscores added to avoid polluting the ANSI C name space).  See the
73*0Sstevel@tonic-gate  * commentary there for further explanation.
74*0Sstevel@tonic-gate  */
75*0Sstevel@tonic-gate #if defined(_LONGLONG_TYPE)
76*0Sstevel@tonic-gate typedef	long long	__longlong_t;
77*0Sstevel@tonic-gate #else
78*0Sstevel@tonic-gate /* used to reserve space and generate alignment */
79*0Sstevel@tonic-gate typedef union {
80*0Sstevel@tonic-gate 	double	_d;
81*0Sstevel@tonic-gate 	int	_l[2];
82*0Sstevel@tonic-gate } __longlong_t;
83*0Sstevel@tonic-gate #endif
84*0Sstevel@tonic-gate #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate #if __cplusplus >= 199711L
87*0Sstevel@tonic-gate namespace std {
88*0Sstevel@tonic-gate #endif
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate #if !defined(_FILEDEFED) || __cplusplus >= 199711L
91*0Sstevel@tonic-gate #define	_FILEDEFED
92*0Sstevel@tonic-gate typedef	__FILE FILE;
93*0Sstevel@tonic-gate #endif
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L
96*0Sstevel@tonic-gate #define	_SIZE_T
97*0Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
98*0Sstevel@tonic-gate typedef unsigned long	size_t;		/* size of something in bytes */
99*0Sstevel@tonic-gate #else
100*0Sstevel@tonic-gate typedef unsigned int	size_t;		/* (historical version) */
101*0Sstevel@tonic-gate #endif
102*0Sstevel@tonic-gate #endif	/* !_SIZE_T */
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
105*0Sstevel@tonic-gate typedef long		fpos_t;
106*0Sstevel@tonic-gate #else
107*0Sstevel@tonic-gate typedef	__longlong_t	fpos_t;
108*0Sstevel@tonic-gate #endif
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate #if __cplusplus >= 199711L
111*0Sstevel@tonic-gate }
112*0Sstevel@tonic-gate #endif /* end of namespace std */
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate #ifndef	NULL
115*0Sstevel@tonic-gate #if defined(_LP64)
116*0Sstevel@tonic-gate #define	NULL	0L
117*0Sstevel@tonic-gate #else
118*0Sstevel@tonic-gate #define	NULL	0
119*0Sstevel@tonic-gate #endif
120*0Sstevel@tonic-gate #endif
121*0Sstevel@tonic-gate 
122*0Sstevel@tonic-gate #define	BUFSIZ	1024
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate /*
125*0Sstevel@tonic-gate  * The value of _NFILE is defined in the Processor Specific ABI.  The value
126*0Sstevel@tonic-gate  * is chosen for historical reasons rather than for truly processor related
127*0Sstevel@tonic-gate  * attribute.  Note that the SPARC Processor Specific ABI uses the common
128*0Sstevel@tonic-gate  * UNIX historical value of 20 so it is allowed to fall through.
129*0Sstevel@tonic-gate  */
130*0Sstevel@tonic-gate #if defined(__i386)
131*0Sstevel@tonic-gate #define	_NFILE	60	/* initial number of streams: Intel x86 ABI */
132*0Sstevel@tonic-gate #else
133*0Sstevel@tonic-gate #define	_NFILE	20	/* initial number of streams: SPARC ABI and default */
134*0Sstevel@tonic-gate #endif
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate #define	_SBFSIZ	8	/* compatibility with shared libs */
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate #define	_IOFBF		0000	/* full buffered */
139*0Sstevel@tonic-gate #define	_IOLBF		0100	/* line buffered */
140*0Sstevel@tonic-gate #define	_IONBF		0004	/* not buffered */
141*0Sstevel@tonic-gate #define	_IOEOF		0020	/* EOF reached on read */
142*0Sstevel@tonic-gate #define	_IOERR		0040	/* I/O error from system */
143*0Sstevel@tonic-gate 
144*0Sstevel@tonic-gate #define	_IOREAD		0001	/* currently reading */
145*0Sstevel@tonic-gate #define	_IOWRT		0002	/* currently writing */
146*0Sstevel@tonic-gate #define	_IORW		0200	/* opened for reading and writing */
147*0Sstevel@tonic-gate #define	_IOMYBUF	0010	/* stdio malloc()'d buffer */
148*0Sstevel@tonic-gate 
149*0Sstevel@tonic-gate #ifndef EOF
150*0Sstevel@tonic-gate #define	EOF	(-1)
151*0Sstevel@tonic-gate #endif
152*0Sstevel@tonic-gate 
153*0Sstevel@tonic-gate #define	FOPEN_MAX	_NFILE
154*0Sstevel@tonic-gate #define	FILENAME_MAX    1024	/* max # of characters in a path name */
155*0Sstevel@tonic-gate 
156*0Sstevel@tonic-gate #define	SEEK_SET	0
157*0Sstevel@tonic-gate #define	SEEK_CUR	1
158*0Sstevel@tonic-gate #define	SEEK_END	2
159*0Sstevel@tonic-gate #define	TMP_MAX		17576	/* 26 * 26 * 26 */
160*0Sstevel@tonic-gate 
161*0Sstevel@tonic-gate #define	L_tmpnam	25	/* (sizeof(P_tmpdir) + 15) */
162*0Sstevel@tonic-gate 
163*0Sstevel@tonic-gate #if defined(__STDC__)
164*0Sstevel@tonic-gate extern __FILE	__iob[_NFILE];
165*0Sstevel@tonic-gate #define	stdin	(&__iob[0])
166*0Sstevel@tonic-gate #define	stdout	(&__iob[1])
167*0Sstevel@tonic-gate #define	stderr	(&__iob[2])
168*0Sstevel@tonic-gate #else
169*0Sstevel@tonic-gate extern __FILE	_iob[_NFILE];
170*0Sstevel@tonic-gate #define	stdin	(&_iob[0])
171*0Sstevel@tonic-gate #define	stdout	(&_iob[1])
172*0Sstevel@tonic-gate #define	stderr	(&_iob[2])
173*0Sstevel@tonic-gate #endif	/* __STDC__ */
174*0Sstevel@tonic-gate 
175*0Sstevel@tonic-gate #if __cplusplus >= 199711L
176*0Sstevel@tonic-gate namespace std {
177*0Sstevel@tonic-gate #endif
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
182*0Sstevel@tonic-gate #pragma redefine_extname fprintf	_fprintf_c89
183*0Sstevel@tonic-gate #pragma redefine_extname printf		_printf_c89
184*0Sstevel@tonic-gate #pragma redefine_extname sprintf	_sprintf_c89
185*0Sstevel@tonic-gate #pragma redefine_extname vfprintf	_vfprintf_c89
186*0Sstevel@tonic-gate #pragma redefine_extname vprintf	_vprintf_c89
187*0Sstevel@tonic-gate #pragma redefine_extname vsprintf	_vsprintf_c89
188*0Sstevel@tonic-gate #pragma redefine_extname fscanf		_fscanf_c89
189*0Sstevel@tonic-gate #pragma redefine_extname scanf		_scanf_c89
190*0Sstevel@tonic-gate #pragma redefine_extname sscanf		_sscanf_c89
191*0Sstevel@tonic-gate #else
192*0Sstevel@tonic-gate #define	fprintf		_fprintf_c89
193*0Sstevel@tonic-gate #define	printf		_printf_c89
194*0Sstevel@tonic-gate #define	sprintf		_sprintf_c89
195*0Sstevel@tonic-gate #define	vfprintf	_vfprintf_c89
196*0Sstevel@tonic-gate #define	vprintf		_vprintf_c89
197*0Sstevel@tonic-gate #define	vsprintf	_vsprintf_c89
198*0Sstevel@tonic-gate #define	fscanf		_fscanf_c89
199*0Sstevel@tonic-gate #define	scanf		_scanf_c89
200*0Sstevel@tonic-gate #define	sscanf		_sscanf_c89
201*0Sstevel@tonic-gate #endif
202*0Sstevel@tonic-gate 
203*0Sstevel@tonic-gate #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
204*0Sstevel@tonic-gate 
205*0Sstevel@tonic-gate #if defined(__STDC__)
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate extern int	remove(const char *);
208*0Sstevel@tonic-gate extern int	rename(const char *, const char *);
209*0Sstevel@tonic-gate extern FILE	*tmpfile(void);
210*0Sstevel@tonic-gate extern char	*tmpnam(char *);
211*0Sstevel@tonic-gate extern int	fclose(FILE *);
212*0Sstevel@tonic-gate extern int	fflush(FILE *);
213*0Sstevel@tonic-gate extern FILE	*fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
214*0Sstevel@tonic-gate extern FILE	*freopen(const char *_RESTRICT_KYWD,
215*0Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
216*0Sstevel@tonic-gate extern void	setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
217*0Sstevel@tonic-gate extern int	setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
218*0Sstevel@tonic-gate 			size_t);
219*0Sstevel@tonic-gate /* PRINTFLIKE2 */
220*0Sstevel@tonic-gate extern int	fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
221*0Sstevel@tonic-gate /* SCANFLIKE2 */
222*0Sstevel@tonic-gate extern int	fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
223*0Sstevel@tonic-gate /* PRINTFLIKE1 */
224*0Sstevel@tonic-gate extern int	printf(const char *_RESTRICT_KYWD, ...);
225*0Sstevel@tonic-gate /* SCANFLIKE1 */
226*0Sstevel@tonic-gate extern int	scanf(const char *_RESTRICT_KYWD, ...);
227*0Sstevel@tonic-gate /* PRINTFLIKE2 */
228*0Sstevel@tonic-gate extern int	sprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
229*0Sstevel@tonic-gate /* SCANFLIKE2 */
230*0Sstevel@tonic-gate extern int	sscanf(const char *_RESTRICT_KYWD,
231*0Sstevel@tonic-gate 			const char *_RESTRICT_KYWD, ...);
232*0Sstevel@tonic-gate extern int	vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
233*0Sstevel@tonic-gate 			__va_list);
234*0Sstevel@tonic-gate extern int	vprintf(const char *_RESTRICT_KYWD, __va_list);
235*0Sstevel@tonic-gate extern int	vsprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
236*0Sstevel@tonic-gate 			__va_list);
237*0Sstevel@tonic-gate extern int	fgetc(FILE *);
238*0Sstevel@tonic-gate extern char	*fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD);
239*0Sstevel@tonic-gate extern int	fputc(int, FILE *);
240*0Sstevel@tonic-gate extern int	fputs(const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
241*0Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
242*0Sstevel@tonic-gate 	__cplusplus < 199711L
243*0Sstevel@tonic-gate extern int	getc(FILE *);
244*0Sstevel@tonic-gate extern int	putc(int, FILE *);
245*0Sstevel@tonic-gate #endif
246*0Sstevel@tonic-gate #if (__cplusplus >= 199711L && defined(_REENTRANT)) || \
247*0Sstevel@tonic-gate 	__cplusplus < 199711L
248*0Sstevel@tonic-gate extern int	getchar(void);
249*0Sstevel@tonic-gate extern int	putchar(int);
250*0Sstevel@tonic-gate #endif
251*0Sstevel@tonic-gate extern char	*gets(char *);
252*0Sstevel@tonic-gate extern int	puts(const char *);
253*0Sstevel@tonic-gate extern int	ungetc(int, FILE *);
254*0Sstevel@tonic-gate extern size_t	fread(void *_RESTRICT_KYWD, size_t, size_t,
255*0Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
256*0Sstevel@tonic-gate extern size_t	fwrite(const void *_RESTRICT_KYWD, size_t, size_t,
257*0Sstevel@tonic-gate 	FILE *_RESTRICT_KYWD);
258*0Sstevel@tonic-gate #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
259*0Sstevel@tonic-gate extern int	fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
260*0Sstevel@tonic-gate extern int	fsetpos(FILE *, const fpos_t *);
261*0Sstevel@tonic-gate #endif
262*0Sstevel@tonic-gate extern int	fseek(FILE *, long, int);
263*0Sstevel@tonic-gate extern long	ftell(FILE *);
264*0Sstevel@tonic-gate extern void	rewind(FILE *);
265*0Sstevel@tonic-gate #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
266*0Sstevel@tonic-gate 	__cplusplus < 199711L
267*0Sstevel@tonic-gate extern void	clearerr(FILE *);
268*0Sstevel@tonic-gate extern int	feof(FILE *);
269*0Sstevel@tonic-gate extern int	ferror(FILE *);
270*0Sstevel@tonic-gate #endif
271*0Sstevel@tonic-gate extern void	perror(const char *);
272*0Sstevel@tonic-gate 
273*0Sstevel@tonic-gate #ifndef	_LP64
274*0Sstevel@tonic-gate extern int	__filbuf(FILE *);
275*0Sstevel@tonic-gate extern int	__flsbuf(int, FILE *);
276*0Sstevel@tonic-gate #endif	/*	_LP64	*/
277*0Sstevel@tonic-gate 
278*0Sstevel@tonic-gate #else	/* !defined __STDC__ */
279*0Sstevel@tonic-gate 
280*0Sstevel@tonic-gate extern int	remove();
281*0Sstevel@tonic-gate extern int	rename();
282*0Sstevel@tonic-gate extern FILE	*tmpfile();
283*0Sstevel@tonic-gate extern char	*tmpnam();
284*0Sstevel@tonic-gate extern int	fclose();
285*0Sstevel@tonic-gate extern int	fflush();
286*0Sstevel@tonic-gate extern FILE	*fopen();
287*0Sstevel@tonic-gate extern FILE	*freopen();
288*0Sstevel@tonic-gate extern void	setbuf();
289*0Sstevel@tonic-gate extern int	setvbuf();
290*0Sstevel@tonic-gate extern int	fprintf();
291*0Sstevel@tonic-gate extern int	fscanf();
292*0Sstevel@tonic-gate extern int	printf();
293*0Sstevel@tonic-gate extern int	scanf();
294*0Sstevel@tonic-gate extern int	sprintf();
295*0Sstevel@tonic-gate extern int	sscanf();
296*0Sstevel@tonic-gate extern int	vfprintf();
297*0Sstevel@tonic-gate extern int	vprintf();
298*0Sstevel@tonic-gate extern int	vsprintf();
299*0Sstevel@tonic-gate extern int	fgetc();
300*0Sstevel@tonic-gate extern char	*fgets();
301*0Sstevel@tonic-gate extern int	fputc();
302*0Sstevel@tonic-gate extern int	fputs();
303*0Sstevel@tonic-gate extern int	getc();
304*0Sstevel@tonic-gate extern int	getchar();
305*0Sstevel@tonic-gate extern char	*gets();
306*0Sstevel@tonic-gate extern int	putc();
307*0Sstevel@tonic-gate extern int	putchar();
308*0Sstevel@tonic-gate extern int	puts();
309*0Sstevel@tonic-gate extern int	ungetc();
310*0Sstevel@tonic-gate extern size_t	fread();
311*0Sstevel@tonic-gate extern size_t	fwrite();
312*0Sstevel@tonic-gate extern int	fgetpos();
313*0Sstevel@tonic-gate extern int	fseek();
314*0Sstevel@tonic-gate extern int	fsetpos();
315*0Sstevel@tonic-gate extern long	ftell();
316*0Sstevel@tonic-gate extern void	rewind();
317*0Sstevel@tonic-gate extern void	clearerr();
318*0Sstevel@tonic-gate extern int	feof();
319*0Sstevel@tonic-gate extern int	ferror();
320*0Sstevel@tonic-gate extern void	perror();
321*0Sstevel@tonic-gate 
322*0Sstevel@tonic-gate #ifndef	_LP64
323*0Sstevel@tonic-gate extern int	_filbuf();
324*0Sstevel@tonic-gate extern int	_flsbuf();
325*0Sstevel@tonic-gate #endif	/*	_LP64	*/
326*0Sstevel@tonic-gate 
327*0Sstevel@tonic-gate #endif	/* __STDC__ */
328*0Sstevel@tonic-gate 
329*0Sstevel@tonic-gate #if __cplusplus >= 199711L
330*0Sstevel@tonic-gate }
331*0Sstevel@tonic-gate #endif /* end of namespace std */
332*0Sstevel@tonic-gate 
333*0Sstevel@tonic-gate #if !defined(__lint)
334*0Sstevel@tonic-gate 
335*0Sstevel@tonic-gate #ifndef	_REENTRANT
336*0Sstevel@tonic-gate 
337*0Sstevel@tonic-gate #ifndef	_LP64
338*0Sstevel@tonic-gate #ifdef	__STDC__
339*0Sstevel@tonic-gate #if __cplusplus >= 199711L
340*0Sstevel@tonic-gate namespace std {
341*0Sstevel@tonic-gate inline int getc(FILE *_p) {
342*0Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
343*0Sstevel@tonic-gate inline int putc(int _x, FILE *_p) {
344*0Sstevel@tonic-gate 	return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
345*0Sstevel@tonic-gate 		: (int)(*_p->_ptr++ = (unsigned char) _x)); }
346*0Sstevel@tonic-gate }
347*0Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
348*0Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
349*0Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
350*0Sstevel@tonic-gate 				: (int)(*(p)->_ptr++ = (unsigned char) (x)))
351*0Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
352*0Sstevel@tonic-gate #else /* __STDC__ */
353*0Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
354*0Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
355*0Sstevel@tonic-gate 				(int)(*(p)->_ptr++ = (unsigned char) (x)))
356*0Sstevel@tonic-gate #endif	/* __STDC__ */
357*0Sstevel@tonic-gate #endif	/* _LP64 */
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate #if __cplusplus >= 199711L
360*0Sstevel@tonic-gate namespace std {
361*0Sstevel@tonic-gate inline int getchar() { return getc(stdin); }
362*0Sstevel@tonic-gate inline int putchar(int _x) { return putc(_x, stdout); }
363*0Sstevel@tonic-gate }
364*0Sstevel@tonic-gate #else
365*0Sstevel@tonic-gate #define	getchar()	getc(stdin)
366*0Sstevel@tonic-gate #define	putchar(x)	putc((x), stdout)
367*0Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
368*0Sstevel@tonic-gate 
369*0Sstevel@tonic-gate #ifndef	_LP64
370*0Sstevel@tonic-gate #if __cplusplus >= 199711L
371*0Sstevel@tonic-gate namespace std {
372*0Sstevel@tonic-gate inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
373*0Sstevel@tonic-gate inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
374*0Sstevel@tonic-gate inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
375*0Sstevel@tonic-gate }
376*0Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
377*0Sstevel@tonic-gate #define	clearerr(p)	((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
378*0Sstevel@tonic-gate #define	feof(p)		((p)->_flag & _IOEOF)
379*0Sstevel@tonic-gate #define	ferror(p)	((p)->_flag & _IOERR)
380*0Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
381*0Sstevel@tonic-gate #endif	/* _LP64 */
382*0Sstevel@tonic-gate 
383*0Sstevel@tonic-gate #endif	/* _REENTRANT */
384*0Sstevel@tonic-gate 
385*0Sstevel@tonic-gate #endif	/* !defined(__lint) */
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate #ifdef	__cplusplus
388*0Sstevel@tonic-gate }
389*0Sstevel@tonic-gate #endif
390*0Sstevel@tonic-gate 
391*0Sstevel@tonic-gate #endif	/* _ISO_STDIO_ISO_H */
392