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

2022-05-28 Thread Hadrien Lacour
On Sat, May 28, 2022 at 08:32:57PM +0200, Markus Wichmann wrote: > ultimately terminates on the terminal. But who knows if that is the > case? Pipelines ending in a call to "less" will terminate on the > terminal, pipelines ending in a call to "nc" will not. So the shell > can't know, only the last

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

2022-05-28 Thread Markus Wichmann
On Sat, May 28, 2022 at 07:19:24PM +, Rodrigo Martins wrote: > Hello, Markus, > > Thank for filling in the details. I should do more research next time. > > I tried to write a program that does the same as stdbuf(1), but using > setbuf(3). Unfortunately it seems the buffering mode is reset acro

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

2022-05-28 Thread Rodrigo Martins
Hello, Markus, Thank for filling in the details. I should do more research next time. I tried to write a program that does the same as stdbuf(1), but using setbuf(3). Unfortunately it seems the buffering mode is reset across exec(3), since my program did not work. If it did that would be a clea

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

2022-05-28 Thread Markus Wichmann
On Sat, May 28, 2022 at 06:09:04PM +, Hadrien Lacour wrote: > Now, I wonder how it'd be fixed ("it" being how does the read end of the pipe > signal to the write one the kind of buffering it wants) in a perfect world. The problem ultimately stems from the mistaken idea that buffering is invisi

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

2022-05-28 Thread Hadrien Lacour
On Sat, May 28, 2022 at 07:58:40PM +0200, Markus Wichmann wrote: > > You can use stdbuf(1) to modify that aspect without touching the > > program source itself. > > > > Had to look up the source for that. I had heard of stdbuf, but I always > thought that that was impossible. How can one process ch

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

2022-05-28 Thread Markus Wichmann
On Sat, May 28, 2022 at 08:38:49AM +, Hadrien Lacour wrote: > On Sat, May 28, 2022 at 03:33:16AM +, Rodrigo Martins wrote: > > Hello, > > > > The problem here is I/O buffering. I suspect it to happen in the C > > standard library, specifically on the printf function family. You know, that

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

2022-05-28 Thread Hadrien Lacour
On Sat, May 28, 2022 at 03:33:16AM +, Rodrigo Martins wrote: > 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 interactiv

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

2022-05-28 Thread Rodrigo Martins
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