home *** CD-ROM | disk | FTP | other *** search
- /*
- * fake_stdio.h
- *
- * By Ross Ridge
- * Public Domain
- * 92/02/01 07:29:53
- *
- * A fake stdio.h for a fake stdio (read only)
- *
- * @(#) mytinfo fake_stdio.h 3.2 92/02/01 public domain, By Ross Ridge
- */
-
- #ifndef _FAKE_STDIO_H_
-
- #define _FAKE_STDIO_H_
-
- #if 1
- #define getc _fake_getc
- #define fgetc _fake_fgetc
- #define fgets _fake_fgets
- #define fclose _fake_fclose
- #define _fillbuf _fake_fillbuf
- #define ungetc _fake_ungetc
- #define fopen _fake_fopen
- #define fdopen _fake_fdopen
- #endif
-
- #define FILES 5
- #define FAKE_BUF_SIZE 512
-
- struct _fake_file {
- char *pos;
- char *end;
- int fd;
- char buf[FAKE_BUF_SIZE];
- };
-
- #undef FILE
- #define FILE struct _fake_file
- #undef EOF
- #define EOF (-1)
-
- #define _fake_getc(f) ((f)->pos >= (f)->end ? _fillbuf(f) : *((f)->pos)++)
- #define _fake_fclose(f) (close((f)->fd) == -1 ? EOF : ((f)->fd = -1, 0))
- #define _fake_ungetc(c, f) ((f)->pos > (f)->buf ? (*--((f)->pos) = c) : EOF)
-
- #ifdef USE_PROTOYPES
- int fgetc(FILE *);
- int _fillbuf(FILE *);
- char *fgets(char *, int, FILE *);
- FILE *fopen(char *, char *);
- FILE *fdopen(int, char *);
- #else
- int fgetc();
- int _fillbuf();
- char *fgets();
- FILE *fopen();
- FILE *fdopen();
- #endif
-
- #if !defined(NULL) && !defined(USE_STRINGS)
- #define NULL ((anyptr) 0)
- #endif
-
- #endif /* !_FAKE_STDIO_H_ */
-