8 Console::Console(Stream s):
11 mode = (stream==CIN ? M_READ : M_WRITE);
19 void Console::set_block(bool b)
21 sys_set_blocking(handle, b);
24 unsigned Console::do_write(const char *buf, unsigned len)
26 check_access(M_WRITE);
28 return sys_write(handle, buf, len);
31 unsigned Console::do_read(char *buf, unsigned len)
35 unsigned ret = sys_read(handle, buf, len);
42 const Handle &Console::get_handle(Mode m)
48 Console &Console::instance(Stream s)
50 static Console in(CIN);
51 static Console out(COUT);
52 static Console err(CERR);
57 case COUT: return out;
58 case CERR: return err;
61 throw invalid_argument("Console::instance");
64 Console &cin = Console::instance(Console::CIN);
65 Console &cout = Console::instance(Console::COUT);
66 Console &cerr = Console::instance(Console::CERR);