Add cfw_std{in,out,err}.

This commit is contained in:
Jonathan Schleifer 2012-09-30 00:50:49 +02:00
parent f9d9a2a9a8
commit a9f9734ea7
2 changed files with 42 additions and 0 deletions

View file

@ -25,6 +25,7 @@
*/ */
#include <string.h> #include <string.h>
#include <limits.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -171,3 +172,40 @@ static CFWClass class = {
.dtor = dtor .dtor = dtor
}; };
CFWClass *cfw_file = &class; CFWClass *cfw_file = &class;
static CFWFile cfw_stdin_ = {
.stream = {
.obj = {
.cls = &class,
.ref_cnt = INT_MAX
},
.ops = &stream_ops
},
.fd = 0,
.eof = false
};
static CFWFile cfw_stdout_ = {
.stream = {
.obj = {
.cls = &class,
.ref_cnt = INT_MAX
},
.ops = &stream_ops
},
.fd = 1,
.eof = false
};
static CFWFile cfw_stderr_ = {
.stream = {
.obj = {
.cls = &class,
.ref_cnt = INT_MAX
},
.ops = &stream_ops
},
.fd = 2,
.eof = false
};
CFWFile *cfw_stdin = &cfw_stdin_;
CFWFile *cfw_stdout = &cfw_stdout_;
CFWFile *cfw_stderr = &cfw_stderr_;

View file

@ -33,4 +33,8 @@ typedef struct CFWFile CFWFile;
extern CFWClass *cfw_file; extern CFWClass *cfw_file;
extern CFWFile *cfw_stdin;
extern CFWFile *cfw_stdout;
extern CFWFile *cfw_stderr;
#endif #endif