1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

tac: buffer stdout more coarsely than line-based following the GNU tac implementation.

This commit is contained in:
Adam Reichold 2021-10-09 12:12:57 +02:00
parent 28b04fa899
commit 4eab275235

View file

@ -12,7 +12,7 @@ extern crate uucore;
use clap::{crate_version, App, Arg};
use memchr::memmem;
use std::io::{stdin, stdout, Read, Write};
use std::io::{stdin, stdout, BufWriter, Read, Write};
use std::{fs::read, path::Path};
use uucore::display::Quotable;
use uucore::InvalidEncodingHandling;
@ -106,7 +106,7 @@ fn buffer_tac_regex(
before: bool,
) -> std::io::Result<()> {
let out = stdout();
let mut out = out.lock();
let mut out = BufWriter::new(out.lock());
// The index of the line separator for the current line.
//
@ -173,7 +173,7 @@ fn buffer_tac_regex(
/// `"/abc/def"`.
fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()> {
let out = stdout();
let mut out = out.lock();
let mut out = BufWriter::new(out.lock());
// The number of bytes in the line separator.
let slen = separator.as_bytes().len();