How 'p' works.

Danny danny at itm.UUCP
Fri Dec 14 00:54:01 AEST 1984


@

    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)



More information about the Comp.unix.wizards mailing list