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