xref: /onnv-gate/usr/src/lib/libbc/inc/include/stdio.h (revision 722:636b850d4ee9)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22*722Smuffin /*
23*722Smuffin  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
24*722Smuffin  * Use is subject to license terms.
25*722Smuffin  */
26*722Smuffin 
27*722Smuffin #ifndef	__include_stdio_h
28*722Smuffin #define	__include_stdio_h
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #define	BUFSIZ	1024
330Sstevel@tonic-gate #define _SBFSIZ	8
340Sstevel@tonic-gate extern	struct	_iobuf {
350Sstevel@tonic-gate 	int	_cnt;
360Sstevel@tonic-gate 	unsigned char *_ptr;
370Sstevel@tonic-gate 	unsigned char *_base;
380Sstevel@tonic-gate 	int	_bufsiz;
390Sstevel@tonic-gate 	short	_flag;
400Sstevel@tonic-gate 	char	_file;		/* should be short */
410Sstevel@tonic-gate } _iob[];
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #define _IOFBF	0
440Sstevel@tonic-gate #define	_IOREAD	01
450Sstevel@tonic-gate #define	_IOWRT	02
460Sstevel@tonic-gate #define	_IONBF	04
470Sstevel@tonic-gate #define	_IOMYBUF	010
480Sstevel@tonic-gate #define	_IOEOF	020
490Sstevel@tonic-gate #define	_IOERR	040
500Sstevel@tonic-gate #define	_IOSTRG	0100
510Sstevel@tonic-gate #define	_IOLBF	0200
520Sstevel@tonic-gate #define	_IORW	0400
530Sstevel@tonic-gate #define	NULL	0
540Sstevel@tonic-gate #define	FILE	struct _iobuf
550Sstevel@tonic-gate #define	EOF	(-1)
560Sstevel@tonic-gate 
570Sstevel@tonic-gate #define	stdin	(&_iob[0])
580Sstevel@tonic-gate #define	stdout	(&_iob[1])
590Sstevel@tonic-gate #define	stderr	(&_iob[2])
600Sstevel@tonic-gate 
61*722Smuffin #if	defined(__lint)	/* so that lint likes (void)putc(a,b) */
62*722Smuffin extern int putc(int, FILE *);
63*722Smuffin extern int getc(FILE *);
640Sstevel@tonic-gate #else
650Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
660Sstevel@tonic-gate #define putc(x, p)	(--(p)->_cnt >= 0 ?\
670Sstevel@tonic-gate 	(int)(*(p)->_ptr++ = (unsigned char)(x)) :\
680Sstevel@tonic-gate 	(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
690Sstevel@tonic-gate 		((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
700Sstevel@tonic-gate 			(int)(*(p)->_ptr++) :\
710Sstevel@tonic-gate 			_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
720Sstevel@tonic-gate 		_flsbuf((unsigned char)(x), p)))
730Sstevel@tonic-gate #endif
74*722Smuffin 
750Sstevel@tonic-gate #define	getchar()	getc(stdin)
760Sstevel@tonic-gate #define	putchar(x)	putc((x),stdout)
770Sstevel@tonic-gate #define	feof(p)		(((p)->_flag&_IOEOF)!=0)
780Sstevel@tonic-gate #define	ferror(p)	(((p)->_flag&_IOERR)!=0)
790Sstevel@tonic-gate #define	clearerr(p)	(void) ((p)->_flag &= ~(_IOERR|_IOEOF))
800Sstevel@tonic-gate 
81*722Smuffin extern FILE	*fopen(char *, char *);
82*722Smuffin extern FILE	*fdopen(int, char *);
83*722Smuffin extern FILE	*freopen(char *, char *, FILE *);
84*722Smuffin extern FILE	*popen(char *, char *);
85*722Smuffin extern FILE	*tmpfile(void);
86*722Smuffin extern long	ftell(FILE *);
87*722Smuffin extern char	*fgets(char *, int, FILE *);
88*722Smuffin extern char	*gets(char *);
89*722Smuffin extern char	*sprintf(char *, char *, ...);
90*722Smuffin extern char	*ctermid(char *);
91*722Smuffin extern char	*cuserid(char *);
92*722Smuffin extern char	*tempnam(char *, char *);
93*722Smuffin extern char	*tmpnam(char *);
94*722Smuffin extern int	fileno(FILE *);
950Sstevel@tonic-gate 
960Sstevel@tonic-gate #define L_ctermid	9
970Sstevel@tonic-gate #define L_cuserid	9
980Sstevel@tonic-gate #define P_tmpdir	"/usr/tmp/"
990Sstevel@tonic-gate #define L_tmpnam	25		/* (sizeof(P_tmpdir) + 15) */
100*722Smuffin 
101*722Smuffin #endif /* !__include_stdio_h */
102