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

wc: Swap order of characters and bytes in output

This way it matches GNU and busybox.
This commit is contained in:
Jan Verbeek 2021-08-25 14:40:17 +02:00 committed by Michael Debertol
parent 657a04f706
commit d0c0564947
2 changed files with 9 additions and 9 deletions

View file

@ -460,13 +460,6 @@ fn print_stats(
write!(stdout_lock, "{:1$}", result.count.words, min_width)?; write!(stdout_lock, "{:1$}", result.count.words, min_width)?;
is_first = false; is_first = false;
} }
if settings.show_bytes {
if !is_first {
write!(stdout_lock, " ")?;
}
write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?;
is_first = false;
}
if settings.show_chars { if settings.show_chars {
if !is_first { if !is_first {
write!(stdout_lock, " ")?; write!(stdout_lock, " ")?;
@ -474,6 +467,13 @@ fn print_stats(
write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; write!(stdout_lock, "{:1$}", result.count.chars, min_width)?;
is_first = false; is_first = false;
} }
if settings.show_bytes {
if !is_first {
write!(stdout_lock, " ")?;
}
write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?;
is_first = false;
}
if settings.show_max_line_length { if settings.show_max_line_length {
if !is_first { if !is_first {
write!(stdout_lock, " ")?; write!(stdout_lock, " ")?;

View file

@ -53,7 +53,7 @@ fn test_utf8() {
.args(&["-lwmcL"]) .args(&["-lwmcL"])
.pipe_in_fixture("UTF_8_test.txt") .pipe_in_fixture("UTF_8_test.txt")
.run() .run()
.stdout_is(" 303 2119 23025 22457 79\n"); .stdout_is(" 303 2119 22457 23025 79\n");
} }
#[test] #[test]
@ -62,7 +62,7 @@ fn test_utf8_extra() {
.arg("-lwmcL") .arg("-lwmcL")
.pipe_in_fixture("UTF_8_weirdchars.txt") .pipe_in_fixture("UTF_8_weirdchars.txt")
.run() .run()
.stdout_is(" 25 87 513 442 48\n"); .stdout_is(" 25 87 442 513 48\n");
} }
#[test] #[test]