Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c Subject: Re: MORE/PAGING routine needed ... Summary: If you use more ... Keywords: paging routine Message-ID: <452@mole-end.UUCP> Date: 9 Dec 90 07:21:42 GMT References: <1244@eci.UUCP> <1990Nov12.181848.10371@ccu.umanitoba.ca> <1584@travis.csd.harris.com> Distribution: usa Organization: mole-end--private system. admin: mole-end!newtnews Lines: 24 > >>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