xref: /titanic_41/usr/src/lib/libbc/inc/include/stdio.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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 /*
23  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	__include_stdio_h
28 #define	__include_stdio_h
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #define	BUFSIZ	1024
33 #define _SBFSIZ	8
34 extern	struct	_iobuf {
35 	int	_cnt;
36 	unsigned char *_ptr;
37 	unsigned char *_base;
38 	int	_bufsiz;
39 	short	_flag;
40 	char	_file;		/* should be short */
41 } _iob[];
42 
43 #define _IOFBF	0
44 #define	_IOREAD	01
45 #define	_IOWRT	02
46 #define	_IONBF	04
47 #define	_IOMYBUF	010
48 #define	_IOEOF	020
49 #define	_IOERR	040
50 #define	_IOSTRG	0100
51 #define	_IOLBF	0200
52 #define	_IORW	0400
53 #define	NULL	0
54 #define	FILE	struct _iobuf
55 #define	EOF	(-1)
56 
57 #define	stdin	(&_iob[0])
58 #define	stdout	(&_iob[1])
59 #define	stderr	(&_iob[2])
60 
61 #if	defined(__lint)	/* so that lint likes (void)putc(a,b) */
62 extern int putc(int, FILE *);
63 extern int getc(FILE *);
64 #else
65 #define	getc(p)		(--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
66 #define putc(x, p)	(--(p)->_cnt >= 0 ?\
67 	(int)(*(p)->_ptr++ = (unsigned char)(x)) :\
68 	(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
69 		((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
70 			(int)(*(p)->_ptr++) :\
71 			_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
72 		_flsbuf((unsigned char)(x), p)))
73 #endif
74 
75 #define	getchar()	getc(stdin)
76 #define	putchar(x)	putc((x),stdout)
77 #define	feof(p)		(((p)->_flag&_IOEOF)!=0)
78 #define	ferror(p)	(((p)->_flag&_IOERR)!=0)
79 #define	clearerr(p)	(void) ((p)->_flag &= ~(_IOERR|_IOEOF))
80 
81 extern FILE	*fopen(char *, char *);
82 extern FILE	*fdopen(int, char *);
83 extern FILE	*freopen(char *, char *, FILE *);
84 extern FILE	*popen(char *, char *);
85 extern FILE	*tmpfile(void);
86 extern long	ftell(FILE *);
87 extern char	*fgets(char *, int, FILE *);
88 extern char	*gets(char *);
89 extern char	*sprintf(char *, char *, ...);
90 extern char	*ctermid(char *);
91 extern char	*cuserid(char *);
92 extern char	*tempnam(char *, char *);
93 extern char	*tmpnam(char *);
94 extern int	fileno(FILE *);
95 
96 #define L_ctermid	9
97 #define L_cuserid	9
98 #define P_tmpdir	"/usr/tmp/"
99 #define L_tmpnam	25		/* (sizeof(P_tmpdir) + 15) */
100 
101 #endif /* !__include_stdio_h */
102