January 30, 1977

There is a binary for ex1.1 in this directory (a.out) which can be "installed"
if you have a full load of user core and an 11/45 or 11/70.
If you have an 11/34 or 11/40 with 64K bytes of user space, you can
"mv a.outNOID a.out" and then "install".
If you prefer an ex without open and visual modes (for whatever reason)
choose between "a.outNOVISUAL" and "a.outNOVISNOID".
If you have a Berkeley type system (with full word significant user id's)
then you should use the "patchd" program in this directory on the binaries
you wish to use.  This is just a db "!" patch, but db doesn't work on
separate i/d programs.

Thus a typical installation, using just "a.out", on a standard UNIX system
would be:
	sh install

or to install the smallest ex here on an 11/34 or 11/40
	mv a.outNOVISNOID a.out
	sh install

This process will give you a basic editor (without any of its data bases)
which you can try.

Other files (other than /usr/bin/ex and /usr/bin/edit):

The editor keeps its error messages in a file.  This file is
"/usr/lib/ex1.1strings", and must be present or all errors will be
diagnosed as "ERROR".

The data base for the editor "help" command lives in "/usr/lib/how_ex"
(a directory)... the files in how_ex go there.

The programs "expreserve" and "exrecover" (from ../exrecover) should
be setuserid root and go in /usr/lib.  There should be a directory
/usr/preserve owned by root, mode 755 for use by these programs.

If you clean out /tmp in /etc/rc there should be a line
	/usr/lib/expreserve -a
before you do this.

This editor needs a number of hooks into the rest of the system to get
information about teletype types.  The changes needed in the system at
large to support this are described in the file SETUP.

The editor uses the data base "/etc/ttycap" to discern capabilities
of terminals, mapping a two character code it gleaned from the "htmp"
data base (described below) to the characteristics of that terminal.
You can add new terminals to /etc/ttycap quite easily... look
at ../s6/ttycap.5.  Adding a cursor addressible terminal requires
an editor recompilation if you want to use the cursor addressing.
Only a straightforward change to ex_ca.c is necessary.

There is a system data base "/etc/ttytype" which maps terminals
to 2 character type codes... see ../s6/ttytype.5.
Look at ../etc/ttytype for a sample of this data base... you
should change this file to correspond to your system.
You can add new types as necessary to "/etc/ttycap" in this process
or simply leave some terminals "unknown" for now.

The editor uses a data base "/etc/htmp" to determine a user's
home directory and his terminal type.
This is necessary for terminal types to handle dial-ups and for
home directories to allow them to be changed and to avoid
password file searches on systems with large password files.
The best way to implement the maintenance of "/etc/htmp" is to have
the "login" program maintain it.  There is a set of routines
in ../s7 (libX.a) which make this trivial.  The "htmp" routines
can be used to access htmp, the "typeof" routines to extract types
from /etc/ttytype.  If you don't have "login" do this, you will
have to do it by hand every time you login, or the editor may
have the wrong terminal type and will not be able to find your
start_up file. A login and an su program changed to handle the
maintenance of "htmp" are given in ../s1.

If you need to recompile:

This directory contains all of the source for "ex" version 1.1.
To recompile the editor you will need a version 7 C compiler
as well as the following non-standard programs:

	mkstr		create string message file
	lnall		link a number of files to a directory in one blow
	mvall		move all of a number of files
	rmtree		remove a hierarchical subtree
	cxref		a shell script giving a list of routine defn points

All of these programs are on this tape (except the C compiler) and of the
others, only mkstr is truly essential.
(Recompilation should not be necessary unless you wish to change the editor
or have a Version 7 UNIX system.)

System dependencies:

The only major problems here are the format of "/etc/utmp",
the form of teletype names, and the meaning of user/group id's.
Several of the programs in ../s6, notably "ttytype" and "sethome",
assume that "utmp" is accessed as a array indexed by the letter of the
terminal in use, treated as a number.  Other systems have slots
arranged '0', '1', ... '9', 'A', ... .
If you have the latter format you'll have to change these programs.

If you treat a user/id as being significant in all 16 bits
returned from "getuid()" in determining if two people are the
same person (i.e. if you have "newgrp") then should use the
program "patchd" to change the initial value of "mask" to be 0177777, i.e.:
	patchd _mask 177777 a.out

This is trivial, but essential.
Note that you must also change the source for the ttytype and sethome
programs to not mask off these bits and recompile (or use patchd)

Finally the editor (and all other programs here) assume ttynames of the
form "/dev/ttyx" with x a single letter.

If you are having system related problems or have questions
please feel free to give me a call.

Other, less serious, dependencies are:

1. This editor assumes that you have a restricted, 512 byte
argument list.  If your system gives larger lists that is no problem,
but the "next" command will allow at most 512 character lists on
subsequent matchings.

2. The major and minor device numbers of /dev/null and /dev/tty
are used and are given in ex_io.h.  Also the system error codes are mapped
from magic numbers to names here.  If your system has additional codes
these numbers will have to be extended and new cases will have to be
added to the switch on page 6 of ex_io.c.

3. To add a cursor addressible terminal in this version, you must recompile.
A simple change is required to the routines in "ex_ca.c", with a return
code of 1 being supplied for the new known type, and a string doing the
addressing being returned from cgoto.  This information should
be put in /etc/ttycap, but I haven't seen enough terminals to know
a good encoding.

4. This version of the editor needs a printf which prints through putchar.
Such a printf exists in printf.s in this directory.

5. The read routine rop in exr.c knows about special binary files.
Thus if you have any more binary files with different magic numbers
it makes sense to add them here so the editor will give better diagnostics.

I would like to hear of other dependencies/problems you encounter.

Scripts:

The following scripts are in this directory of general interest

	makeex		make a new binary and string file
	comp		recompile and load one or more files
	install		put new ex in /usr/bin... you may want to change
			the path names

The shell used for these scripts is in the directory ../ashell,
with documentation in ../s6/sh.6.
If you comment out the "set" commands or make a dummy set command
which does nothing then any other shell should do fine.

Note also that the scripts making ex use a "version" shell script
which uses ex.  If you have no ex, the script will fail in a safe way.

In order for the option setting for "edit" to work either the second
or third character of its name must be a 'd'.  Thus "edit" and "nedit"
are fine.  This is naive, but easy to change... look at the first few
lines of ex.c.


To complete the installation of ex you must also install exrecover and
expreserve see the directory ../exrecover.  I would appreciate hearing of
any problems you have with the editor or of any improvements you make.
One thing which would be nice to have is the ability to drive terminals
with more intelligent operations such as add or delete a line on the screen
or insert characters pushing them to the right.
I havent done this because we have only 2 such terminals
both of which are hard-wired at 9600 baud (and private terminals).
The changes needed to do this are almost all localized in the routine
"ex_vadjust.c".


					Bill Joy
					CS Division
					Department of EE and CS
					UC Berkeley
					Berkeley, California 94704

					(415) 524-4510		[HOME]
					(415) 642-4948		[SCHOOL]
