mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
printf: accept multiple length parameters
This commit is contained in:
parent
cd0c24af07
commit
f83e0d1b04
1 changed files with 37 additions and 26 deletions
|
@ -107,7 +107,15 @@ impl Spec {
|
|||
None
|
||||
};
|
||||
|
||||
let length = rest.get(0).and_then(|c| {
|
||||
// Parse 0..N length options, keep the last one
|
||||
// Even though it is just ignored. We might want to use it later and we
|
||||
// should parse those characters.
|
||||
//
|
||||
// TODO: This needs to be configurable: `seq` accepts only one length
|
||||
// param
|
||||
let mut _length = None;
|
||||
loop {
|
||||
let new_length = rest.get(0).and_then(|c| {
|
||||
Some(match c {
|
||||
b'h' => {
|
||||
if let Some(b'h') = rest.get(1) {
|
||||
|
@ -132,9 +140,12 @@ impl Spec {
|
|||
_ => return None,
|
||||
})
|
||||
});
|
||||
|
||||
if length.is_some() {
|
||||
if new_length.is_some() {
|
||||
*rest = &rest[1..];
|
||||
_length = new_length;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let type_spec = rest.get(0)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue