|
|
1.1 root 1: /*
2: * libc/stdio/_fp.c
3: * ANSI-compliant C standard i/o library internals.
4: * _fp[]
5: * File structures.
6: */
7:
8: #include <stdio.h>
9: extern _FILE2 _iob2[_NSTDFILE];
10:
11: /*
12: * Standard FILEs.
13: * Rather than statically allocating _NFILE FILE structures,
14: * this allocates only _NSTDFILE structures.
15: * Others are malloc()'ed as needed by _fopen().
16: */
17:
18: FILE _iob[_NSTDFILE] = {
19:
20: {
21: /* Standard input. */
22: 0, /* _cc */
23: NULL, /* _cp */
24: &_iob2[0], /* _f2p */
25: _FRONLY, /* _ff1 */
26: 0, /* _fd */
27: _FINUSE|_FASCII|_FDONTC, /* _ff2 */
28: _MODE_UNINIT /* _mode */
29: },
30:
31: {
32: /* Standard output. */
33: 0, /* _cc */
34: NULL, /* _cp */
35: &_iob2[1], /* _f2p */
36: _FWONLY, /* _ff1 */
37: 1, /* _fd */
38: _FINUSE|_FASCII|_FDONTC, /* _ff2 */
39: _MODE_UNINIT /* _mode */
40: },
41:
42: {
43: /* Standard error, unbuffered. */
44: 0, /* _cc */
45: NULL, /* _cp */
46: &_iob2[2], /* _f2p */
47: _IONBF|_FWONLY, /* _ff1 */
48: 2, /* _fd */
49: _FINUSE|_FASCII|_FDONTC, /* _ff2 */
50: _MODE_NBUF /* _mode */
51: }
52:
53: #if MSDOS
54: ,
55: {
56: /* AUX: */
57: 0, /* _cc */
58: NULL, /* _cp */
59: &_iob2[3], /* _f2p */
60: _FRW, /* _ff1 */
61: 3, /* _fd */
62: _FINUSE|_FDONTC, /* _ff2 */
63: _MODE_UNINIT /* _mode */
64: },
65:
66: {
67: /* PRN: */
68: 0, /* _cc */
69: NULL, /* _cp */
70: &_iob2[4], /* _f2p */
71: _FWONLY, /* _ff1 */
72: 4, /* _fd */
73: _FINUSE|_FASCII|_FDONTC, /* _ff2 */
74: _MODE_UNINIT /* _mode */
75: }
76: #endif
77: };
78:
79: _FILE2 _iob2[_NSTDFILE] = {
80:
81: {
82: /* Standard input. */
83: &_fginit, /* _gt */
84: &_fpute, /* _pt */
85: NULL, /* _bp */
86: NULL, /* _dp */
87: NULL, /* _ep */
88: NULL, /* _nm */
89: 0 /* _uc */
90:
91: },
92:
93: {
94: /* Standard output. */
95: &_fgete, /* _gt */
96: &_fpinit, /* _pt */
97: NULL, /* _bp */
98: NULL, /* _dp */
99: NULL, /* _ep */
100: NULL, /* _nm */
101: 0 /* _uc */
102: },
103:
104: {
105: /* Standard error, unbuffered. */
106: #if _ASCII
107: &_fgete, /* _gt */
108: &_fputca, /* _pt */
109: #else
110: &_fgete, /* _gt */
111: &_fputc, /* _pt */
112: #endif
113: NULL, /* _bp */
114: NULL, /* _dp */
115: NULL, /* _ep */
116: NULL, /* _nm */
117: 0 /* _uc */
118: }
119:
120: #if MSDOS
121: ,
122: {
123: /* AUX: */
124: &_fginit, /* _gt */
125: &_fpinit, /* _pt */
126: NULL, /* _bp */
127: NULL, /* _dp */
128: NULL, /* _ep */
129: NULL, /* _nm */
130: 0 /* _uc */
131: },
132:
133: {
134: /* PRN: */
135: &_fgete, /* _gt */
136: &_fpinit, /* _pt */
137: NULL, /* _bp */
138: NULL, /* _dp */
139: NULL, /* _ep */
140: NULL, /* _nm */
141: 0 /* _uc */
142: }
143: #endif
144: };
145:
146: /* FILE pointers. */
147: FILE *_fp[_NFILE] = {
148: stdin,
149: stdout,
150: stderr
151: #if MSDOS
152: ,
153: stdaux,
154: stdprn
155: #endif
156: };
157:
158: /* end of libc/stdio/_fp.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.