xref: /titanic_52/usr/src/lib/libbc/inc/include/stdio.h (revision 84ab085a13f931bc78e7415e7ce921dbaa14fcb3)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	from UCB 1.4 06/30/83	*/
23 
24 #pragma ident	"%Z%%M%	%I%	%E% SMI"
25 
26 # ifndef FILE
27 #define	BUFSIZ	1024
28 #define _SBFSIZ	8
29 extern	struct	_iobuf {
30 	int	_cnt;
31 	unsigned char *_ptr;
32 	unsigned char *_base;
33 	int	_bufsiz;
34 	short	_flag;
35 	char	_file;		/* should be short */
36 } _iob[];
37 
38 #define _IOFBF	0
39 #define	_IOREAD	01
40 #define	_IOWRT	02
41 #define	_IONBF	04
42 #define	_IOMYBUF	010
43 #define	_IOEOF	020
44 #define	_IOERR	040
45 #define	_IOSTRG	0100
46 #define	_IOLBF	0200
47 #define	_IORW	0400
48 #define	NULL	0
49 #define	FILE	struct _iobuf
50 #define	EOF	(-1)
51 
52 #define	stdin	(&_iob[0])
53 #define	stdout	(&_iob[1])
54 #define	stderr	(&_iob[2])
55 
56 #ifdef lint	/* so that lint likes (void)putc(a,b) */
57 extern int putc();
58 extern int getc();
59 #else
60 #define	getc(p)		(--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
61 #define putc(x, p)	(--(p)->_cnt >= 0 ?\
62 	(int)(*(p)->_ptr++ = (unsigned char)(x)) :\
63 	(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
64 		((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
65 			(int)(*(p)->_ptr++) :\
66 			_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
67 		_flsbuf((unsigned char)(x), p)))
68 #endif
69 #define	getchar()	getc(stdin)
70 #define	putchar(x)	putc((x),stdout)
71 #define	feof(p)		(((p)->_flag&_IOEOF)!=0)
72 #define	ferror(p)	(((p)->_flag&_IOERR)!=0)
73 #define	clearerr(p)	(void) ((p)->_flag &= ~(_IOERR|_IOEOF))
74 
75 extern FILE	*fopen();
76 extern FILE	*fdopen();
77 extern FILE	*freopen();
78 extern FILE	*popen();
79 extern FILE	*tmpfile();
80 extern long	ftell();
81 extern char	*fgets();
82 extern char	*gets();
83 extern char	*sprintf();
84 extern char	*ctermid();
85 extern char	*cuserid();
86 extern char	*tempnam();
87 extern char	*tmpnam();
88 extern int	fileno();
89 
90 #define L_ctermid	9
91 #define L_cuserid	9
92 #define P_tmpdir	"/usr/tmp/"
93 #define L_tmpnam	25		/* (sizeof(P_tmpdir) + 15) */
94 # endif
95