mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Forbid octal numbers for width parameter
This commit is contained in:
parent
d1f7f51f99
commit
aec63c06fd
1 changed files with 7 additions and 1 deletions
|
@ -570,7 +570,13 @@ impl Config {
|
||||||
|
|
||||||
let width = match options.value_of(options::WIDTH) {
|
let width = match options.value_of(options::WIDTH) {
|
||||||
Some(x) => match x.parse::<u16>() {
|
Some(x) => match x.parse::<u16>() {
|
||||||
Ok(u) => u,
|
Ok(u) => {
|
||||||
|
if u != 0 && x.starts_with('0') {
|
||||||
|
return Err(LsError::InvalidLineWidth(x.into()).into());
|
||||||
|
} else {
|
||||||
|
u
|
||||||
|
}
|
||||||
|
}
|
||||||
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
|
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
|
||||||
},
|
},
|
||||||
None => match termsize::get() {
|
None => match termsize::get() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue