Remove pipe && Fix cat and huge_write.

This commit is contained in:
Yifan Wu 2022-01-18 03:33:58 -08:00
parent 57f7debbc6
commit 5389b7adca
10 changed files with 7 additions and 332 deletions

View file

@ -21,14 +21,12 @@ pub fn main(argc: usize, argv: &[&str]) -> i32 {
panic!("Error occured when opening file");
}
let fd = fd as usize;
let mut buf = [0u8; 16];
let mut s = String::new();
let mut buf = [0u8; 256];
loop {
let size = read(fd, &mut buf) as usize;
if size == 0 { break; }
s.push_str(core::str::from_utf8(&buf[..size]).unwrap());
println!("{}", core::str::from_utf8(&buf[..size]).unwrap());
}
println!("{}", s);
close(fd);
0
}
}