mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
tail: fix parsing logic and add quote
This commit is contained in:
parent
f10faf21bc
commit
b93bae2964
1 changed files with 10 additions and 9 deletions
|
@ -80,7 +80,7 @@ impl FilterMode {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid number of bytes: {e}"),
|
format!("invalid number of bytes: '{e}'"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,16 +415,17 @@ fn parse_num(src: &str) -> Result<Signum, ParseSizeError> {
|
||||||
starting_with = true;
|
starting_with = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return Err(ParseSizeError::ParseFailure(src.to_string()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_size(size_string).map(|n| match (n, starting_with) {
|
match parse_size(size_string) {
|
||||||
(0, true) => Signum::PlusZero,
|
Ok(n) => match (n, starting_with) {
|
||||||
(0, false) => Signum::MinusZero,
|
(0, true) => Ok(Signum::PlusZero),
|
||||||
(n, true) => Signum::Positive(n),
|
(0, false) => Ok(Signum::MinusZero),
|
||||||
(n, false) => Signum::Negative(n),
|
(n, true) => Ok(Signum::Positive(n)),
|
||||||
})
|
(n, false) => Ok(Signum::Negative(n)),
|
||||||
|
},
|
||||||
|
Err(_) => Err(ParseSizeError::ParseFailure(size_string.to_string())),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_args(args: impl uucore::Args) -> UResult<Settings> {
|
pub fn parse_args(args: impl uucore::Args) -> UResult<Settings> {
|
||||||
|
|
Loading…
Reference in a new issue