mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
comm: clear buffers between read_line calls
This commit is contained in:
parent
14b1313eaf
commit
8a6768e9bd
1 changed files with 4 additions and 0 deletions
|
@ -86,6 +86,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) {
|
||||||
ensure_nl(ra);
|
ensure_nl(ra);
|
||||||
print!("{}{}", delim[1], ra);
|
print!("{}{}", delim[1], ra);
|
||||||
}
|
}
|
||||||
|
ra.clear();
|
||||||
na = a.read_line(ra);
|
na = a.read_line(ra);
|
||||||
},
|
},
|
||||||
Ordering::Greater => {
|
Ordering::Greater => {
|
||||||
|
@ -93,6 +94,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) {
|
||||||
ensure_nl(rb);
|
ensure_nl(rb);
|
||||||
print!("{}{}", delim[2], rb);
|
print!("{}{}", delim[2], rb);
|
||||||
}
|
}
|
||||||
|
rb.clear();
|
||||||
nb = b.read_line(rb);
|
nb = b.read_line(rb);
|
||||||
},
|
},
|
||||||
Ordering::Equal => {
|
Ordering::Equal => {
|
||||||
|
@ -100,6 +102,8 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) {
|
||||||
ensure_nl(ra);
|
ensure_nl(ra);
|
||||||
print!("{}{}", delim[3], ra);
|
print!("{}{}", delim[3], ra);
|
||||||
}
|
}
|
||||||
|
ra.clear();
|
||||||
|
rb.clear();
|
||||||
na = a.read_line(ra);
|
na = a.read_line(ra);
|
||||||
nb = b.read_line(rb);
|
nb = b.read_line(rb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue