.HI 1
.ce
UNIX INTRODUCTION - Amendments
.ce
Edited by R.P.A. Collinson
.ce
Document No: DOC/UNIX.K0/1A
.sp 5
.ce
Contents
.in +20
.SC 1 Introduction
.SC 2 "The New Teletype Driver"
.SC 3 "The New Shell program"
.SC 4 "Manual Pages for New Teletype Driver"
.br
em(I), stty(I),  gtty(II), stty(II), terms(II), tty(IV)
.SC 5 "Manual Pages for New Shell"
.br
chdir(I), newbin(I), next(I), set(I), sh(I), wait(I)
.in -20
.SH 1 "Introduction"
.NF
.PG
This document gives revisions to existing UNIX documentation, and
has been produced to coincide with two major changes to the UNIX system.
.PG
These changes are:
.br
1)	A new teletype driver has been installed. This does not look very different from
the original handler, it provides a few more facilities to the terminal user and a better interface for
programs.
.sp
2)	A new shell program has been installed.
.PG
The next two sections of the document describe the changes in more detail, followed by amendments for the UNIX 
documentation.
.SH 2 "The New Teletype Driver"
.PG
The driver is a completely new piece of software, and has the following control characters(^G means control G):-
.sp
.ul
Unchanged_Control_Characters
.sp
.in+10
.ti-10
^G	Break.
.ti-10
^D	End of text.
.ti-10
^Z	Stop output temporarily, any character will restart it.
.ti-10
^-shift-\\	Cause a quit - and a core dump.
.sp
.ti-10
.ul
Altered_Control_Characters
.sp
.ti-10
delete	deletes the last character, the character # now has no significance. The
deleted character(s) will be echoed within square brackets.
.ti-10
^U	deletes the line (the character @ now has no significance). A line feed will be echoed.
.ti-10
^A	Escape (echoes as \\). This replaces the use of back-slash as an escape.
.sp
.in-10
Both delete and ^U may be altered by the use of stty(I).
.sp
.ul
Extra_facilities
.sp
.in+10
.ti -10
^R	Re-echo the current line, this is useful if there is a lot of deleting on the line and 
you want to see what is being sent to the program.
.ti-10
^W	Erase the last word, where a word is defined as a string of alphanumeric characters.
If the last character on the line was not alphanumeric, ^W deletes one character. Note that the
use of ^W here will involve a change to the 'open' command in em(I).
.ti-10
^O	delete further output until another ^O is typed or the process attempts
to read from the terminal.
.in-10
.sp
.ul
stty
.PG
stty(I) is revised to deal with the new driver and has some new parameters - see the
documentation.
.sp
.ul
Control_Characters
.sp
The echoing of control characters is controlled by a parameter to stty, all control characters are
echoed on input and printed on output when the correct parameter to stty is set.
.sp
.ul
Paging
.PG
A terminal whose page length is
set to non-zero will be sent output in pages.
That is, if the page length is n, when a process has sent
n lines of text to the terminal it will wait until the user
responds before transmitting any more output.
.PG
If the user responds with <newline> 
it will transmit
one more line; for any other response a complete new page
will be transmitted.
The character typed is otherwise
ignored (i.e.  it is not interpreted as special or
placed in the input buffer, or echoed).
.PG
Each time a process reads from the terminal the
"position in the page" is reset to the start of a page.
Thus the user will only be aware of paging when
a process is transmitting a long sequence of output to the terminal.
.sp
.ul
Line_width
.PG
If the output to a terminal overflows the end of the line
some terminals will print the remainder of the text on the next
line (most VDUs) -  others will not (e.g. DECwriters).  If the
line-width is set non-zero, then when the line
overflows the system will insert a <newline> in the output.
.sp
.ul
Inset
.PG
The inset feature on the dec-writer is not supported by this teletype driver, it may be
installed at a later date when there is more store on the system.
.sp
.ul
Delays
.PG
The driver treats delays (after a carriage return, line-feed, tab and form feed)
in a different manner from the original driver. Delays are specified in terms of 1/50th sec intervals -
see stty(I).
.sp
.ul
A_new_system_call
.PG
The system calls stty(II) and gtty(II) now call terms(II), which deals with the
new format for the teletype driver data area. In general there is no need to alter
existing programs which call stty and gtty (I hope).
.SH 3 "The New Shell"
.PG
The new shell is an upgraded version of the original shell, it
provides the following facilities.
.sp
.ul
Shell_variables
.PG
The shell has 52 text variables named a-z and A-Z available to the user. They are
referenced by $a, $b.....$Z. Initially all lower case shell variables have a null
value, upper case variables have a null value except:-
.sp
.in+10
.ti-10
$M	is the current prompt string.
.ti-10
$N	is the number of arguments to the current shell call.
.ti-10
$P	see sh(I).
.ti-10
$T	is the name of the controlling teletype (i.e tty4).
.in-10
.sp
Other upper case variables may be commandeered at a later date and users are
advised to only use lower case variables in command files.
.PG
Shell variables are set by the set(I) command, for example:
.sp
.ti+10
set a = /usr/rk1
.sp
will set the variable "a" to the string, a subsequent command:
.sp
.ti+10
ls $a
.sp
will replace the $a in the command with "/usr/rk1", giving a directory listing of /usr/rk1.
The command:
.sp
.ti+10
ls $a/fred
.sp
will give a directory listing of /usr/rk1/fred.
.PG
Variables may be given a numeric value:
.sp
.ti+10
set b = 5
.sp
incremented,
.sp
.ti+10
set b + 1
.sp
decremented,
.sp
.ti+10
set b - 5
.sp
and tested
.sp
.ti+10
if $b = 1 echo variable b = 1
.PG
Variable values are unset by saying
.sp
.ti+10
set b
.PG
The current set values for all the variables in the current shell may be printed by typing:
.sp
.ti+10
pset
.sp
.ul
chdir
.PG
chdir is performed by the shell (as before), the command name 'cd' is now synonymous with 'chdir'. 'cd'
(or chdir)
by itself will automatically return you to your home directory.
.sp
.ul
next
.PG
Previously, command files could only be executed by invoking another shell. This made it
impossible to change a directory from a command file. The command
.sp
.ti+10
next filename
.sp
is similar to
.sp
.ti+10
sh filename
.sp
except the commands are executed in the current shell.
.PG
When the shell starts, if it thinks that it is the top level it performs
.sp
.ti+10
next .profile
.sp
which can be used to set up shell variables and perform stty calls.  The current .init file
should be renamed as .profile as the .init facility will be removed from the system in the
near future.
.sp
.ul
Private_bin_directories
.PG
The most powerful feature of the new shell is the ability to deal with a private directory (called bin) of your
own commands. The directory should reside in your home directory.  When a command name is typed, the shell
looks on the current working directory, on your private bin directory, on /bin and on /usr/bin before
giving up the search for the file.  The look-up on your bin directory is performed
by hashing and the command 
.sp
.ti+10
newbin
.sp
should be typed when a file is added or removed from the private bin. 'newbin' is performed
automatically at shell start-up time and so does not need to be performed on login.
.PG
This mechanism allows the user to access private commands irrespective of the current working
directory - a vast improvement on the old shell where long pathnames had to be typed.
.SH 4 "Manual pages for the teletype driver"
.PG
This section gives the revised manual pages which correspond to the new driver.
The pages are:-
.sp 2
.ul
Section_I
.sp
.in+10
.ti-10
em	the QMC editor - alterations to the open command
.br
.ti-10
stty	set terminal characteristics - a completely new program
.in-10
.sp2
.ul
Section_II
.sp2
.in+10
.ti-10
gtty	get terminal characteristics - re-written system call
.ti-10
stty	set terminal characteristics - re-written system call
.ti-10
terms	set and get terminal mode - a new system call
.in-10
.sp 2
.ul
Section_IV
.in+10
.ti-10
tty	a description of the new tty driver
.in-10
.SH 5 "Manual pages for the New shell"
.PG
This section contains all the manual pages pertaining to the new shell.
The pages are all UNIX commands, and are:-
.in+10
.sp
.ti-10
chdir	change working directory
.ti-10
newbin	update internal shell tables for private bin directory
.ti-10
next	execute a command file in current shell
.ti-10
set	set shell variables
.ti-10
sh	the shell itself
.ti-10
wait	wait for process completion
