Category : C Source Code
Archive   : WKERMSRC.ZIP
Filename : STDIOS.H

 
Output of file : STDIOS.H contained in archive : WKERMSRC.ZIP
##################################################################
## STDIOS.H

#include "cstdio.h" /* Greenleaf add on */

/**
*
* This header file defines the information used by the standard I/O
* package.
*
**/
#define _BUFSIZ 512 /* standard buffer size */
#define BUFSIZ 512 /* standard buffer size */
#define _NFILE 20 /* maximum number of files */

struct _iobuf
{
char *_ptr; /* current buffer pointer */
int _rcnt; /* current byte count for reading */
int _wcnt; /* current byte count for writing */
char *_base; /* base address of I/O buffer */
char _flag; /* control flags */
char _file; /* file number */
int _size; /* size of buffer */
char _cbuff; /* single char buffer */
char _pad; /* (pad to even number of bytes) */
};

extern struct _iobuf _iob[_NFILE];

#define _IOREAD 1 /* read flag */
#define _IOWRT 2 /* write flag */
#define _IONBF 4 /* non-buffered flag */
#define _IOMYBUF 8 /* private buffer flag */
#define _IOEOF 16 /* end-of-file flag */
#define _IOERR 32 /* error flag */
#define _IOSTRG 64
#define _IORW 128 /* read-write (update) flag */

#if SPTR
#define NULL 0 /* null pointer value */
#else
#define NULL 0L
#endif
#define FILE struct _iobuf /* shorthand */
#define EOF (-1) /* end-of-file code */

#define stdin (&_iob[0]) /* standard input file pointer */
#define stdout (&_iob[1]) /* standard output file pointer */
#define stderr (&_iob[2]) /* standard error file pointer */

#define getc(p) (--(p)->_rcnt>=0? *(p)->_ptr++:_filbf(p))
#define getchar() getc(stdin)
#define putc(c,p) (--(p)->_wcnt>=0? ((int)(*(p)->_ptr++=(c))):_flsbf((c),p))
#define putchar(c) putc(c,stdout)
#define feof(p) (((p)->_flag&_IOEOF)!=0)
#define ferror(p) (((p)->_flag&_IOERR)!=0)
#define fileno(p) (p)->_file
#define rewind(fp) fseek(fp,0L,0)
#define fflush(fp) _flsbf(-1,fp)
#define clearerr(fp) clrerr(fp)

FILE *fopen();
FILE *freopen();
long ftell();
char *fgets();

#define abs(x) ((x)<0?-(x):(x))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<=(b)?(a):(b))




  3 Responses to “Category : C Source Code
Archive   : WKERMSRC.ZIP
Filename : STDIOS.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/