Skip to content

Commit 8c389b4

Browse files
committed
printf: Ignore thousand seperator flag
1 parent e9a6602 commit 8c389b4

File tree

1 file changed

+7
-1
lines changed
  • src/uucore/src/lib/features/format

1 file changed

+7
-1
lines changed

src/uucore/src/lib/features/format/spec.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct Flags {
9595
space: bool,
9696
hash: bool,
9797
zero: bool,
98+
quote: bool,
9899
}
99100

100101
impl Flags {
@@ -108,6 +109,11 @@ impl Flags {
108109
b' ' => flags.space = true,
109110
b'#' => flags.hash = true,
110111
b'0' => flags.zero = true,
112+
b'\'' => {
113+
// the thousands separator is printed with numbers using the ' flag, but
114+
// this is a no-op in the "C" locale. We only save this flag for reporting errors
115+
flags.quote = true;
116+
}
111117
_ => break,
112118
}
113119
*index += 1;
@@ -181,7 +187,7 @@ impl Spec {
181187
}
182188
}
183189
b's' => {
184-
if flags.zero || flags.hash {
190+
if flags.zero || flags.hash || flags.quote {
185191
return Err(&start[..index]);
186192
}
187193
Self::String {

0 commit comments

Comments
 (0)