/*	@(#)stdio.h	13.2 (RC International) 91/03/13 	*/

/*	Copyright (c) 1988 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident	"@(#)head:stdio.h	2.34"

#ifndef _STDIO_H
#define _STDIO_H


#define	BUFSIZ	8192

extern	struct	_iobuf {
	int	_cnt;
	char	*_ptr;		/* should be unsigned char */
	char	*_base;		/* should be unsigned char */
	int	_bufsiz;
	short	_flag;
	short	_file;
} _iob[];

#define _IOFBF		00000	/* SYSV */
#define	_IOREAD		00001
#define	_IOWRT		00002
#define	_IONBF		00004
#define	_IOMYBUF	00010
#define	_IOEOF		00020
#define	_IOERR		00040
#define	_IOSTRG		00100
#define	_IOLBF		00200
#define	_IORW		00400
#define	_IONSIGERR	01000
#define	_IONSIGABORT	02000
#define	_IORBF		04000

#ifndef NULL
#define	NULL	0
#endif
#define	EOF	(-1)

typedef struct _iobuf FILE;

#define	stdin	(&_iob[0])
#define	stdout	(&_iob[1])
#define	stderr	(&_iob[2])

#ifndef lint
#define	getc(p)		(--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p))
#endif not lint

#define	getchar()	getc(stdin)

#ifndef lint
#define putc(x, p)	(--(p)->_cnt >= 0 ?\
	(int)(*(unsigned char *)(p)->_ptr++ = (x)) :\
	(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
		((*(p)->_ptr = (x)) != '\n' ?\
			(int)(*(unsigned char *)(p)->_ptr++) :\
			_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
		_flsbuf((unsigned char)(x), p)))
#endif not lint

#define	putchar(x)	putc(x,stdout)
#define	feof(p)		(((p)->_flag&_IOEOF)!=0)
#define	ferror(p)	(((p)->_flag&_IOERR)!=0)
#define	fileno(p)	((p)->_file)
#define	clearerr(p)	((p)->_flag &= ~(_IOERR|_IOEOF))

#if defined(__STDC__)

extern FILE	*fopen(char *, char *);
extern FILE     *fdopen(int, char *);
extern FILE	*freopen(char *, char *, FILE *);
extern FILE     *popen(char *, char *);
extern long	ftell(FILE *);
extern char	*fgets(char *, int, FILE *); 
extern char	*gets(char *);

#else /* Not __STDC__ */

FILE	*fopen();
FILE	*fdopen();
FILE	*freopen();
FILE	*popen();
long	ftell();
char	*fgets();
char	*gets();

#endif /* __STDC__ */


#endif  /* _STDIO_H */
