[comp.unix.wizards] Using more as an output filter via popen - pipe buffering

jcurran@bbn.com (John Curran) (06/23/91)

I'm looking for advice on how to utilize "more" from within a program
as an output filter.  I tried the following code segment:
 
pager = popen("{PAGER-more}","w");
for (...) {
  putc(ch++,pager)
}

This works, except that when more displays the output, it is not
possible to stop the display via the "q" command. I added a SIGPIPE
handler to longjmp and close the pipe, but that did not change the
results.  I reduced the amount of buffered data by switching to
write(fileno(pager),ch,1), but it still does not stop for files
over 8K.  Am I right in assuming that this is a result of the 
internal buffering in pipes?  Is there a method to force a
smaller pipe buffer? 
 
Thanks,
/John