1
2
3
4
5 #ifndef _NFILE
6 #define _NFILE 20
7
8
9 #define BUFSIZ 1024
10
11
12 #define _SBFSIZ 8
13
14 typedef struct {
15 int _cnt;
16 unsigned char *_ptr;
17 unsigned char *_base;
18 char _flag;
19 char _file;
20 } FILE;
21
22
23
24
25
26
27 #define _IOFBF 0000
28 #define _IOREAD 0001
29 #define _IOWRT 0002
30 #define _IONBF 0004
31 #define _IOMYBUF 0010
32 #define _IOEOF 0020
33 #define _IOERR 0040
34 #define _IOLBF 0100
35 #define _IORW 0200
36
37 #ifndef NULL
38 #define NULL (void *) 0
39 #endif
40 #ifndef EOF
41 #define EOF (-1)
42 #endif
43
44 #define stdin ((FILE *)(&_iob[0]))
45 #define stdout ((FILE *)(&_iob[1]))
46 #define stderr ((FILE *)(&_iob[2]))
47
48 #define _bufend(p) _bufendtab[(p)->_file]
49 #define _bufsiz(p) (_bufend(p) - (p)->_base)
50
51 #ifndef lint
52 #define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
53 #define putc(x, p) (--(p)->_cnt < 0 ? \
54 _flsbuf((unsigned char) (x), (p)) : \
55 (int) (*(p)->_ptr++ = (unsigned char) (x)))
56 #define getchar() getc(stdin)
57 #define putchar(x) putc((x), stdout)
58 #define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF)))
59 #define feof(p) ((p)->_flag & _IOEOF)
60 #define ferror(p) ((p)->_flag & _IOERR)
61 #define fileno(p) (p)->_file
62 #endif
63
64 extern FILE _iob[_NFILE];
65 extern FILE *fopen(), *fdopen(), *freopen(), *tmpfile();
66 extern long ftell();
67 extern void rewind(), setbuf();
68 extern char *fgets(), *gets(), *tempnam(), *tmpnam();
69 extern unsigned char *_bufendtab[];
70
71 #define L_ctermid 9
72 #define L_cuserid 9
73 #define P_tmpdir ""
74 #define L_tmpnam 168
75 #endif
76
77