mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-06 16:07:47 +00:00
dd, printf, seq: update to new printf
This commit is contained in:
parent
a3e68d5bbd
commit
66eb64e41f
6 changed files with 10 additions and 19 deletions
|
@ -18,7 +18,7 @@ path = "src/dd.rs"
|
|||
clap = { workspace = true }
|
||||
gcd = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
uucore = { workspace = true, features = ["memo"] }
|
||||
uucore = { workspace = true, features = ["format"] }
|
||||
|
||||
[target.'cfg(any(target_os = "linux"))'.dependencies]
|
||||
nix = { workspace = true, features = ["fs"] }
|
||||
|
|
|
@ -14,7 +14,7 @@ use std::sync::mpsc;
|
|||
use std::time::Duration;
|
||||
|
||||
use uucore::error::UResult;
|
||||
use uucore::memo::sprintf;
|
||||
use uucore::format::sprintf;
|
||||
|
||||
use crate::numbers::{to_magnitude_and_suffix, SuffixType};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ path = "src/printf.rs"
|
|||
|
||||
[dependencies]
|
||||
clap = { workspace = true }
|
||||
uucore = { workspace = true, features = ["memo"] }
|
||||
uucore = { workspace = true, features = ["format"] }
|
||||
|
||||
[[bin]]
|
||||
name = "printf"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use uucore::error::{UResult, UUsageError};
|
||||
use uucore::memo::printf;
|
||||
use uucore::format::printf;
|
||||
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||
|
||||
const VERSION: &str = "version";
|
||||
|
|
|
@ -20,7 +20,7 @@ bigdecimal = { workspace = true }
|
|||
clap = { workspace = true }
|
||||
num-bigint = { workspace = true }
|
||||
num-traits = { workspace = true }
|
||||
uucore = { workspace = true, features = ["memo"] }
|
||||
uucore = { workspace = true, features = ["format"] }
|
||||
|
||||
[[bin]]
|
||||
name = "seq"
|
||||
|
|
|
@ -4,15 +4,12 @@
|
|||
// * file that was distributed with this source code.
|
||||
// spell-checker:ignore (ToDO) istr chiter argptr ilen extendedbigdecimal extendedbigint numberparse
|
||||
use std::io::{stdout, ErrorKind, Write};
|
||||
use std::process::exit;
|
||||
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use num_traits::Zero;
|
||||
|
||||
use uucore::error::FromIo;
|
||||
use uucore::error::UResult;
|
||||
use uucore::memo::printf;
|
||||
use uucore::show;
|
||||
use uucore::format::printf;
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
mod error;
|
||||
|
@ -251,7 +248,7 @@ fn print_seq(
|
|||
pad: bool,
|
||||
padding: usize,
|
||||
format: Option<&str>,
|
||||
) -> std::io::Result<()> {
|
||||
) -> UResult<()> {
|
||||
let stdout = stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
let (first, increment, last) = range;
|
||||
|
@ -277,10 +274,7 @@ fn print_seq(
|
|||
match format {
|
||||
Some(f) => {
|
||||
let s = format!("{value}");
|
||||
if let Err(x) = printf(f, &[s]) {
|
||||
show!(x);
|
||||
exit(1);
|
||||
}
|
||||
printf(f, &[s])?;
|
||||
}
|
||||
None => write_value_float(
|
||||
&mut stdout,
|
||||
|
@ -322,7 +316,7 @@ fn print_seq_integers(
|
|||
pad: bool,
|
||||
padding: usize,
|
||||
format: Option<&str>,
|
||||
) -> std::io::Result<()> {
|
||||
) -> UResult<()> {
|
||||
let stdout = stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
let (first, increment, last) = range;
|
||||
|
@ -342,10 +336,7 @@ fn print_seq_integers(
|
|||
match format {
|
||||
Some(f) => {
|
||||
let s = format!("{value}");
|
||||
if let Err(x) = printf(f, &[s]) {
|
||||
show!(x);
|
||||
exit(1);
|
||||
}
|
||||
printf(f, &[s])?;
|
||||
}
|
||||
None => write_value_int(&mut stdout, &value, padding, pad, is_first_iteration)?,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue