Skip to content

Commit

Permalink
Simplify read command
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc committed Oct 30, 2024
1 parent 7397a3a commit 4bfb8ae
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/usr/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{api, usr};
use alloc::borrow::ToOwned;
use alloc::format;
use alloc::vec::Vec;
use core::convert::TryInto;

pub fn main(args: &[&str]) -> Result<(), ExitCode> {
if args.len() != 2 {
Expand Down Expand Up @@ -94,7 +93,6 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
// file.
let n = info.size();
let is_char_device = n == 4;
let is_float_device = n == 8;
let is_block_device = n > 8;
loop {
if console::end_of_text() || console::end_of_transmission() {
Expand All @@ -115,12 +113,6 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
_ => {}
}
}
if is_float_device && bytes.len() == 8 {
let f = f64::from_be_bytes(bytes[0..8].try_into().
unwrap());
println!("{:.6}", f);
return Ok(());
}
for b in bytes {
print!("{}", b as char);
}
Expand Down

0 comments on commit 4bfb8ae

Please sign in to comment.