mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 21:17:46 +00:00
wc: reset current_char_count after each line.
This commit is contained in:
parent
6c897dc76c
commit
be117de7e7
1 changed files with 1 additions and 1 deletions
|
@ -112,7 +112,6 @@ pub fn wc(files: Vec<String>, matches: &Matches) -> StdResult<(), isize> {
|
|||
let mut word_count: usize = 0;
|
||||
let mut byte_count: usize = 0;
|
||||
let mut char_count: usize = 0;
|
||||
let mut current_char_count: usize = 0;
|
||||
let mut longest_line_length: usize = 0;
|
||||
|
||||
loop {
|
||||
|
@ -128,6 +127,7 @@ pub fn wc(files: Vec<String>, matches: &Matches) -> StdResult<(), isize> {
|
|||
byte_count += raw_line.len();
|
||||
|
||||
// try and convert the bytes to UTF-8 first
|
||||
let mut current_char_count = 0;
|
||||
match from_utf8(raw_line.as_slice()) {
|
||||
Ok(line) => {
|
||||
word_count += line.words().count();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue