[net.unix-wizards] How 'p' works.

grt@twitch.UUCP ( G.R.Tomasevich) (12/11/84)

> >      Today I was looking for some old news articles.  I cd'ed to
> > the appropriate news directory and typed:
> > 
> > 		p `egrep -l pattern *`
> > 
> > 	As it turned out, the pattern wasn't found in any of the
> > articles.

It seems that 'p' must be broken.  I have not seen it but use 'pgr', which
apparently does the same type of paging.  If an empty file is specified
on the command line or piped to it, 'pgr' says 'line 0:' and is ready to exit.
-- 
	George Tomasevich, ihnp4!{twitch|spastic}!grt
	AT&T Bell Laboratories, Holmdel, NJ

danny@itm.UUCP (Danny) (12/13/84)

@

    Yeah, yeah, we all *know* that UN*X is so [insert adjective here]
that no one in his right mind would *dare* use it right? :-)

    Nevertheless, let me point out that no matter how similar
files/terminals appear, they *are* different, and sometimes, special
allowances must be made.

    In my version of "more" (what? another more?) I specifically check
for stdin being a terminal (isatty(3)), and, if so, it informs the
user that it will not "more" a terminal.  Another solution I have seen
is instead of a error message and subsequent exit, it simply doesn't 
page, just copies straight through.  Of course, in the latter case,
it still waits (quite a while, I might add) for input from the
terminal.

    The reason I chose the former approach was that I use "more"
as an interactive tool, and as such, it does pretty well (it won't
let me "more" a binary, either).  But, as a substitute for "cat", well,
'nuff said.

    I suggest that the check for stdin == tty be added to "p" (let's
hear it for multiple versions, huh?), and "p" will nevermore
wait forever for input (22 lines of input at that!).

                                    Danny
-- 
				Daniel S. Cox
				({gatech|akgua}!itm!danny)