MORE/PAGING routine needed ...
    Mark A Terribile 
    mat at mole-end.UUCP
       
    Sun Dec  9 18:21:42 AEST 1990
    
    
  
> >>MORE is quite a powerful pager, ...
 
> I had to solve the "pager" problem a few months ago. Basically - if you
> want to have MORE as your pager (and you are on Unix) than you can do
> this using popen(3S) and pclose(3S). Just tell popen the name of the 
> command you want to write to and it will return you the file-pointer
> to use for your output.
Let me encourage those who would code something like this for themselves--
be sure that you use the pager specified by  $PAGER  if such there be.  This
code does, to its credit.
You can probably simplify the code some with something like
	popen( " [ \"$PAGER\" ] && ( $PAGER || true ) || /usr/ucb/more ", w )
which does much of the testing of cases, at the expense of execution time.
If you aren't going to do it often, or if the user is going to spend a fair
amount of time in the file, it's probably OK, and it allows you to use the
shell instead of programming all the cases yourself.
-- 
 (This man's opinions are his own.)
 From mole-end				Mark Terribile
    
    
More information about the Comp.lang.c
mailing list