mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
pinky: simplify and debug printing files
This commit is contained in:
parent
f52f655934
commit
644c99ed2e
1 changed files with 3 additions and 9 deletions
|
@ -22,8 +22,6 @@ use clap::{crate_version, App, AppSettings, Arg};
|
|||
use std::path::PathBuf;
|
||||
use uucore::{format_usage, InvalidEncodingHandling};
|
||||
|
||||
const BUFSIZE: usize = 1024;
|
||||
|
||||
static ABOUT: &str = "pinky - lightweight finger";
|
||||
const USAGE: &str = "{} [OPTION]... [USER]...";
|
||||
|
||||
|
@ -366,12 +364,8 @@ impl Pinky {
|
|||
|
||||
fn read_to_console<F: Read>(f: F) {
|
||||
let mut reader = BufReader::new(f);
|
||||
let mut iobuf = [0_u8; BUFSIZE];
|
||||
while let Ok(n) = reader.read(&mut iobuf) {
|
||||
if n == 0 {
|
||||
break;
|
||||
}
|
||||
let s = String::from_utf8_lossy(&iobuf);
|
||||
print!("{}", s);
|
||||
let mut iobuf = Vec::new();
|
||||
if reader.read_to_end(&mut iobuf).is_ok() {
|
||||
print!("{}", String::from_utf8_lossy(&iobuf));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue