xref: /titanic_44/usr/src/lib/libbc/inc/include/stdio.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
22*5d54f3d8Smuffin /*
23*5d54f3d8Smuffin  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
24*5d54f3d8Smuffin  * Use is subject to license terms.
25*5d54f3d8Smuffin  */
26*5d54f3d8Smuffin 
27*5d54f3d8Smuffin #ifndef	__include_stdio_h
28*5d54f3d8Smuffin #define	__include_stdio_h
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #define	BUFSIZ	1024
337c478bd9Sstevel@tonic-gate #define _SBFSIZ	8
347c478bd9Sstevel@tonic-gate extern	struct	_iobuf {
357c478bd9Sstevel@tonic-gate 	int	_cnt;
367c478bd9Sstevel@tonic-gate 	unsigned char *_ptr;
377c478bd9Sstevel@tonic-gate 	unsigned char *_base;
387c478bd9Sstevel@tonic-gate 	int	_bufsiz;
397c478bd9Sstevel@tonic-gate 	short	_flag;
407c478bd9Sstevel@tonic-gate 	char	_file;		/* should be short */
417c478bd9Sstevel@tonic-gate } _iob[];
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define _IOFBF	0
447c478bd9Sstevel@tonic-gate #define	_IOREAD	01
457c478bd9Sstevel@tonic-gate #define	_IOWRT	02
467c478bd9Sstevel@tonic-gate #define	_IONBF	04
477c478bd9Sstevel@tonic-gate #define	_IOMYBUF	010
487c478bd9Sstevel@tonic-gate #define	_IOEOF	020
497c478bd9Sstevel@tonic-gate #define	_IOERR	040
507c478bd9Sstevel@tonic-gate #define	_IOSTRG	0100
517c478bd9Sstevel@tonic-gate #define	_IOLBF	0200
527c478bd9Sstevel@tonic-gate #define	_IORW	0400
537c478bd9Sstevel@tonic-gate #define	NULL	0
547c478bd9Sstevel@tonic-gate #define	FILE	struct _iobuf
557c478bd9Sstevel@tonic-gate #define	EOF	(-1)
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #define	stdin	(&_iob[0])
587c478bd9Sstevel@tonic-gate #define	stdout	(&_iob[1])
597c478bd9Sstevel@tonic-gate #define	stderr	(&_iob[2])
607c478bd9Sstevel@tonic-gate 
61*5d54f3d8Smuffin #if	defined(__lint)	/* so that lint likes (void)putc(a,b) */
62*5d54f3d8Smuffin extern int putc(int, FILE *);
63*5d54f3d8Smuffin extern int getc(FILE *);
647c478bd9Sstevel@tonic-gate #else
657c478bd9Sstevel@tonic-gate #define	getc(p)		(--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
667c478bd9Sstevel@tonic-gate #define putc(x, p)	(--(p)->_cnt >= 0 ?\
677c478bd9Sstevel@tonic-gate 	(int)(*(p)->_ptr++ = (unsigned char)(x)) :\
687c478bd9Sstevel@tonic-gate 	(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
697c478bd9Sstevel@tonic-gate 		((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
707c478bd9Sstevel@tonic-gate 			(int)(*(p)->_ptr++) :\
717c478bd9Sstevel@tonic-gate 			_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
727c478bd9Sstevel@tonic-gate 		_flsbuf((unsigned char)(x), p)))
737c478bd9Sstevel@tonic-gate #endif
74*5d54f3d8Smuffin 
757c478bd9Sstevel@tonic-gate #define	getchar()	getc(stdin)
767c478bd9Sstevel@tonic-gate #define	putchar(x)	putc((x),stdout)
777c478bd9Sstevel@tonic-gate #define	feof(p)		(((p)->_flag&_IOEOF)!=0)
787c478bd9Sstevel@tonic-gate #define	ferror(p)	(((p)->_flag&_IOERR)!=0)
797c478bd9Sstevel@tonic-gate #define	clearerr(p)	(void) ((p)->_flag &= ~(_IOERR|_IOEOF))
807c478bd9Sstevel@tonic-gate 
81*5d54f3d8Smuffin extern FILE	*fopen(char *, char *);
82*5d54f3d8Smuffin extern FILE	*fdopen(int, char *);
83*5d54f3d8Smuffin extern FILE	*freopen(char *, char *, FILE *);
84*5d54f3d8Smuffin extern FILE	*popen(char *, char *);
85*5d54f3d8Smuffin extern FILE	*tmpfile(void);
86*5d54f3d8Smuffin extern long	ftell(FILE *);
87*5d54f3d8Smuffin extern char	*fgets(char *, int, FILE *);
88*5d54f3d8Smuffin extern char	*gets(char *);
89*5d54f3d8Smuffin extern char	*sprintf(char *, char *, ...);
90*5d54f3d8Smuffin extern char	*ctermid(char *);
91*5d54f3d8Smuffin extern char	*cuserid(char *);
92*5d54f3d8Smuffin extern char	*tempnam(char *, char *);
93*5d54f3d8Smuffin extern char	*tmpnam(char *);
94*5d54f3d8Smuffin extern int	fileno(FILE *);
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #define L_ctermid	9
977c478bd9Sstevel@tonic-gate #define L_cuserid	9
987c478bd9Sstevel@tonic-gate #define P_tmpdir	"/usr/tmp/"
997c478bd9Sstevel@tonic-gate #define L_tmpnam	25		/* (sizeof(P_tmpdir) + 15) */
100*5d54f3d8Smuffin 
101*5d54f3d8Smuffin #endif /* !__include_stdio_h */
102