Using less to view output
Jay R. Ashworth
jra at baylink.com
Sat May 14 16:42:26 PDT 2005
On Sat, May 14, 2005 at 11:38:40AM -0400, Kenneth Brody wrote:
> Quoting Robert T. Repko (R Squared Consultants) (Sat, 14 May 2005 11:08:03
> -0400):
> > I have the following printer definition setup in one of my clients
> > filepro config file. This successfully works at other locations but
> > I am unable to get it to work on this system.
> >
> > printer27=ViaFile,nocodes, | cat > /tmp/fpfile$$ ; less /tmp
> > /fpfile$$ ;rm /tmp/fpfile$$,Send output to /tmp/fpfile$$
> >
> > When I run a report the fpfile is created, and removed, but is not
> > displayed, I am immediately returned to the command prompt or menu. I
> [...]
>
> When filePro closes the printer output, the system will then run less.
> However, what will less be using to read the keyboard? After all, its
> stdin has been closed. (I believe that less will open "/dev/tty" in
> this case, since I know you can pipe things to less.) However, you
> now have two programs reading from that device -- the program that
> called *report (in this case, runmenu) will be reading the input
> device, and so will less.
>
> How does this work on other systems? How can you be scrolling through
> a file within less, while at the same time be interacting with the
> filePro menu that has been redisplayed?
Because filepro is supposed to send it's output to *the pipeline*,
which is run by a subshell, and filepro shouldn't get control back
until the pipeline exits.
I suspect strongly that this depends intimately on the semantics of the
SYSTEM() system call, and that he might have better luck enclosing the
pipeline (the series of semicolon-chained commands, which strictly
speaking is *not* a pipeline) in explicit parenthesis.
Whether that will help *also* depends on the semantics of system; he
might need to make the string of commands a shell script (which makes
more sense anyway)...
Cheers,
-- jra
--
Jay R. Ashworth jra at baylink.com
Designer Baylink RFC 2100
Ashworth & Associates The Things I Think '87 e24
St Petersburg FL USA http://baylink.pitas.com +1 727 647 1274
If you can read this... thank a system administrator. Or two. --me
More information about the Filepro-list
mailing list