/*
*    MC 68000 C Library - Copyright 1985 to 1988, Microtec Research, Inc.
*    This program is the property of Microtec Research, Inc,
*
* stdio.h */

#define NULL	0
#define NULLPTR	(char *)0
#define EOF	(-1)
#define TRUE	1
#define FALSE	0

#define BUFSIZ	512	/* buffer size for all I/O buffers */
#define BLKSIZ	BUFSIZ
#define _NFILE	20

extern struct iobuf {
    char *io_next ;	/* next character read/write pointer in buffer */
    char *io_lid ;	/* last position with data in input buffer */
    char *io_top ;	/* position beyond buffer */
    char *io_base ;	/* start of buffer */
    int io_file ;	/* location in _iob array, also unix style file # */
    int io_flags ;	/* random info */
    int io_chan ;	/* used to specify what channel, system dependant */
    int io_tmp ;	/* used by ungetc on unbuffered files */
} _iob[_NFILE];

#define _IO_READ	0x1	/* iobuf is open for read */
#define _IO_WRITE	0x2	/* iobuf is open for write */
#define _IO_ERROR	0x4	/* some error has occurred */
#define _IO_EOF		0x8	/* end of file has been reached */
#define _IO_DISK	0x20
#define _IO_BUF		0x40	/* has a system supplied buffer */
#define _IO_USRBUF	0x80	/* has a user supplied buffer */
#define _IO_STR		0x100	/* used by sprintf, maybe */
#define _OP_EOF		0x1000

#define FILE struct iobuf
#define stdin	(&_iob[0])
#define stdout	(&_iob[1])
#define stderr	(&_iob[2])

#define getc(f)	(((f)->io_next>=(f)->io_lid)?_filbuf(f):\
                (unsigned)*((f)->io_next++))
#define getchar() getc(stdin)

#define putc(ch,f) ((((f)->io_tmp=(ch))=='\n'||(f)->io_next>=(f)->io_top)?\
                   _flsbuf(f,(f)->io_tmp),ch:(*((f)->io_next++)=(f)->io_tmp))
#define putb(ch,f) (((f)->io_next<(f)->io_top)?*((f)->io_next++)=(ch):\
                   _flsbuf(f,ch))
#define putchar(ch) putc(ch,stdout)

#define fileno(file)	((file)->io_file)
#define feof(file)	((file)->io_flags&_IO_EOF)
#define ferror(file)	((file)->io_flags&_IO_ERROR)
#define clearerr(file)	((file)->io_flags&=~(_IO_EOF|_IO_ERROR))

extern int   close();
extern int   creat();
extern int   eprintf();
extern int   exit();
extern int   fclose();
extern int   fflush();
extern int   fgetc();
extern char *fgets();
extern FILE *fopen();
extern int   fprintf();
extern int   fputc();
extern int   fputs();
extern int   fread();
extern int   fscanf();
extern int   fwrite();
extern long  getl();
extern char *gets();
extern int   getw();
extern int   open();
extern int   printf();
extern long  putl();
extern int   puts();
extern int   putw();
extern int   read();
extern int   scanf();
extern int   sprintf();
extern int   sscanf();
extern int   ungetc();
extern int   write();
extern void  setbuf();
