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

2022-05-31 Thread Georg Lehner
Hello, Does nobuf(1) help?   http://jdebp.uk/Softwares/djbwares/guide/nobuf.html Note: it tackles exactly the POSIX feature to line buffer output to tty's by providing one to the program in the pipeline, but without using any shared-object magic. Have not used it (yet) though. Best Regards

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

2022-05-29 Thread Josuah Demangeon
Rodrigo Martins wrote: > What if instead of changing every program we changed the standard > library? We could make stdio line buffered by setting an environment > variable. I applaude this idea! Environment variables seems to be the right spot for any config a library could need: are unobstrusive

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

2022-05-29 Thread Markus Wichmann
On Sun, May 29, 2022 at 10:20:05PM +, Rodrigo Martins wrote: > It was thus said that the Great Markus Wichmann once stated: > > And you fundamentally cannot change anything about the userspace of another > > program, at least not in UNIX. > > When I open file descriptors and exec(3) the new pr

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

2022-05-29 Thread Rodrigo Martins
It was thus said that the Great Markus Wichmann once stated: > And you fundamentally cannot change anything about the userspace of another > program, at least not in UNIX. When I open file descriptors and exec(3) the new program inherits those. Is that not chaning the userspace of another proces

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

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

2022-05-27 Thread Kyryl Melekhin
"Greg Reagle" wrote: > I have a file named "out" (from ii) that I want to view. Of course, it can > grow while I am viewing it. I can view it with "tail -f out" or "less +F out > ", both of which work. I also want to apply some processing in a pipeline, > something like "tail -f out | tr a A |

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

2022-05-27 Thread taaparthur
May 27, 2022, 11:43 AM, "Greg Reagle" mailto:l...@speedpost.net?to=%22Greg%20Reagle%22%20%3Clist%40speedpost.net%3E > wrote: > > I have a file named "out" (from ii) that I want to view. Of course, it can > grow while I am viewing it. I can view it with "tail -f out" or "less +F > out", both of

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

2022-05-27 Thread Hadrien Lacour
On Fri, May 27, 2022 at 02:43:03PM -0400, Greg Reagle wrote: > I have a file named "out" (from ii) that I want to view. Of course, it can > grow while I am viewing it. I can view it with "tail -f out" or "less +F > out", both of which work. I also want to apply some processing in a > pipeline

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

2022-05-27 Thread Alexandre Niveau
Hello, Le ven. 27 mai 2022 à 20:45, Greg Reagle a écrit : > > I have a file named "out" (from ii) that I want to view. Of course, it can > grow while I am viewing it. I can view it with "tail -f out" or "less +F > out", both of which work. I also want to apply some processing in a > pipelin

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

2022-05-27 Thread Greg Reagle
I have a file named "out" (from ii) that I want to view. Of course, it can grow while I am viewing it. I can view it with "tail -f out" or "less +F out", both of which work. I also want to apply some processing in a pipeline, something like "tail -f out | tr a A | less" but that does not work