			MG Termcap Terminal Driver

The termcap library needs to know where to get the terminal type and
termcap capibilities file from.  UNIX and Os9/68k users should

	setenv TERM term-type

to their terminal type, and

	setenv TERMCAP termcap-file

if they are using a non-standard termcap file.  VMS users should see
[.SYS.VMS]AAAREADME.1ST for information on how to define the logical
names TERM and ETC to point to the termcap definition file.  Users of
other operating systems should do the aproprate thing.  For an example
of a termcap file, UNIX users may look in /etc/termcap, Os9/68k users
may look at /dd/sys/termcap (if present), and VMS users should see the
file [.SYS.VMS.TERMCAP]TERMCAP. 

MG requires that certain terminal capabilities exist in the specified
termcap entry.  The "cm" (cursor motion) capability *must* be
available to use MG.  (Yes, it is possible to fake cm with some other
capibilities, but MG doesn't try.) If your terminal is one that uses
control characters in the paramater portion of the "cm" string, the
"up" and "bc" capabilites may also be needed.  (See your termlib
documentation for when this is so.)

If the following capabilities are available, they are used.  The AL
and DL sequences are not totally standard, but having them improves
the performance of the editor, since it doesn't have to redraw the
screen to delete a line.  They should not be used if they need control
characters as paramaters.

	cd	-- clear display
	ce	-- clear to end of line

	al	-- insert 1 line
	dl	-- delete 1 line

	AL	-- insert multiple lines (note capitalization)
	DL	-- delete multiple lines (note capitalization)

	ti	-- cursor movement initialization string
	te	-- cursor movement end string

The cs capability is not as standard as some of the other
capibilities, but is used by MG when available.  It is used to define
a "scrolling region", which defines a window within the screen where
all the action takes place.  A newline character at the bottom of this
area scrolls the rest of the text in the area up one line, just like
the normal screen; a reverse linefeed (sr) at the top of the window
moves all the text in the area down a line.  MG does not properly
handle "cs" if your terminal needs control characters as paramaters,
and in this case "cs" should not be defined.

If the cs and sr capabilities are available, the termcap driver uses
these to make the insert/delete line functions work more smoothly. If
only the cs capability is present, it is still used for the delete
line function, but not for inserting lines.

Use of the cs capability is often desirable, but is not a win on
bit-mapped screens such as Sun workstation console windows.  This is
because it takes longer to scroll the window than to redraw it.  If
you are using a workstation window, you might consider using a termcap
entry that doesn't have the cs capability.

The definition of the cs capability is: the first parameter in the
sequence defines the first row (origin 0) that is in the scrolling
region, and the second argument defines the last row to include in the
scrolling region.

	cs	-- set scrolling region (arg1 = top, arg2 = bottom)
	sr	-- reverse index

The following capabilities provide for an enhanced (reverse-video or
otherwise rendered) mode line.  The sg entry should not be present on
terminals that do this to characters as they are placed on the screen.
Terminals that put a region of the screen in the standout mode should
have sg defined as numeric: :sg#0: for terminals that do this on
regions but don't take any character positions to do this, (this may
be a non-standard interprition of the meaning of sg) and the number of
character positions taken by any other terminal.

	so	-- enter standout mode
	se	-- leave standout mode
	sg	-- number of character positions used by standout

		Terminal-specific initialization file

If the MG termcap terminal driver is compiled with XKEYS defined, and
the startup file option is enabled as well, MG will look for a
terminal-specific initialization file.  The name of the terminal
initialization file varies between operating systems, but will usually
look like .mg-TERM, where TERM represents your terminal type.  For
example, a terminal initialization file under Unix and VMS for the DEC
VT100 terminal (termcap type vt100) would have the name ".mg-vt100". 

The terminal-specific startup file has the same format as the mg
startup file, and is executed immediately after the startup file
during mg's startup phase.  An example vt100 initialization file
follows, which globally binds the key sequences sent by the VT100
terminal (in keypad mode) to the appropriate functions.

----------------------------------CUT HERE-----------------------------------
;
; Small key definition file for VT100 terminals using the termcap
; driver. This only works if XKEYS is defined during compilation.
;
(global-set-key "\eOA" 'previous-line)	; up arrow
(global-set-key "\eOB" 'next-line)	; down arrow
(global-set-key "\eOC" 'forward-char)	; right arrow
(global-set-key "\eOD" 'backward-char)	; left arrow
