1 2 3 4 5 6 7 8 9 10 11 12 13
use io; use os; use fmt; fn drain_stdin() []u8 = { const buf = match (io::drain(os::stdin)) { case let buf: []u8 => yield buf; case let err: io::error => fmt::fatalf("io::drain failed: {}", io::strerror(err)); }; return buf; };