mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
comm: Stop skipping a line in the output
Because of how we output lines in the loop above, if we leave that loop when the last line was not the same in both files, then either `file1_line` or `file2_line` has not been output yet. `process_remaining()` does not print that line either, since it immediately reads a new line. So, output the previously-missing line before we call that. :^)
This commit is contained in:
parent
83366e2b2e
commit
8ed5403d8c
1 changed files with 10 additions and 0 deletions
|
@ -141,6 +141,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
// If the most recent line read was not a match, then the last line read from one of the files has not yet been output.
|
||||
// So let's output it!
|
||||
if (!read_file1 && !suppress_col1) {
|
||||
++col1_count;
|
||||
outln(col1_fmt, file1_line);
|
||||
} else if (!read_file2 && !suppress_col2) {
|
||||
++col2_count;
|
||||
outln(col2_fmt, file2_line);
|
||||
}
|
||||
|
||||
process_remaining(col1_fmt, file1, col1_count, !suppress_col1);
|
||||
process_remaining(col2_fmt, file2, col2_count, !suppress_col2);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue