1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge branch 'main' into mktemp-set-dir-mode

This commit is contained in:
353fc443 aka Seagull 2022-05-17 12:51:04 +01:00 committed by GitHub
commit 124312702f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 78 additions and 74 deletions

16
Cargo.lock generated
View file

@ -1021,9 +1021,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.125" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1055,9 +1055,9 @@ dependencies = [
[[package]] [[package]]
name = "lscolors" name = "lscolors"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e9323b3525d4efad2dead1837a105e313253bfdbad1d470994038eededa4d62" checksum = "88e4434edeec6cd16a7e8e13569af4568a66fcd6d79abd8696db22dd95f920e6"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
] ]
@ -1530,9 +1530,9 @@ dependencies = [
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.5.2" version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"crossbeam-deque", "crossbeam-deque",
@ -1739,9 +1739,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
dependencies = [ dependencies = [
"libc", "libc",
"signal-hook-registry", "signal-hook-registry",

View file

@ -16,7 +16,7 @@ path = "src/chmod.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] }
[[bin]] [[bin]]

View file

@ -21,7 +21,7 @@ path = "src/cp.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
filetime = "0.2" filetime = "0.2"
libc = "0.2.125" libc = "0.2.126"
quick-error = "2.0.1" quick-error = "2.0.1"
selinux = { version="0.2", optional=true } selinux = { version="0.2", optional=true }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }

View file

@ -22,7 +22,7 @@ libc = "0.2"
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] [target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
signal-hook = "0.3.9" signal-hook = "0.3.14"
[[bin]] [[bin]]
name = "dd" name = "dd"

View file

@ -107,7 +107,7 @@ pub fn uu_app<'a>() -> Command<'a> {
fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) { fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
for (i, arg) in args.iter().enumerate() { for (i, arg) in args.iter().enumerate() {
let slice = &arg; let slice = &arg;
if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_digit(10)) { if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_ascii_digit()) {
let mut v = args.to_vec(); let mut v = args.to_vec();
v.remove(i); v.remove(i);
return (v, Some(slice[1..].to_owned())); return (v, Some(slice[1..].to_owned()));

View file

@ -20,7 +20,7 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
let mut has_num = false; let mut has_num = false;
let mut last_char = 0 as char; let mut last_char = 0 as char;
for (n, c) in &mut chars { for (n, c) in &mut chars {
if c.is_digit(10) { if c.is_ascii_digit() {
has_num = true; has_num = true;
num_end = n; num_end = n;
} else { } else {

View file

@ -16,7 +16,7 @@ path = "src/hostid.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -16,7 +16,7 @@ path = "src/kill.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["signals"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["signals"] }
[[bin]] [[bin]]

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/logname.rs" path = "src/logname.rs"
[dependencies] [dependencies]
libc = "0.2.125" libc = "0.2.126"
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

View file

@ -22,7 +22,7 @@ number_prefix = "0.4"
term_grid = "0.1.5" term_grid = "0.1.5"
termsize = "0.1.6" termsize = "0.1.6"
glob = "0.3.0" glob = "0.3.0"
lscolors = { version = "0.9.0", features = ["ansi_term"] } lscolors = { version = "0.10.0", features = ["ansi_term"] }
uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore", features = ["entries", "fs"] } uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore", features = ["entries", "fs"] }
once_cell = "1.10.0" once_cell = "1.10.0"
atty = "0.2" atty = "0.2"

View file

@ -28,7 +28,7 @@ use std::{
cmp::Reverse, cmp::Reverse,
error::Error, error::Error,
ffi::{OsStr, OsString}, ffi::{OsStr, OsString},
fmt::Display, fmt::{Display, Write as FmtWrite},
fs::{self, DirEntry, FileType, Metadata, ReadDir}, fs::{self, DirEntry, FileType, Metadata, ReadDir},
io::{stdout, BufWriter, ErrorKind, Stdout, Write}, io::{stdout, BufWriter, ErrorKind, Stdout, Write},
path::{Path, PathBuf}, path::{Path, PathBuf},
@ -1826,7 +1826,7 @@ fn display_additional_leading_info(
} else { } else {
"?".to_owned() "?".to_owned()
}; };
result.push_str(&format!("{} ", pad_left(&i, padding.inode))); write!(result, "{} ", pad_left(&i, padding.inode)).unwrap();
} }
} }
@ -1836,7 +1836,7 @@ fn display_additional_leading_info(
} else { } else {
"?".to_owned() "?".to_owned()
}; };
result.push_str(&format!("{} ", pad_left(&s, padding.block_size),)); write!(result, "{} ", pad_left(&s, padding.block_size)).unwrap();
} }
Ok(result) Ok(result)
} }

View file

@ -16,7 +16,7 @@ path = "src/mkfifo.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -17,7 +17,7 @@ path = "src/mknod.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "^0.2.125" libc = "^0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["mode"] }
[[bin]] [[bin]]

View file

@ -16,7 +16,7 @@ path = "src/nice.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
nix = { version = "0.24.1", default-features = false } nix = { version = "0.24.1", default-features = false }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

View file

@ -16,7 +16,7 @@ path = "src/nohup.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
atty = "0.2" atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/nproc.rs" path = "src/nproc.rs"
[dependencies] [dependencies]
libc = "0.2.125" libc = "0.2.126"
num_cpus = "1.10" num_cpus = "1.10"
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -244,7 +244,7 @@ fn format_string(
p => format!( p => format!(
"{:<padding$}", "{:<padding$}",
number_with_suffix, number_with_suffix,
padding = p.abs() as usize padding = p.unsigned_abs()
), ),
}) })
} }

View file

@ -29,6 +29,7 @@ mod prn_float;
mod prn_int; mod prn_int;
use std::cmp; use std::cmp;
use std::fmt::Write;
use crate::byteorder_io::*; use crate::byteorder_io::*;
use crate::formatteriteminfo::*; use crate::formatteriteminfo::*;
@ -600,11 +601,13 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output
let mut b = 0; let mut b = 0;
while b < input_decoder.length() { while b < input_decoder.length() {
output_text.push_str(&format!( write!(
output_text,
"{:>width$}", "{:>width$}",
"", "",
width = f.spacing[b % output_info.byte_size_block] width = f.spacing[b % output_info.byte_size_block]
)); )
.unwrap();
match f.formatter_item_info.formatter { match f.formatter_item_info.formatter {
FormatWriter::IntWriter(func) => { FormatWriter::IntWriter(func) => {
@ -627,12 +630,14 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output
let missing_spacing = output_info let missing_spacing = output_info
.print_width_line .print_width_line
.saturating_sub(output_text.chars().count()); .saturating_sub(output_text.chars().count());
output_text.push_str(&format!( write!(
output_text,
"{:>width$} {}", "{:>width$} {}",
"", "",
format_ascii_dump(input_decoder.get_buffer(0)), format_ascii_dump(input_decoder.get_buffer(0)),
width = missing_spacing width = missing_spacing
)); )
.unwrap();
} }
if first { if first {

View file

@ -244,7 +244,7 @@ fn is_format_size_decimal(
return false; return false;
} }
match ch { match ch {
Some(d) if d.is_digit(10) => { Some(d) if d.is_ascii_digit() => {
decimal_size.push(d); decimal_size.push(d);
true true
} }

View file

@ -10,7 +10,7 @@ pub trait CommandLineOpts {
} }
/// Implementation for `getopts` /// Implementation for `getopts`
impl<'a> CommandLineOpts for ArgMatches { impl CommandLineOpts for ArgMatches {
fn inputs(&self) -> Vec<&str> { fn inputs(&self) -> Vec<&str> {
self.values_of(options::FILENAME) self.values_of(options::FILENAME)
.map(|values| values.collect()) .map(|values| values.collect())

View file

@ -16,7 +16,7 @@ path = "src/pathchk.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -13,7 +13,7 @@ use std::cmp;
use std::collections::{BTreeSet, HashMap, HashSet}; use std::collections::{BTreeSet, HashMap, HashSet};
use std::default::Default; use std::default::Default;
use std::error::Error; use std::error::Error;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter, Write as FmtWrite};
use std::fs::File; use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::num::ParseIntError; use std::num::ParseIntError;
@ -572,7 +572,7 @@ fn format_tex_line(
reference: &str, reference: &str,
) -> String { ) -> String {
let mut output = String::new(); let mut output = String::new();
output.push_str(&format!("\\{} ", config.macro_name)); write!(output, "\\{} ", config.macro_name).unwrap();
let all_before = if config.input_ref { let all_before = if config.input_ref {
let before = &line[0..word_ref.position]; let before = &line[0..word_ref.position];
let before_start_trim_offset = let before_start_trim_offset =
@ -587,18 +587,18 @@ fn format_tex_line(
let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config); let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!( write!(
"{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}", output,
"{{{0}}}{{{1}}}{{{2}}}{{{3}}}{{{4}}}",
format_tex_field(&tail), format_tex_field(&tail),
format_tex_field(&before), format_tex_field(&before),
format_tex_field(keyword), format_tex_field(keyword),
format_tex_field(&after), format_tex_field(&after),
format_tex_field(&head), format_tex_field(&head),
"{", )
"}" .unwrap();
));
if config.auto_ref || config.input_ref { if config.auto_ref || config.input_ref {
output.push_str(&format!("{}{}{}", "{", format_tex_field(reference), "}")); write!(output, "{{{}}}", format_tex_field(reference)).unwrap();
} }
output output
} }
@ -615,7 +615,7 @@ fn format_roff_line(
reference: &str, reference: &str,
) -> String { ) -> String {
let mut output = String::new(); let mut output = String::new();
output.push_str(&format!(".{}", config.macro_name)); write!(output, ".{}", config.macro_name).unwrap();
let all_before = if config.input_ref { let all_before = if config.input_ref {
let before = &line[0..word_ref.position]; let before = &line[0..word_ref.position];
let before_start_trim_offset = let before_start_trim_offset =
@ -630,16 +630,18 @@ fn format_roff_line(
let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config); let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!( write!(
output,
" \"{}\" \"{}\" \"{}{}\" \"{}\"", " \"{}\" \"{}\" \"{}{}\" \"{}\"",
format_roff_field(&tail), format_roff_field(&tail),
format_roff_field(&before), format_roff_field(&before),
format_roff_field(keyword), format_roff_field(keyword),
format_roff_field(&after), format_roff_field(&after),
format_roff_field(&head) format_roff_field(&head)
)); )
.unwrap();
if config.auto_ref || config.input_ref { if config.auto_ref || config.input_ref {
output.push_str(&format!(" \"{}\"", format_roff_field(reference))); write!(output, " \"{}\"", format_roff_field(reference)).unwrap();
} }
output output
} }

View file

@ -17,7 +17,7 @@ path = "src/rmdir.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
libc = "0.2.125" libc = "0.2.126"
[[bin]] [[bin]]
name = "rmdir" name = "rmdir"

View file

@ -348,9 +348,9 @@ impl GlobalSettings {
]; ];
let mut size_string = input.trim().to_string(); let mut size_string = input.trim().to_string();
if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_digit(10)) { if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_ascii_digit()) {
// b 1, K 1024 (default) // b 1, K 1024 (default)
if size_string.ends_with(|c: char| c.is_digit(10)) { if size_string.ends_with(|c: char| c.is_ascii_digit()) {
size_string.push('K'); size_string.push('K');
} else if size_string.ends_with('b') { } else if size_string.ends_with('b') {
size_string.pop(); size_string.pop();

View file

@ -197,8 +197,8 @@ impl ScanUtil for str {
pub fn group_num(s: &str) -> Cow<str> { pub fn group_num(s: &str) -> Cow<str> {
let is_negative = s.starts_with('-'); let is_negative = s.starts_with('-');
assert!(is_negative || s.chars().take(1).all(|c| c.is_digit(10))); assert!(is_negative || s.chars().take(1).all(|c| c.is_ascii_digit()));
assert!(s.chars().skip(1).all(|c| c.is_digit(10))); assert!(s.chars().skip(1).all(|c| c.is_ascii_digit()));
if s.len() < 4 { if s.len() < 4 {
return s.into(); return s.into();
} }

View file

@ -62,7 +62,7 @@ struct ProgramOptions {
stderr: BufferType, stderr: BufferType,
} }
impl<'a> TryFrom<&ArgMatches> for ProgramOptions { impl TryFrom<&ArgMatches> for ProgramOptions {
type Error = ProgramOptionsError; type Error = ProgramOptionsError;
fn try_from(matches: &ArgMatches) -> Result<Self, Self::Error> { fn try_from(matches: &ArgMatches) -> Result<Self, Self::Error> {

View file

@ -16,7 +16,7 @@ path = "src/sync.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["wide"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["wide"] }
winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] }

View file

@ -16,7 +16,7 @@ path = "src/tail.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]

View file

@ -19,7 +19,7 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
let mut has_num = false; let mut has_num = false;
let mut last_char = 0 as char; let mut last_char = 0 as char;
for (n, c) in &mut chars { for (n, c) in &mut chars {
if c.is_digit(10) { if c.is_ascii_digit() {
has_num = true; has_num = true;
num_end = n; num_end = n;
} else { } else {

View file

@ -16,7 +16,7 @@ path = "src/tee.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
retain_mut = "=0.1.7" # ToDO: [2021-01-01; rivy; maint/MinSRV] ~ v0.1.5 uses const generics which aren't stabilized until rust v1.51.0 retain_mut = "=0.1.7" # ToDO: [2021-01-01; rivy; maint/MinSRV] ~ v0.1.5 uses const generics which aren't stabilized until rust v1.51.0
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc"] }

View file

@ -16,7 +16,7 @@ path = "src/test.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[target.'cfg(target_os = "redox")'.dependencies] [target.'cfg(target_os = "redox")'.dependencies]

View file

@ -16,7 +16,7 @@ path = "src/timeout.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
nix = { version = "0.24.1", default-features = false, features = ["signal"] } nix = { version = "0.24.1", default-features = false, features = ["signal"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["process", "signals"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["process", "signals"] }

View file

@ -50,11 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut line = String::new(); let mut line = String::new();
match reader.read_line(&mut line) { match reader.read_line(&mut line) {
Ok(_) => { Ok(_) => {
let tokens: Vec<String> = line let tokens: Vec<String> = line.split_whitespace().map(|s| s.to_owned()).collect();
.trim_end()
.split_whitespace()
.map(|s| s.to_owned())
.collect();
if tokens.is_empty() { if tokens.is_empty() {
break; break;
} }

View file

@ -16,7 +16,7 @@ path = "src/tty.rs"
[dependencies] [dependencies]
clap = { version = "3.1", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
libc = "0.2.125" libc = "0.2.126"
atty = "0.2" atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -15,6 +15,7 @@ use uucore::utmpx::{self, time, Utmpx};
use clap::{crate_version, Arg, Command}; use clap::{crate_version, Arg, Command};
use std::borrow::Cow; use std::borrow::Cow;
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt::Write;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
use std::path::PathBuf; use std::path::PathBuf;
use uucore::{format_usage, InvalidEncodingHandling}; use uucore::{format_usage, InvalidEncodingHandling};
@ -529,24 +530,24 @@ impl Who {
let mut buf = String::with_capacity(64); let mut buf = String::with_capacity(64);
let msg = vec![' ', state].into_iter().collect::<String>(); let msg = vec![' ', state].into_iter().collect::<String>();
buf.push_str(&format!("{:<8}", user)); write!(buf, "{:<8}", user).unwrap();
if self.include_mesg { if self.include_mesg {
buf.push_str(&msg); buf.push_str(&msg);
} }
buf.push_str(&format!(" {:<12}", line)); write!(buf, " {:<12}", line).unwrap();
// "%b %e %H:%M" (LC_ALL=C) // "%b %e %H:%M" (LC_ALL=C)
let time_size = 3 + 2 + 2 + 1 + 2; let time_size = 3 + 2 + 2 + 1 + 2;
buf.push_str(&format!(" {:<1$}", time, time_size)); write!(buf, " {:<1$}", time, time_size).unwrap();
if !self.short_output { if !self.short_output {
if self.include_idle { if self.include_idle {
buf.push_str(&format!(" {:<6}", idle)); write!(buf, " {:<6}", idle).unwrap();
} }
buf.push_str(&format!(" {:>10}", pid)); write!(buf, " {:>10}", pid).unwrap();
} }
buf.push_str(&format!(" {:<8}", comment)); write!(buf, " {:<8}", comment).unwrap();
if self.include_exit { if self.include_exit {
buf.push_str(&format!(" {:<12}", exit)); write!(buf, " {:<12}", exit).unwrap();
} }
println!("{}", buf.trim_end()); println!("{}", buf.trim_end());
} }

View file

@ -22,7 +22,7 @@ uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=[
winapi = { version = "0.3", features = ["lmcons"] } winapi = { version = "0.3", features = ["lmcons"] }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2.125" libc = "0.2.126"
[[bin]] [[bin]]
name = "whoami" name = "whoami"

View file

@ -31,7 +31,7 @@ time = { version="<= 0.3", optional=true, features = ["formatting", "local-offse
data-encoding = { version="2.1", optional=true } data-encoding = { version="2.1", optional=true }
data-encoding-macro = { version="0.1.12", optional=true } data-encoding-macro = { version="0.1.12", optional=true }
z85 = { version="3.0.5", optional=true } z85 = { version="3.0.5", optional=true }
libc = { version="0.2.125", optional=true } libc = { version="0.2.126", optional=true }
once_cell = "1.10.0" once_cell = "1.10.0"
os_display = "0.1.3" os_display = "0.1.3"

View file

@ -38,7 +38,7 @@ pub fn parse_size(size: &str) -> Result<u64, ParseSizeError> {
} }
// Get the numeric part of the size argument. For example, if the // Get the numeric part of the size argument. For example, if the
// argument is "123K", then the numeric part is "123". // argument is "123K", then the numeric part is "123".
let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect(); let numeric_string: String = size.chars().take_while(|c| c.is_ascii_digit()).collect();
let number: u64 = if !numeric_string.is_empty() { let number: u64 = if !numeric_string.is_empty() {
match numeric_string.parse() { match numeric_string.parse() {
Ok(n) => n, Ok(n) => n,

View file

@ -2840,7 +2840,7 @@ fn test_ls_context2() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for c_flag in ["-Z", "--context"] { for c_flag in ["-Z", "--context"] {
ts.ucmd() ts.ucmd()
.args(&[c_flag, &"/"]) .args(&[c_flag, "/"])
.succeeds() .succeeds()
.stdout_only(unwrap_or_return!(expected_result(&ts, &[c_flag, "/"])).stdout_str()); .stdout_only(unwrap_or_return!(expected_result(&ts, &[c_flag, "/"])).stdout_str());
} }