Pagination in TTY driver

Henry Spencer henry at utzoo.UUCP
Tue Aug 27 07:24:10 AEST 1985


This article is a collection of replies to several comments on in-kernel
tty paging.

> You mean like on TOPS-20? Where it seems the tty drivers use TERMCAP or an
> equivalent (if you type more than 1 line & hit ^U it cursors to the beginning
> of the input line (maybe several terminal lines above) and sends a CL sequence!

Interesting, but it has nothing to do with output pagination.

> Please tell us more about your user interface.  Do you require a Y every
> 23 lines of output?  Only after 23 lines without intervening input (so
> you never notice pagination while running less verbose commands?

Glossing over a few fine points, any time 22 lines of output are seen
without any intervening input, the tty driver stops and waits for a RETURN.
(Actually any input character will do, but RETURN arriving while the tty
is in a paging wait cancels the wait and disappears, while anything else
cancels the wait and sticks around.)  No, the "22" is not burned into the
kernel, it is set by an ioctl, generally to a number ultimately derived
from termcap.

> What are the drawbacks?

The only significant thing we've found is that it's hard to get line-wrap
handling 100% right.

> Do "portable" UNIX programs have to be modified
> to disable pagination for editing, communications, etc?

No, switching to CBREAK or RAW mode turns it off implicitly.  The only
things we have modified (except our kernel) are stty to know about the
paging ioctl, getty's terminal initialization to set the defaults right
(from termcap, by the way), and our local pager program "p" to exploit
kernel paging if it's on.  Nothing else.

> Does the TTY
> driver have to decode cursor motion sequences (as Multics did)?

No.

> [a similar scheme...]
> 	^S	turns pagination mode on and suspends output
> 	^Q	turns pagination mode off and resumes output

Wrong choice of control characters.  Nowadays one must assume that ^S
and ^Q are strictly, completely, and entirely reserved for flow control
between the terminal and the host.  We had a bug in this in our early
versions, in fact.

One thing which we do find valuable is a control character (settable via
the paging ioctls, default ^T) which turns paging off until the next
input character.  This lets you disable paging temporarily for something
like verbose program output that you don't want to see in detail.  The
ability to do this conveniently is important.

> The
> advantage of not having pagination in the kernel is the ability to have
> tailored paginators.

Agreed.  But for most people, a poor pager that's built in generally beats
a wonderful pager that always has to be invoked explicitly.  I dislike
building things like this into the kernel; there really ought to be some
way to run all one's terminal i/o through a central agent without having
to build the agent into the kernel.  Doing that efficiently isn't simple.
We decided that an ugly implementation now beat a clean one five years
down the road.  We were right.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.unix.wizards mailing list