xref: /illumos-gate/usr/src/ucbhead/stdio.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate /*
41*7c478bd9Sstevel@tonic-gate  * User-visible pieces of the ANSI C standard I/O package.
42*7c478bd9Sstevel@tonic-gate  */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #ifndef _STDIO_H
45*7c478bd9Sstevel@tonic-gate #define	_STDIO_H
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
50*7c478bd9Sstevel@tonic-gate #include <sys/va_list.h>
51*7c478bd9Sstevel@tonic-gate #include <stdio_tag.h>
52*7c478bd9Sstevel@tonic-gate #include <stdio_impl.h>
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
55*7c478bd9Sstevel@tonic-gate extern "C" {
56*7c478bd9Sstevel@tonic-gate #endif
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate #ifndef BSD
59*7c478bd9Sstevel@tonic-gate #define	BSD
60*7c478bd9Sstevel@tonic-gate #endif
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate #ifndef _SIZE_T
63*7c478bd9Sstevel@tonic-gate #define	_SIZE_T
64*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(__cplusplus)
65*7c478bd9Sstevel@tonic-gate typedef unsigned int	size_t;
66*7c478bd9Sstevel@tonic-gate #else
67*7c478bd9Sstevel@tonic-gate typedef unsigned long	size_t;
68*7c478bd9Sstevel@tonic-gate #endif
69*7c478bd9Sstevel@tonic-gate #endif
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #ifndef _SSIZE_T
72*7c478bd9Sstevel@tonic-gate #define	_SSIZE_T
73*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(__cplusplus)
74*7c478bd9Sstevel@tonic-gate typedef int	ssize_t;
75*7c478bd9Sstevel@tonic-gate #else
76*7c478bd9Sstevel@tonic-gate typedef long	ssize_t;
77*7c478bd9Sstevel@tonic-gate #endif
78*7c478bd9Sstevel@tonic-gate #endif
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate typedef long	fpos_t;
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate #ifndef NULL
83*7c478bd9Sstevel@tonic-gate #define	NULL		0
84*7c478bd9Sstevel@tonic-gate #endif
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate #if #machine(pdp11)
89*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		512
90*7c478bd9Sstevel@tonic-gate #define	_STDIO_REVERSE
91*7c478bd9Sstevel@tonic-gate #elif #machine(u370)
92*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		4096
93*7c478bd9Sstevel@tonic-gate #define	_STDIO_REVERSE
94*7c478bd9Sstevel@tonic-gate #define	_STDIO_ALLOCATE
95*7c478bd9Sstevel@tonic-gate #else
96*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		1024
97*7c478bd9Sstevel@tonic-gate #endif
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate #else	/* !defined(__STDC__) */
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #if pdp11 || u370
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate #if pdp11
104*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		512
105*7c478bd9Sstevel@tonic-gate #define	_STDIO_REVERSE
106*7c478bd9Sstevel@tonic-gate #else 	/* u370 */
107*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		4096
108*7c478bd9Sstevel@tonic-gate #define	_STDIO_REVERSE
109*7c478bd9Sstevel@tonic-gate #define	_STDIO_ALLOCATE
110*7c478bd9Sstevel@tonic-gate #endif
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate #else
113*7c478bd9Sstevel@tonic-gate #define	BUFSIZ		1024
114*7c478bd9Sstevel@tonic-gate #endif
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #if defined(__i386)
119*7c478bd9Sstevel@tonic-gate #define	_NFILE	60	/* initial number of streams: Intel x86 ABI */
120*7c478bd9Sstevel@tonic-gate #else
121*7c478bd9Sstevel@tonic-gate #define	_NFILE	20	/* initial number of streams: SPARC ABI and default */
122*7c478bd9Sstevel@tonic-gate #endif
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #define	_SBFSIZ	8	/* compatibility with shared libs */
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #define	_IOFBF		0000	/* full buffered */
127*7c478bd9Sstevel@tonic-gate #define	_IOLBF		0100	/* line buffered */
128*7c478bd9Sstevel@tonic-gate #define	_IONBF		0004	/* not buffered */
129*7c478bd9Sstevel@tonic-gate #define	_IOEOF		0020	/* EOF reached on read */
130*7c478bd9Sstevel@tonic-gate #define	_IOERR		0040	/* I/O error from system */
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate #define	_IOREAD		0001	/* currently reading */
133*7c478bd9Sstevel@tonic-gate #define	_IOWRT		0002	/* currently writing */
134*7c478bd9Sstevel@tonic-gate #define	_IORW		0200	/* opened for reading and writing */
135*7c478bd9Sstevel@tonic-gate #define	_IOMYBUF	0010	/* stdio malloc()'d buffer */
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate #ifndef EOF
138*7c478bd9Sstevel@tonic-gate #define	EOF	(-1)
139*7c478bd9Sstevel@tonic-gate #endif
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #define	FOPEN_MAX	_NFILE
142*7c478bd9Sstevel@tonic-gate #define	FILENAME_MAX    1024	/* max # of characters in a path name */
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #define	SEEK_SET	0
145*7c478bd9Sstevel@tonic-gate #define	SEEK_CUR	1
146*7c478bd9Sstevel@tonic-gate #define	SEEK_END	2
147*7c478bd9Sstevel@tonic-gate #define	TMP_MAX		17576	/* 26 * 26 * 26 */
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
150*7c478bd9Sstevel@tonic-gate #define	L_ctermid	9
151*7c478bd9Sstevel@tonic-gate #define	L_cuserid	9
152*7c478bd9Sstevel@tonic-gate #define	P_tmpdir	"/var/tmp/"
153*7c478bd9Sstevel@tonic-gate #endif
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #define	L_tmpnam	25	/* (sizeof(P_tmpdir) + 15) */
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
158*7c478bd9Sstevel@tonic-gate #define	stdin	(&__iob[0])
159*7c478bd9Sstevel@tonic-gate #define	stdout	(&__iob[1])
160*7c478bd9Sstevel@tonic-gate #define	stderr	(&__iob[2])
161*7c478bd9Sstevel@tonic-gate #else
162*7c478bd9Sstevel@tonic-gate #define	stdin	(&_iob[0])
163*7c478bd9Sstevel@tonic-gate #define	stdout	(&_iob[1])
164*7c478bd9Sstevel@tonic-gate #define	stderr	(&_iob[2])
165*7c478bd9Sstevel@tonic-gate #endif
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate #ifndef	_FILEDEFED
168*7c478bd9Sstevel@tonic-gate #define	_FILEDEFED
169*7c478bd9Sstevel@tonic-gate typedef	__FILE FILE;
170*7c478bd9Sstevel@tonic-gate #endif
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
173*7c478bd9Sstevel@tonic-gate extern FILE		__iob[_NFILE];
174*7c478bd9Sstevel@tonic-gate #else
175*7c478bd9Sstevel@tonic-gate extern FILE		_iob[_NFILE];
176*7c478bd9Sstevel@tonic-gate #endif
177*7c478bd9Sstevel@tonic-gate extern FILE		*_lastbuf;
178*7c478bd9Sstevel@tonic-gate extern unsigned char 	*_bufendtab[];
179*7c478bd9Sstevel@tonic-gate #ifndef _STDIO_ALLOCATE
180*7c478bd9Sstevel@tonic-gate extern unsigned char	 _sibuf[], _sobuf[];
181*7c478bd9Sstevel@tonic-gate #endif
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate /* Large file interfaces */
184*7c478bd9Sstevel@tonic-gate /* transition back from explicit 64-bit offset to implicit (64-bit) offset */
185*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
186*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
187*7c478bd9Sstevel@tonic-gate #pragma redefine_extname	fopen64		fopen
188*7c478bd9Sstevel@tonic-gate #pragma redefine_extname	freopen64	freopen
189*7c478bd9Sstevel@tonic-gate #else
190*7c478bd9Sstevel@tonic-gate #define	fopen64			fopen
191*7c478bd9Sstevel@tonic-gate #define	freopen64		freopen
192*7c478bd9Sstevel@tonic-gate #endif
193*7c478bd9Sstevel@tonic-gate #endif
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate /* transition from 32-bit offset to explicit 64-bit offset */
196*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64)
197*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
198*7c478bd9Sstevel@tonic-gate #pragma redefine_extname	fopen		fopen64
199*7c478bd9Sstevel@tonic-gate #pragma redefine_extname	freopen		freopen64
200*7c478bd9Sstevel@tonic-gate #else
201*7c478bd9Sstevel@tonic-gate #define	fopen			fopen64
202*7c478bd9Sstevel@tonic-gate #define	freopen			freopen64
203*7c478bd9Sstevel@tonic-gate #endif
204*7c478bd9Sstevel@tonic-gate #endif
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate extern int	remove(const char *);
209*7c478bd9Sstevel@tonic-gate extern int	rename(const char *, const char *);
210*7c478bd9Sstevel@tonic-gate extern int	fclose(FILE *);
211*7c478bd9Sstevel@tonic-gate extern int	fflush(FILE *);
212*7c478bd9Sstevel@tonic-gate extern FILE	*fopen(const char *, const char *);
213*7c478bd9Sstevel@tonic-gate extern FILE	*freopen(const char *, const char *, FILE *);
214*7c478bd9Sstevel@tonic-gate extern void	setbuf(FILE *, char *);
215*7c478bd9Sstevel@tonic-gate extern void	setbuffer(FILE *, char *, int);
216*7c478bd9Sstevel@tonic-gate extern int	setlinebuf(FILE *);
217*7c478bd9Sstevel@tonic-gate extern int	setvbuf(FILE *, char *, int, size_t);
218*7c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
219*7c478bd9Sstevel@tonic-gate extern int	fprintf(FILE *, const char *, ...);
220*7c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
221*7c478bd9Sstevel@tonic-gate extern int	fscanf(FILE *, const char *, ...);
222*7c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
223*7c478bd9Sstevel@tonic-gate extern int	printf(const char *, ...);
224*7c478bd9Sstevel@tonic-gate /* SCANFLIKE1 */
225*7c478bd9Sstevel@tonic-gate extern int	scanf(const char *, ...);
226*7c478bd9Sstevel@tonic-gate /* PRINTFLIKE2 */
227*7c478bd9Sstevel@tonic-gate extern char	*sprintf(const char *, const char *, ...);
228*7c478bd9Sstevel@tonic-gate /* SCANFLIKE2 */
229*7c478bd9Sstevel@tonic-gate extern int	sscanf(const char *, const char *, ...);
230*7c478bd9Sstevel@tonic-gate extern int	vfprintf(FILE *, const char *, __va_list);
231*7c478bd9Sstevel@tonic-gate extern int	vprintf(const char *, __va_list);
232*7c478bd9Sstevel@tonic-gate extern char	*vsprintf(char *, char *, __va_list);
233*7c478bd9Sstevel@tonic-gate extern int	fgetc(FILE *);
234*7c478bd9Sstevel@tonic-gate extern char	*fgets(char *, int, FILE *);
235*7c478bd9Sstevel@tonic-gate extern int	fputc(int, FILE *);
236*7c478bd9Sstevel@tonic-gate extern int	fputs(const char *, FILE *);
237*7c478bd9Sstevel@tonic-gate extern int	getc(FILE *);
238*7c478bd9Sstevel@tonic-gate extern int	getchar(void);
239*7c478bd9Sstevel@tonic-gate extern char	*gets(char *);
240*7c478bd9Sstevel@tonic-gate extern int	putc(int, FILE *);
241*7c478bd9Sstevel@tonic-gate extern int	putchar(int);
242*7c478bd9Sstevel@tonic-gate extern int	puts(const char *);
243*7c478bd9Sstevel@tonic-gate extern int	ungetc(int, FILE *);
244*7c478bd9Sstevel@tonic-gate extern size_t	fread(void *, size_t, size_t, FILE *);
245*7c478bd9Sstevel@tonic-gate extern size_t	fwrite(const void *, size_t, size_t, FILE *);
246*7c478bd9Sstevel@tonic-gate extern int	fgetpos(FILE *, fpos_t *);
247*7c478bd9Sstevel@tonic-gate extern int	fseek(FILE *, long, int);
248*7c478bd9Sstevel@tonic-gate extern int	fsetpos(FILE *, const fpos_t *);
249*7c478bd9Sstevel@tonic-gate extern long	ftell(FILE *);
250*7c478bd9Sstevel@tonic-gate extern void	rewind(FILE *);
251*7c478bd9Sstevel@tonic-gate extern void	clearerr(FILE *);
252*7c478bd9Sstevel@tonic-gate extern int	feof(FILE *);
253*7c478bd9Sstevel@tonic-gate extern int	ferror(FILE *);
254*7c478bd9Sstevel@tonic-gate extern void	perror(const char *);
255*7c478bd9Sstevel@tonic-gate 
256*7c478bd9Sstevel@tonic-gate extern int	__filbuf(FILE *);
257*7c478bd9Sstevel@tonic-gate extern int	__flsbuf(int, FILE *);
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
260*7c478bd9Sstevel@tonic-gate 	/* non-ANSI standard compilation */
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate extern FILE    *fdopen(int, const char *);
263*7c478bd9Sstevel@tonic-gate extern FILE    *popen(const char *, const char *);
264*7c478bd9Sstevel@tonic-gate extern char    *ctermid(char *);
265*7c478bd9Sstevel@tonic-gate extern char    *cuserid(char *);
266*7c478bd9Sstevel@tonic-gate extern char    *tempnam(const char *, const char *);
267*7c478bd9Sstevel@tonic-gate extern int	getw(FILE *);
268*7c478bd9Sstevel@tonic-gate extern int	putw(int, FILE *);
269*7c478bd9Sstevel@tonic-gate extern int	pclose(FILE *);
270*7c478bd9Sstevel@tonic-gate extern int	system(const char *);
271*7c478bd9Sstevel@tonic-gate extern int	fileno(FILE *);
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate #endif	/* !defined(_STRICT_STDC) */
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate #else	/* !defined __STDC__ */
276*7c478bd9Sstevel@tonic-gate #define	_bufend(p)	_bufendtab[fileno(p)]
277*7c478bd9Sstevel@tonic-gate #define	_bufsiz(p)	(_bufend(p) - (p)->_base)
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate extern FILE	*fopen(), *fdopen(), *freopen(), *popen();
280*7c478bd9Sstevel@tonic-gate extern long	ftell();
281*7c478bd9Sstevel@tonic-gate extern void	rewind(), setbuf(), setbuffer();
282*7c478bd9Sstevel@tonic-gate extern int	setlinebuf();
283*7c478bd9Sstevel@tonic-gate extern char	*ctermid(), *cuserid(), *fgets(), *gets(), *sprintf(),
284*7c478bd9Sstevel@tonic-gate 		*vsprintf();
285*7c478bd9Sstevel@tonic-gate extern int	fclose(), fflush(), fread(), fwrite(), fseek(), fgetc(),
286*7c478bd9Sstevel@tonic-gate 		getw(), pclose(), printf(), fprintf(),
287*7c478bd9Sstevel@tonic-gate 		vprintf(), vfprintf(), fputc(), putw(),
288*7c478bd9Sstevel@tonic-gate 		puts(), fputs(), scanf(), fscanf(), sscanf(),
289*7c478bd9Sstevel@tonic-gate 		setvbuf(), system(), ungetc();
290*7c478bd9Sstevel@tonic-gate extern int	fileno();
291*7c478bd9Sstevel@tonic-gate extern int	getc(), getchar(), putc(), putchar(), feof(), ferror();
292*7c478bd9Sstevel@tonic-gate extern void	clearerr();
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
295*7c478bd9Sstevel@tonic-gate 
296*7c478bd9Sstevel@tonic-gate #ifndef __lint
297*7c478bd9Sstevel@tonic-gate 
298*7c478bd9Sstevel@tonic-gate #ifndef _LP64
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
303*7c478bd9Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
304*7c478bd9Sstevel@tonic-gate 				: (int)(*(p)->_ptr++ = (x)))
305*7c478bd9Sstevel@tonic-gate 
306*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */
307*7c478bd9Sstevel@tonic-gate 
308*7c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
309*7c478bd9Sstevel@tonic-gate #define	putc(x, p)	(--(p)->_cnt < 0 ? \
310*7c478bd9Sstevel@tonic-gate 			_flsbuf((unsigned char) (x), (p)) : \
311*7c478bd9Sstevel@tonic-gate 			(int)(*(p)->_ptr++ = (unsigned char)(x)))
312*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate #define	clearerr(p)	((void) ((p)->_flag &= ~(_IOERR | _IOEOF)))
315*7c478bd9Sstevel@tonic-gate #define	feof(p)		((p)->_flag & _IOEOF)
316*7c478bd9Sstevel@tonic-gate #define	ferror(p)	((p)->_flag & _IOERR)
317*7c478bd9Sstevel@tonic-gate 
318*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */
319*7c478bd9Sstevel@tonic-gate 
320*7c478bd9Sstevel@tonic-gate #define	getchar()	getc(stdin)
321*7c478bd9Sstevel@tonic-gate #define	putchar(x)	putc((x), stdout)
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate #endif /* __lint */
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate #if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
326*7c478bd9Sstevel@tonic-gate 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
327*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
328*7c478bd9Sstevel@tonic-gate extern FILE	*fopen64(const char *, const char *);
329*7c478bd9Sstevel@tonic-gate extern FILE	*freopen64(const char *, const char *, FILE *);
330*7c478bd9Sstevel@tonic-gate #else
331*7c478bd9Sstevel@tonic-gate extern FILE	*fopen64(), *freopen64();
332*7c478bd9Sstevel@tonic-gate #endif
333*7c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE... */
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
336*7c478bd9Sstevel@tonic-gate }
337*7c478bd9Sstevel@tonic-gate #endif
338*7c478bd9Sstevel@tonic-gate 
339*7c478bd9Sstevel@tonic-gate #endif	/* _STDIO_H */
340