Re: [dev] ii: how to process out in a pipeline and still page with less

From: Rodrigo Martins <rm_AT_firemail.cc>
Date: Sat, 28 May 2022 03:33:16 +0000

Hello,

The problem here is I/O buffering. I suspect it to happen in the C standard library, specifically on the printf function family. If I recall, the C standard says stdio is line-buffered when the file is an interactive device and let's it be fully buffered otherwise. This is likely why you see different behavior with and without less on the pipeline.
I don't yet have a clear solution to this problem that doesn't involve modifying each program in the pipeline, but I've annexed a C source as an example that may be used in place of tr to replace single chars. This program is not supposed to buffer any I/O.
I see tee "shall not buffer output". Another possibility is the setbuf function, but I'm not sure it can be used without editing each program. More investigation is needed.

Rodrigo.

Received on Sat May 28 2022 - 05:33:16 CEST

This archive was generated by hypermail 2.3.0 : Sat May 28 2022 - 09:48:08 CEST