How does man know?

Richard O'Keefe ok at cs.mu.oz.au
Tue Oct 3 21:20:31 AEST 1989


In article <2772 at crdgw1.crd.ge.com>, barnett at crdgw1.crd.ge.com (Bruce Barnett) writes:
> I wrote: >>IMHO the BSD solution was right.
> I still think BSD made the right choice at the time.

But versions of UNIX with paging in the terminal driver PRECEDED  BSD 4.1.
Nor was paging in the terminal driver a UNIX invention; it is a rather old
technique.

> Richard O'Keefe mentions one (<2258 at munnari.oz.au>) that is
> enabled by typing "stty rows 0".

No, I mentioned on which was **DIS**abled by doing that.
> Paging has nothing to do with the number of rows a terminal has.
Yes it does.  The pager needs to know how many lines of text it can
display before it is time to stop and wait for the user to say s/he
is ready for the next screenful.  That number of lines is precisely
the relevant number of "rows".  The figure given to stty is not the
number of rows the TERMINAL HAS but the number of rows the USER WANTS
in a screenful.  This is why you can set "rows" to a number other than
the size of the terminal declared in the termcap or terminfo data base.

> I also don't understand how the paging should be handled.
> I assume you are talking about a user down-loading into the STREAMS
> tty driver the pager characteristics that the user wants.

What has STREAMS to say to anything?  In the V.3 system I used, terminals
weren't STREAMS things anyway.  Paging in the terminal driver predates
STREAMS by decades!  I used EUUG V7 on an old "Bantam" terminal, about
as simple a 24-by-80 terminal as ever had cursor addressing.

> Suppose I run a program that generates thousands of lines of data.
> I read the first 30 lines and then want to quit. Does the terminal driver
> tell the program it cannot write any more?

You type your interrupt character, just like always.
THAT'S THE POINT.  You don't have to wire special stuff into every single
program to make it drop dead when the user wants to kill it.  You can, if
you wish, put special stuff in to prevent this.  Similarly, there is
nothing special about 'man'.  Ok, so it generates a modest amount of output.
So do thousands of other programs.  The point is that if paging is built
into the terminal driver (thank you whoever put the feature into European
Unix User Group V7 Unix, thank you whoever put it into SunOS), then it is
*automatically* available to *every* program and they all look the same
to users.  You don't get confused by one program picking using $PAGER,
another program looking in ~/.foorc, another always using more, yet
another one having its own pager built in which isn't quite the same, and
fifty thousand others not using any pager at all.

> I cannot conceive of a single pager model that will work in all cases.

What do you mean, work?  I can conceive of a simple pager model which
meant that unless I deliberately ask for it to be switched off, I never
have to re-run a program because the information I want scrolled off the
top of the display before I was ready for it.  I can conceive of it
because I was using it in UNIX nearly ten years ago.  The old BSD &
System V scheme where normal behaviour was for information to always
fall off the top of your terminal can't really be said to work in ANY case.
And the EUUG V7 scheme would get out of the way if you asked it to,
and a program like 'more' could run on it without even knowing that the
terminal driver could page too.  And if you never wanted terminal paging,
you could just put the command to disable it in your .profile.

> Sure, everyone should have a workstation on their desk.
> But that's not the real world. If Unix is going to be successful,
> it has to support the commercial market.

The real world is that paging worked in a reasonably popular variant of
V7 UNIX on plain ASCII terminals ten years ago; for *every* program.



More information about the Comp.unix.questions mailing list