cut: Ignore trailing newline if present
This commit is contained in:
parent
da67d593d8
commit
e740489abd
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/e740489abd Pull-request: https://github.com/SerenityOS/serenity/pull/19614
1 changed files with 3 additions and 1 deletions
|
@ -241,8 +241,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto file = TRY(Core::InputBufferedFile::create(maybe_file.release_value()));
|
||||
|
||||
Array<u8, PAGE_SIZE> buffer;
|
||||
while (!file->is_eof()) {
|
||||
while (TRY(file->can_read_line())) {
|
||||
auto line = TRY(file->read_line(buffer));
|
||||
if (line == "\n" && TRY(file->can_read_line()))
|
||||
break;
|
||||
|
||||
if (selected_bytes) {
|
||||
process_line_bytes(line, disjoint_ranges);
|
||||
|
|
Loading…
Add table
Reference in a new issue