0% found this document useful (0 votes)
46 views292 pages

UNIX

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views292 pages

UNIX

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIX PROGRAMMER’S MANUAL

Third Edition

K. Thompson

D. M. Ritchie

February, 1973

Copyright 8c9 1972


Bell Telephone Laboratories, Inc.

No part of this document may be reproduced,


or distributed outside the Laboratories, without
the written permission of Bell Telephone Laboratories.
PREFACE
to the Third Edition

In the months since the last appearance of this manual, many


changes have occurred both in the system itself and in the
way it is used.

Perhaps most obviously, there have been additions, dele-


tions, and modifications to the system and its software. It
is these changes, of course, that caused the appearance of
this revised manual.

Second, the number of people spending an appreciable amount


of time writing UNIX software has increased. Credit is due
to L. L. Cherry, M. D. McIlroy, L. E. McMahon, R. Morris,
J. F. Ossanna, and E. N. Pinson for their contributions.

Finally, the number of UNIX installations has grown to 16,


with more expected. None of these has exactly the same com-
plement of hardware or software. Therefore, at any particu-
lar installation, it is quite possible that this manual will
give inappropriate information.

In particular, _ a_n_
y _s_y_
s_t_
e_m _w_
h_i_
c_h _u_
s_e_
s _a _P_D_
P_-_
1_1_
/_2_
0 _p_r_
o_c_
e_s_
s_o_
r
w_
_ i_
l_l _
n_o_
t _i_n_
c_l_
u_d_
e _a_l_
l _t_h_
e _s_o_
f_t_
w_a_
r_e _d_
e_s_
c_r_
i_b_
e_d _h_
e_r_
e_i_
n_, _n_
o_r _w_
i_l_
l
t_
_ h_
e _s_
o_f_
t_w_
a_r_
e _b_e_
h_a_
v_e _t_
h_e _s_
a_m_
e _w_a_
y_. The second, or even the
first, edition of this manual is likely to be more appropri-
ate.

Besides additions, deletions, and modifications to the


writeups in each section, this manual differs from its pre-
decessors in two ways: all the commands used for system
maintenance and not intended for normal users have been
moved to a new section VIII; and there is a new "How to Get
Started" chapter that gives some elementary facts and many
pointers to other sections.

- ii -
INTRODUCTION TO THIS MANUAL

This manual gives descriptions of the publicly available


features of UNIX. It provides neither a general overview
(see "The UNIX Time-sharing System" for that) nor details of
the implementation of the system (which remain to be dis-
closed).

Within the area it surveys, this manual attempts to be as


complete and timely as possible. A conscious decision was
made to describe each program in exactly the state it was in
at the time its manual section was prepared. In particular,
the desire to describe something as it should be, not as it
is, was resisted. Inevitably, this means that many sections
will soon be out of date. (The rate of change of the system
is so great that a dismayingly large number of early sec-
tions had to be modified while the rest were being written.
The unbounded effort required to stay up-to-date is best
indicated by the fact that several of the programs described
were written specifically to aid in preparation of this man-
ual!)

This manual is divided into eight sections:

I. Commands
II. System calls
III. Subroutines
IV. Special files
V. File formats
VI. User-maintained programs
VII. Miscellaneous
VIII. Maintenance

Commands are programs intended to be invoked directly by the


user, in contradistinction to subroutines, which are
intended to be called by the user’s programs. Commands gen-
erally reside in directory /
_b_i
_n_ (for b
_i_n
_ary programs). This
directory is searched automatically by the command line
interpreter. Some programs classified as commands are
located elsewhere; this fact is indicated in the appropriate
sections.

System calls are entries into the UNIX supervisor. In


assembly language, they are coded with the use of the opcode
"sys", a synonym for the t
_r_a
_p_ instruction.

A small assortment of subroutines is available; they are


described in section III. The binary form of most of them
is kept in the system library /usr/lib/liba.a.

- iii -
The special files section IV discusses the characteristics
of each system "file" which actually refers to an I/O
device. Unlike previous editions, the names in this section
refer to the DEC device names for the hardware, instead of
the neames of the special files themselves.

The file formats section V documents the structure of par-


ticular kinds of files; for example, the form of the output
of the loader and assembler is given. Excluded are files
used by only one command, for example the assembler’s inter-
mediate files.

User-maintained programs (section VI) are not considered


part of the UNIX system, and the principal reason for list-
ing them is to indicate their existence without necessarily
giving a complete description. The author should be con-
sulted for information.

The miscellaneous section (VII) gathers odds and ends.

Section VIII discusses commands which are not intended for


use by the ordinary user, in some cases because they dis-
close information in which he is presumably not interested,
and in others because they perform privileged functions.

Each section consists of a number of independent entries of


a page or so each. The name of the entry is in the upper
corners of its pages, its preparation date in the upper mid-
dle. Entries within each section are alphabetized. The
page numbers of each entry start at 1. (The earlier hope
for frequent, partial updates of the manual is clearly in
vain, but in any event it is not feasible to maintain con-
secutive page numbering in a document like this.)

All entries have a common format.

The n
_a_m
_e_ section repeats the entry name and gives a
very short description of its purpose.

The s
_y_n
_o_p
_s_i
_s_ summarizes the use of the program being
described. A few conventions are used, particularly in
the Commands section:

Underlined words are considered literals, and are


typed just as they appear.

Square brackets ([]) around an argument indicate


that the argument is optional. When an argument is
given as "name", it always refers to a file name.

Ellipses "..." are used to show that the previous


argument-prototype may be repeated.

- iv -
A final convention is used by the commands them-
selves. An argument beginning with a minus sign "-"
is often taken to mean some sort of flag argument
even if it appears in a position where a file name
could appear. Therefore, it is unwise to have files
whose names begin with "-".

The d
_e_s
_c_r
_i_p
_t_i
_o_n
_ section discusses in detail the subject
at hand.

The f
_i_l
_e_s
_ section gives the names of files which are
built into the program.

A s
_e_e
_ a
_l_s
_o_ section gives pointers to related informa-
tion.

A d
_i_a
_g_n
_o_s
_t_i
_c_s
_ section discusses the diagnostics that
may be produced. This section tends to be as terse as
the diagnostics themselves.

The b
_u_g
_s_ section gives known bugs and sometimes defi-
ciencies. Occasionally also the suggested fix is
described.

Previous edition of this manual had an o


_w_n
_e_r
_ section, which
has been dropped from this edition because the "owners" of
many routines became fairly hard to pin down. The major
contributors to UNIX, (cast in order of appearance) together
with their login names and most notable contributions, are

ken K. Thompson (UNIX, many commands)


dmr D. M. Ritchie (many commands, as, ld, C)
jfo J. F. Ossanna (roff, nroff)
doug M. D. McIlroy (tmg, m6)
rhm R. Morris (dc, much of library)
lem L. E. McMahon (cref)
llc L. L. Cherry (form, fed, salloc)
csr C. S. Roberts (tss)
enp E. N. Pinson (proof)

At the beginning of this document is a table of contents,


organized by section and alphabetically within each section.
There is also a permuted index derived from the table of
contents. Within each index entry, the title of the writeup
to which it refers is followed by the appropriate section
number in parentheses. This fact is important because there
is considerable name duplication among the sections, arising
principally from commands which exist only to exercise a
particular system call.

This manual was prepared using the UNIX text editor e


_d_ and
the formatting program r
_o_f
_f_.

- v -
The assistance of R. Morris is gratefully acknowledged.

- vi -
HOW TO GET STARTED

This section provides the basic information you need to get


started on UNIX: how to log in and log out, how to communi-
cate through your terminal, and how to run a program.

L_
_ o_
g_g_
i_n_
g _
i_n

You must call UNIX from an appropriate terminal. UNIX sup-


ports ASCII terminals typified by the TTY 37, the GE Ter-
minet 300, the Memorex 1240, and various graphical terminals
on the one hand, and IBM 2741-type terminals on the other.

To use UNIX, you must have a valid UNIX user name, which may
be obtained, together with the telephone number, from the
system administrators.

The same telephone number serves terminals operating at all


the standard speeds. After a data connection is estab-
lished, the login procedure depends on what kind of terminal
you are using.

T_
_ T_
Y _
3_7 _
t_e_
r_m_
i_n_
a_l

UNIX will type out "login: "; you respond with your
user name. From the TTY 37 terminal, and any other
which has the "new-line" function (combined carriage
return and linefeed), terminate each line you type with
the "new line" key (n
_o_t
_ the "return" key).

3_
_ 0_
0_-_
b_a_
u_d _
t_e_
r_m_
i_n_
a_l_
s

Such terminals include the GE Terminet 300, most dis-


play terminals, Execuport, TI, and certain Anderson-
Jacobson terminals. These terminals generally have a
speed switch which should be set at "300" (or "30" for
30 characters per second) and a half/full duplex switch
which should be set at full-duplex. (Note that this
switch will often have to be changed since MH-TSS
requires half-duplex). When a connection with UNIX is
established, a few garbage characters are typed (the
login message at the wrong speed). Depress the "break"
key; this is a speed-independent signal to UNIX that a
300-baud terminal is in use. UNIX will type "login: "
at the correct speed; you type your user name, followed
by the "return" key. Henceforth, the "return", "new
line", or "linefeed" keys will give exactly the same
results. Each line must be terminated with one of
these keys; no one is listening to you until the return
is received.

- vii -
S_
_ e_
l_e_
c_t_
r_i_
c _
t_e_
r_m_
i_n_
a_l_
s

From an IBM 2741 or the Anderson-Jacobson Selectric


terminal, no message will appear. After the data con-
nection is established, press the "return" key. UNIX
should type "login: " as described above. If the
greeting does not appear after a few seconds, unlock
the keyboard by switching the terminal to local and
back to remote, and type "return". If necessary, hang
up and try again; something has gone wrong.

For all these terminals, it is important that you type your


name in lower case if possible; if you type upper case let-
ters, UNIX will assume that your terminal cannot generate
lower-case letters and will translate all subsequent upper-
case letters to lower case.

The evidence that you have successfully logged in is that a


UNIX program, the Shell, will type a "%" to you. (The Shell
is described below under "How to run a program".

For more information, consult getty(VII), which discusses


the login sequence in more detail, and dc(IV), which dis-
cusses typewriter I/O.

L_
_ o_
g_g_
i_n_
g _
o_u_
t

There are three ways to log out:

You can simply hang up the phone. Hanging up is safe


if you are at command level, that is, if the Shell has
just typed its prompt signal "%". It is also safe if
you are in interactive system programs, for example the
editor. It is unsafe if you are executing a non-inter-
active program, or one of your own programs, which
either does not read the typewriter or ignores the end-
of-file indications which will result from hanging up.
The reason is that UNIX, unlike most systems, does not
terminate a program simply because it has been hung-up
upon.

You can log out by typing an end-of-file indication


(EOT character, control "d") to the Shell. The Shell
will terminate and the "login: " message will appear
again.

You can also log in directly as another user by giving


a login command (login (I)).

H_
_ o_
w _
t_o _
c_o_
m_m_
u_n_
i_c_
a_t_
e _
t_h_
r_o_
u_g_
h _
y_o_
u_r _
t_e_
r_m_
i_n_
a_l

When you type to UNIX, a gnome deep in the system is gather-


ing your characters and saving them in a secret place. The

- viii -
characters will not be given to a program until you type a
return, as described above in _
L_o_
g_g_
i_n_
g _
i_n_
.

UNIX typewriter I/O is full-duplex (except for Selectric


terminals). It has full read-ahead, which means that you
can type at any time, even while a program is typing at you.
Of course, if you type during output, the output will have
the input characters interspersed. However, whatever you
type will be saved up and interpreted in correct sequence.

There is a limit to the amount of read-ahead, but it is gen-


erous and not likely to be exceeded unless the system is in
trouble. When the read-ahead limit is exceeded, the system
stops echoing input characters, and starts echoing "#" no
matter what you typed. The last character which was echoed
correctly will be received correctly by the program to which
you were talking; subsequent characters have been thrown
away.

On a typewriter input line, the character "@" kills all the


characters typed before it, so typing mistakes can be
repaired on a single line. Also, the character "#" erases
the last character typed. Successive uses of "#" erase
characters back to, but not beyond, the beginning of the
line. "@" and "#" can be transmitted to a program by pre-
ceding them with "\". (So, to erase "\", you need two
"#"s).

The ASCII "delete" (a.k.a. "rubout") character is not passed


to programs but instead generates an _
i_n_
t_e_
r_r_
u_p_
t _
s_i_
g_n_
a_l_
. This
signal generally causes whatever program you are running to
terminate. It is typically used to stop a long printout
that you don’t want. However, programs can arrange either
to ignore this signal altogether, or to be notified when it
happens (instead of being terminated). The editor, for
example, catches interrupts and stops what it is doing,
instead of terminating, so that an interrupt can be used to
halt an editor printout without losing the file being
edited.

The q
_u_i
_t_ signal is generated by typing the ASCII FS charac-
ter. It not only causes a running program to terminate but
also generates a file with the core image of the terminated
process. Quit is useful for debugging.

Besides adapting to the speed of the terminal, UNIX tries to


be intelligent about whether you have a terminal with the
"new line" function or whether it must be simulated with
carriage-return and line-feed. In the latter case, all
input carriage returns are turned to new-line characters
(the standard line delimiter) and both a carriage return and
a line feed are echoed to the terminal. If you get into the
wrong mode, the stty command (I) will rescue you.

- ix -
Tab characters are used freely in UNIX source programs. If
your terminal does not have the tab function, you can
arrange to have them turned into spaces during output, and
echoed as spaces during input. The system assumes that tabs
are set every eight columns. Again, the stty command (I)
will set or reset this mode. Also, there is a file which,
if printed on TTY 37 or TermiNet 300 terminals, will set the
tab stops correctly (tabs(VII)).

Section dc(IV) discusses typewriter I/O more fully. Section


kl(IV) discusses the console typewriter.

H_
_ o_
w _
t_o _
r_u_
n _
a _
p_r_
o_g_
r_a_
m_; _
T_h_
e _
S_h_
e_l_
l

When you have successfully logged into UNIX, a program


called the Shell is listening to your terminal. The Shell
reads typed-in lines, splits them up into a command name and
arguments, and executes the command. A command is simply an
executable program. The Shell looks first in your current
directory (see next section) for a program with the given
name, and if none is there, then in a system directory.
There is nothing special about system-provided commands
except that they are kept in a directory where the Shell can
find them.

The command name is always the first word on an input line;


it and its arguments are separated from one another by spa-
ces.

When a program terminates, the Shell will ordinarily regain


control and type a "%" at you to indicate that it is ready
for another command.

The Shell has many other capabilities, which are described


in detail in section sh(I).

T_
_ h_
e _
c_u_
r_r_
e_n_
t _
d_i_
r_e_
c_t_
o_r_
y

UNIX has a file system arranged in a hierarchy of directo-


ries. When the system administrator gave you a user name,
he also created a directory for you (ordinarily with the
same name as your user name). When you log in, any file
name you type is by default in this directory. Since you
are the owner of this directory, you have full permissions
to read, write, alter, or destroy its contents. Permissions
to have your will with other directories and files will have
been granted or denied to you by their owners. As a matter
of observed fact, few UNIX users protect their files from
destruction, let alone perusal, by other users.

To change the current directory (but not the set of permis-


sions you were endowed with at login) use chdir(I).

- x -
P_
_ a_
t_h _
n_a_
m_e_
s

To reference files not in the current directory, you must


use a path name.

Full path names begin with "/", the name of the root direc-
tory of the whole file system. After the slash comes the
name of each directory containing the next sub-directory
(followed by a "/") until finally the file name is reached.
E.g.: "/usr/lem/filex" refers to file "filex" in directory
"lem"; "lem" is itself a sub-directory of "usr"; "usr"
springs directly from the root directory.

If your current directory has subdirectories, the path names


of files therein begin with the name of the subdirectory (no
prefixed "/").

Without important exception, a path name may be used any-


where a file name is required.

Important commands which modify the contents of files are


cp(I), mv(I), and rm(I), which respectively copy, move (i.e.
rename) and remove files. To find out the status of files
or directories, use ls(I) and stat(I). See mkdir(I) for
making directories; rmdir(I) for destroying them.

For a fuller discussion of the file system, see


MM-71-1273-4. It may also be useful to glance through sec-
tion II of this manual, which discusses system calls, even
if you don’t intend to deal with the system at the assembly-
language level.

W_
_ r_
i_t_
i_n_
g _
a _
p_r_
o_g_
r_a_
m

To enter the text of a source program into a UNIX file, use


ed(I). The three principal languages in UNIX are assembly
language (see as(I)), Fortran (see fc(I)), and C (see
cc(I)). After the program text has been entered through the
editor and written on a file, you can give the file to the
appropriate language processor as an argument. The output
of the language processor will be left on a file in the cur-
rent directory named "[Link]". (If the output is precious,
use mv to move it to a less exposed name soon.) If you
wrote in assembly language, you will probably need to load
the program with library subroutines; see ld(I). The other
two language processors call the loader automatically.

When you have finally gone through this entire process with-
out provoking any diagnostics, the resulting program can be
run by giving its name to the Shell in response to the "%"
prompt.

The next command you will need is db(I). As a debugger, db

- xi -
is better than average for assembly-language programs,
marginally useful for C programs (when completed, cdb(I)
will be a boon), and virtually useless for Fortran.

Your programs can receive arguments from the command line


just as system programs do. For assembly language programs,
see exec(II).

T_
_ e_
x_t _
p_r_
o_c_
e_s_
s_i_
n_g

Almost all text is entered through the editor. The commands


most often used to write text on a terminal are: cat(I),
pr(I), roff(I), or nroff(I).

The cat command simply dumps ASCII text on the terminal,


with no processing at all. The pr command paginates the
text and supplies headings. The nroff command is an elabo-
rate text formatting program, and requires careful fore-
thought in entering both the text and the formatting com-
mands into the input file. The roff command is a somewhat
less elaborate formatting program, and requires somewhat
less forethought.

S_
_ u_
r_p_
r_i_
s_e_
s

Certain commands provide inter-user communication. Even if


you do not plan to use them, it would be well to learn some-
thing about them, because someone else may aim them at you.

To communicate with another user currently logged in,


write(I) is used. To leave a message the presence of which
will be announced to another user when he next logs in,
mail(I) is used. The write-ups in the manual also suggest
how to respond to the two commands if you are a target.

When you log in, a message-of-the-day may greet you before


the first "%".

- xii -
TABLE OF CONTENTS

I. COMMANDS

: ............................ place label


ar ........................... archive (combine) files
as ........................... assembler
bas .......................... BASIC dialect
cat .......................... concatenate (or print) files
cc ........................... compile C program
cdb .......................... C debugger
chdir ........................ change working directory
chmod ........................ change access mode of files
chown ........................ change owner of files
cmp .......................... compare file contents
cp ........................... copy file
cref ......................... cross reference table
crypt ........................ encrypt, decrypt a file
date ......................... get date and time of day
db ........................... symbolic debugger
dc ........................... desk calculator
df ........................... find free disk space
dsw .......................... delete files interactively
du ........................... find disk usage
echo ......................... print command arguments
ed ........................... text editor
exit ......................... end command sequence
factor ....................... factor a number
fc ........................... compile Fortran program
fed .......................... form letter editor
form ......................... generate form letter
forml ........................ generate form letters
goto ......................... command transfer
hyphen ....................... find hyphenated words
if ........................... conditional command
ld ........................... link editor (loader)
ln ........................... link to file
login ........................ log on to system
ls ........................... list contents of directory
m6 ........................... macroprocessor
mail ......................... send mail to another user
man .......................... run off manual section
mesg ......................... permit or deny messages
mkdir ........................ create directory
mt ........................... save, restore files on magtape
mv ........................... move or rename file
nm ........................... print namelist
nroff ........................ format text for printing
od ........................... octal dump of file
opr .......................... print file off-line
ov ........................... page overlay file print
passwd ....................... set login password

- xiii -
pr ........................... print file with headings
proof ........................ compare text files
reloc ........................ relocate object files
rew .......................... rewind DECtape
rm ........................... remove (delete) file
rmdir ........................ remove (delete) directory
roff ......................... format text for printing
sh ........................... command interpreter
size ......................... get executable program size
sno .......................... compile Snobol program
sort ......................... sort ASCII file
speak ........................ send words to voice synthesizer
split ........................ break a file into pieces
stat ......................... get file status
strip ........................ remove symbols, relocation bits
stty ......................... set typewriter modes
sum .......................... sum file
tap .......................... save, restore files on DECtape
time ......................... get time information
tmg .......................... compile tmgl program
tss .......................... communicate with MH-TSS (GCOS)
tty .......................... find name of terminal
type ......................... print file page-by-page
typo ......................... find typographic errors
un ........................... find undefined symbols
uniq ......................... find duplicate lines in a file
vs ........................... generate voice synthesizer phonemes
wc ........................... get (English) word count
who .......................... who is on the system
write ........................ write to another user

II. SYSTEM CALLS

boot ......................... reboot the system


break ........................ set program break
cemt ......................... catch EMT traps
chdir ........................ change working directory
chmod ........................ change mode of file
chown ........................ change owner of file
close ........................ close open file
creat ........................ create file
csw .......................... read the console switches
dup .......................... duplicate an open file
exec ......................... execute program file
exit ......................... terminate execution
fork ......................... create new process
fpe .......................... catch floating exception errors
fstat ........................ status of open file
getuid ....................... get user ID
gtty ......................... get typewriter mode
ilgins ....................... catch illegal instruction trap
intr ......................... catch or inhibit interrupts

- xiv -
kill ......................... destroy process
link ......................... link to file
makdir ....................... create directory
mdate ........................ set date modified of file
mount ........................ mount file system
nice ......................... set low-priority status
open ......................... open file
pipe ......................... open inter process channel
quit ......................... inhibit quits
read ......................... read file
rele ......................... release processor
seek ......................... move read or write pointer
setuid ....................... set user ID
sleep ........................ delay execution
stat ......................... get file status
stime ........................ set system time
stty ......................... set mode of typewriter
sync ......................... assure synchronization
time ......................... get time of year
times ........................ get execution times
umount ....................... dismount file system
unlink ....................... remove (delete) file
wait ......................... wait for process
write ........................ write file

III. SUBROUTINES

atan ......................... arctangent


atof ......................... convert ASCII to floating
atoi ......................... convert ASCII to integer
compar ....................... string compare for sort
crypt ........................ encrypt according to a keyword
ctime ........................ convert time to ASCII
ddsput ....................... display character on Picturephone
ecvt ......................... edited output conversion
exp .......................... exponential function
ftoa ......................... convert floating to ASCII
ftoo ......................... convert floating to octal
gerts ........................ communicate with GCOS
getc ......................... get character
hypot ........................ compute hypotenuse
itoa ......................... convert integer to ASCII
log .......................... logarithm base e
mesg ......................... print string on typewriter
nlist ........................ read name list
pow .......................... take powers of numbers
ptime ........................ print time
putc ......................... write character or word
qsort ........................ quicker sort
rand ......................... pseudo random number generator
salloc ....................... storage allocator
sin .......................... sine, cosine

- xv -
sqrt ......................... square root
switch ....................... transfer depending on value
ttyn ......................... find teletype name

IV. SPECIAL FILES

dc ........................... remote typewriter


dn ........................... 801 ACU
dp ........................... 201 Dataphone
kl ........................... console typewriter
mem .......................... core memory
pc ........................... punched paper tape
rf ........................... RF disk
rk ........................... RK disk
tc ........................... DECtape
tm............................ 9-track magtape
vt ........................... storage-tube display

V. FILE FORMATS

[Link] ........................ assembler and loader output


archive ...................... archive file
core ......................... core image file
directory .................... directory format
file system .................. file system format
passwd ....................... password file
tap .......................... DECtape and magtape format
utmp ......................... logged-in user information
wtmp ......................... accounting files

VI. USER MAINTAINED PROGRAMS

bc ........................... compile B program


bj ........................... blackjack
ptx .......................... permuted index
yacc ......................... yet another compiler-compiler

VII. MISCELLANEOUS

ascii ........................ map of ASCII


dpd .......................... spawn dataphone daemon
getty ........................ adapt to typewriter
glob ......................... argument expander
greek ........................ extended TTY 37 typebox map
init ......................... initializer process
msh .......................... mini Shell
tabs ......................... set tab stops on typewriter
vsp .......................... voice synthesizer phonemes

- xvi -
VIII. SYSTEM MAINTAINANCE

20boot ....................... reboot 11/20 system


acct ......................... get connect-time accounting
bproc ........................ boot procedure
check ........................ check consistency of file system
chk .......................... check all file systems
clri ......................... clear file’s i-node
dcheck ....................... verify directory hierarchy
dli .......................... load DEC binary paper tapes
istat ........................ file status by i-number
kill ......................... terminate a process
mount ........................ mount removable file system
ps ........................... get process status
salv ......................... repair damaged file system
su ........................... become super-user
swtmp ........................ truncate accounting files
tm ........................... get system time information
umount ....................... dismount removable file system

- xvii -
INDEX

20boot(VIII): reboot 11/20 system


dp(IV): 201 Dataphone
20boot(VIII): reboot 11/20 system
greek(VII): extended TTY 37 typebox map
dn(IV): 801 ACU
tm 9-track magtape
:(I): place label
[Link](V): assembler and loader output
chmod(I): change access mode of files
crypt(III): encrypt according to a keyword
wtmp(V): accounting files
acct(VIII): get connect-time accounting
acct(VIII): get connect-time accounting
dn(IV): 801 ACU
getty(VII): adapt to typewriter
chk(VIII): check all file systems
salloc(III): storage allocator
dup(II): duplicate an open file
yacc(VI): yet another compiler-compiler
mail(I): send mail to another user
write(I): write to another user
ar(I): archive (combine) files
archive(V): archive file
archive(V): archive file
atan(III): arctangent
glob(VII): argument expander
echo(I): print command arguments
ar(I): archive (combine) files
sort(I): sort ASCII file
atof(III): convert ASCII to floating
atoi(III): convert ASCII to integer
ascii(VII): map of ASCII
ascii(VII): map of ASCII
ctime(III): convert time to ASCII
convert floating to ASCII...ftoa(III):
itoa(III): convert integer to ASCII
as(I): assembler
[Link](V): assembler and loader output
as(I): assembler
sync(II): assure synchronization
atan(III): arctangent
atof(III): convert ASCII to floating
atoi(III): convert ASCII to integer
bc(VI): compile B program
log(III): logarithm base e
bas(I): BASIC dialect
bas(I): BASIC dialect
bc(VI): compile B program
dli(VIII): load DEC binary paper tapes

- xviii -
remove symbols, relocation bits...strip(I):
bj(VI): blackjack
bj(VI): blackjack
bproc(VIII): boot procedure
boot(II): reboot the system
bproc(VIII): boot procedure
split(I): break a file into pieces
break(II): set program break
break(II): set program break
istat(VIII): file status by i-number
cdb(I): C debugger
cc(I): compile C program
dc(I): desk calculator
cemt(II): catch EMT traps
fpe(II): catch floating exception errors
ilgins(II): catch illegal instruction trap
intr(II): catch or inhibit interrupts
cat(I): concatenate (or print) files
cc(I): compile C program
cdb(I): C debugger
cemt(II): catch EMT traps
chmod(I): change access mode of files
chmod(II): change mode of file
chown(I): change owner of files
chown(II): change owner of file
chdir(I): change working directory
chdir(II): change working directory
pipe(II): open inter process channel
ddsput(III): display character on Picturephone
putc(III): write character or word
getc(III): get character
chdir(I): change working directory
chdir(II): change working directory
chk(VIII): check all file systems
check(VIII): check consistency of file system
system... check(VIII): check consistency of file
chk(VIII): check all file systems
chmod(I): change access mode of files
chmod(II): change mode of file
chown(I): change owner of files
chown(II): change owner of file
clri(VIII): clear file’s i-node
close(II): close open file
close(II): close open file
clri(VIII): clear file’s i-node
cmp(I): compare file contents
ar(I): archive (combine) files
echo(I): print command arguments
sh(I): command interpreter
exit(I): end command sequence
goto(I): command transfer
if(I): conditional command
gerts(III): communicate with GCOS

- xix -
tss(I): communicate with MH-TSS (GCOS)
cmp(I): compare file contents
compar(III): string compare for sort
proof(I): compare text files
compar(III): string compare for sort
bc(VI): compile B program
cc(I): compile C program
fc(I): compile Fortran program
sno(I): compile Snobol program
tmg(I): compile tmgl program
yacc(VI): yet another compiler-compiler
hypot(III): compute hypotenuse
cat(I): concatenate (or print) files
if(I): conditional command
acct(VIII): get connect-time accounting
check(VIII): check consistency of file system
csw(II): read the console switches
kl(IV): console typewriter
ls(I): list contents of directory
cmp(I): compare file contents
ecvt(III): edited output conversion
atof(III): convert ASCII to floating
atoi(III): convert ASCII to integer
ftoa(III): convert floating to ASCII
ftoo(III): convert floating to octal
itoa(III): convert integer to ASCII
ctime(III): convert time to ASCII
cp(I): copy file
core(V): core image file
mem(IV): core memory
core(V): core image file
sin(III): sine, cosine
wc(I): get (English) word count
cp(I): copy file
makdir(II): create directory
mkdir(I): create directory
creat(II): create file
fork(II): create new process
creat(II): create file
cref(I): cross reference table
cref(I): cross reference table
crypt(I): encrypt, decrypt a file
crypt(III): encrypt according to a keyword
csw(II): read the console switches
ctime(III): convert time to ASCII
dpd(VII): spawn dataphone daemon
salv(VIII): repair damaged file system
dpd(VII): spawn dataphone daemon
dp(IV): 201 Dataphone
date(I): get date and time of day
mdate(II): set date modified of file
date(I): get date and time of day
date(I): get date and time of day

- xx -
db(I): symbolic debugger
dcheck(VIII): verify directory hierarchy
dc(I): desk calculator
dc(IV): remote typewriter
Picturephone... ddsput(III): display character on
cdb(I): C debugger
db(I): symbolic debugger
dli(VIII): load DEC binary paper tapes
crypt(I): encrypt, decrypt a file
tap(V): DECtape and magtape format
rew(I): rewind DECtape
save, restore files on DECtape...tap(I):
tc(IV): DECtape
sleep(II): delay execution
dsw(I): delete files interactively
rmdir(I): remove (delete) directory
rm(I): remove (delete) file
unlink(II): remove (delete) file
mesg(I): permit or deny messages
switch(III): transfer depending on value
dc(I): desk calculator
kill(II): destroy process
df(I): find free disk space
bas(I): BASIC dialect
directory(V): directory format
dcheck(VIII): verify directory hierarchy
directory(V): directory format
chdir(I): change working directory
chdir(II): change working directory
ls(I): list contents of directory
makdir(II): create directory
mkdir(I): create directory
rmdir(I): remove (delete) directory
df(I): find free disk space
du(I): find disk usage
rf(IV): RF disk
rk(IV): RK disk
umount(II): dismount file system
ddsput(III): display character on Picturephone
vt(IV): storage-tube display
dli(VIII): load DEC binary paper tapes
dn(IV): 801 ACU
dpd(VII): spawn dataphone daemon
dp(IV): 201 Dataphone
dsw(I): delete files interactively
du(I): find disk usage
od(I): octal dump of file
dup(II): duplicate an open file
dup(II): duplicate an open file
uniq(I): find duplicate lines in a file
echo(I): print command arguments
ecvt(III): edited output conversion
ed(I): text editor

- xxi -
ecvt(III): edited output conversion
ld(I): link editor (loader)
ed(I): text editor
fed(I): form letter editor
cemt(II): catch EMT traps
crypt(III): encrypt according to a keyword
crypt(I): encrypt, decrypt a file
exit(I): end command sequence
wc(I): get (English) word count
catch floating exception errors...fpe(II):
typo(I): find typographic errors
fpe(II): catch floating exception errors
exec(II): execute program file
size(I): get executable program size
exec(II): execute program file
times(II): get execution times
exit(II): terminate execution
sleep(II): delay execution
exit(I): end command sequence
exit(II): terminate execution
glob(VII): argument expander
exp(III): exponential function
exp(III): exponential function
greek(VII): extended TTY 37 typebox map
log(III): logarithm base e
factor(I): factor a number
factor(I): factor a number
fc(I): compile Fortran program
fed(I): form letter editor
cmp(I): compare file contents
split(I): break a file into pieces
opr(I): print file off-line
type(I): print file page-by-page
ov(I): page overlay file print
istat(VIII): file status by i-number
stat(I): get file status
stat(II): get file status
file system(V): file system format
chk(VIII): check all file systems
file system(V): file system format
check consistency of file system...check(VIII):
mount(II): mount file system
mount(VIII): mount removable file system
salv(VIII): repair damaged file system
umount(II): dismount file system
pr(I): print file with headings
clri(VIII): clear file’s i-node
dsw(I): delete files interactively
tap(I): save, restore files on DECtape
mt(I): save, restore files on magtape
ar(I): archive (combine) files
concatenate (or print) files...cat(I):
change access mode of files...chmod(I):

- xxii -
chown(I): change owner of files
proof(I): compare text files
reloc(I): relocate object files
wtmp(V): accounting files
archive(V): archive file
chmod(II): change mode of file
chown(II): change owner of file
close(II): close open file
core(V): core image file
cp(I): copy file
creat(II): create file
crypt(I): encrypt, decrypt a file
dup(II): duplicate an open file
exec(II): execute program file
fstat(II): status of open file
link(II): link to file
ln(I): link to file
set date modified of file...mdate(II):
mv(I): move or rename file
od(I): octal dump of file
open(II): open file
passwd(V): password file
read(II): read file
rm(I): remove (delete) file
sort(I): sort ASCII file
sum(I): sum file
find duplicate lines in a file...uniq(I):
unlink(II): remove (delete) file
write(II): write file
du(I): find disk usage
uniq(I): find duplicate lines in a file
df(I): find free disk space
hyphen(I): find hyphenated words
tty(I): find name of terminal
ttyn(III): find teletype name
typo(I): find typographic errors
un(I): find undefined symbols
fpe(II): catch floating exception errors
ftoa(III): convert floating to ASCII
ftoo(III): convert floating to octal
atof(III): convert ASCII to floating
fork(II): create new process
fed(I): form letter editor
forml(I): generate form letters
form(I): generate form letter
nroff(I): format text for printing
roff(I): format text for printing
directory(V): directory format
file system(V): file system format
tap(V): DECtape and magtape format
form(I): generate form letter
forml(I): generate form letters
fc(I): compile Fortran program

- xxiii -
fpe(II): catch floating exception errors
df(I): find free disk space
fstat(II): status of open file
ftoa(III): convert floating to ASCII
ftoo(III): convert floating to octal
exp(III): exponential function
communicate with MH-TSS (GCOS)...tss(I):
gerts(III): communicate with GCOS
forml(I): generate form letters
form(I): generate form letter
vs(I): generate voice synthesizer phonemes
pseudo random number generator...rand(III):
gerts(III): communicate with GCOS
getc(III): get character
acct(VIII): get connect-time accounting
date(I): get date and time of day
wc(I): get (English) word count
size(I): get executable program size
times(II): get execution times
stat(I): get file status
stat(II): get file status
ps(VIII): get process status
time(I): get time information
time(II): get time of year
gtty(II): get typewriter mode
getuid(II): get user ID
getc(III): get character
getty(VII): adapt to typewriter
getuid(II): get user ID
glob(VII): argument expander
goto(I): command transfer
greek(VII): extended TTY 37 typebox map
gtty(II): get typewriter mode
pr(I): print file with headings
verify directory hierarchy...dcheck(VIII):
hyphen(I): find hyphenated words
hyphen(I): find hyphenated words
hypot(III): compute hypotenuse
hypot(III): compute hypotenuse
clri(VIII): clear file’s i-node
istat(VIII): file status by i-number
getuid(II): get user ID
setuid(II): set user ID
if(I): conditional command
ilgins(II): catch illegal instruction trap
ilgins(II): catch illegal instruction trap
core(V): core image file
uniq(I): find duplicate lines in a file
ptx(VI): permuted index
time(I): get time information
utmp(V): logged-in user information
intr(II): catch or inhibit interrupts
quit(II): inhibit quits

- xxiv -
init(VII): initializer process
init(VII): initializer process
ilgins(II): catch illegal instruction trap
itoa(III): convert integer to ASCII
atoi(III): convert ASCII to integer
pipe(II): open inter process channel
dsw(I): delete files interactively
sh(I): command interpreter
intr(II): catch or inhibit interrupts
split(I): break a file into pieces
intr(II): catch or inhibit interrupts
istat(VIII): file status by i-number
itoa(III): convert integer to ASCII
encrypt according to a keyword...crypt(III):
kill(II): destroy process
kill(VIII): terminate a process
kl(IV): console typewriter
:(I): place label
ld(I): link editor (loader)
fed(I): form letter editor
forml(I): generate form letters
form(I): generate form letter
uniq(I): find duplicate lines in a file
ld(I): link editor (loader)
link(II): link to file
ln(I): link to file
link(II): link to file
ls(I): list contents of directory
nlist(III): read name list
ln(I): link to file
dli(VIII): load DEC binary paper tapes
[Link](V): assembler and loader output
ld(I): link editor (loader)
login(I): log on to system
log(III): logarithm base e
utmp(V): logged-in user information
log(III): logarithm base e
passwd(I): set login password
login(I): log on to system
nice(II): set low-priority status
ls(I): list contents of directory
m6(I): macroprocessor
m6(I): macroprocessor
tap(V): DECtape and magtape format
mt(I): save, restore files on magtape
tm 9-track magtape
mail(I): send mail to another user
mail(I): send mail to another user
makdir(II): create directory
man(I): run off manual section
man(I): run off manual section
ascii(VII): map of ASCII
extended TTY 37 typebox map...greek(VII):

- xxv -
mdate(II): set date modified of file
mem(IV): core memory
mem(IV): core memory
mesg(I): permit or deny messages
mesg(III): print string on typewriter
mesg(I): permit or deny messages
tss(I): communicate with MH-TSS (GCOS)
msh(VII): mini Shell
mkdir(I): create directory
chmod(I): change access mode of files
chmod(II): change mode of file
stty(II): set mode of typewriter
stty(I): set typewriter modes
gtty(II): get typewriter mode
mdate(II): set date modified of file
mount(II): mount file system
mount(VIII): mount removable file system
mount(II): mount file system
mount(VIII): mount removable file system
mv(I): move or rename file
seek(II): move read or write pointer
msh(VII): mini Shell
mt(I): save, restore files on magtape
mv(I): move or rename file
nlist(III): read name list
tty(I): find name of terminal
nm(I): print namelist
ttyn(III): find teletype name
fork(II): create new process
nice(II): set low-priority status
nlist(III): read name list
nm(I): print namelist
nroff(I): format text for printing
rand(III): pseudo random number generator
pow(III): take powers of numbers
factor(I): factor a number
reloc(I): relocate object files
od(I): octal dump of file
convert floating to octal...ftoo(III):
od(I): octal dump of file
man(I): run off manual section
opr(I): print file off-line
close(II): close open file
dup(II): duplicate an open file
fstat(II): status of open file
open(II): open file
pipe(II): open inter process channel
open(II): open file
opr(I): print file off-line
cat(I): concatenate (or print) files
ecvt(III): edited output conversion
assembler and loader output...[Link](V):
ov(I): page overlay file print

- xxvi -
ov(I): page overlay file print
chown(I): change owner of files
chown(II): change owner of file
ov(I): page overlay file print
type(I): print file page-by-page
dli(VIII): load DEC binary paper tapes
pc(IV): punched paper tape
passwd(I): set login password
passwd(V): password file
passwd(V): password file
passwd(I): set login password
pc(IV): punched paper tape
mesg(I): permit or deny messages
ptx(VI): permuted index
generate voice synthesizer phonemes...vs(I):
vsp(VII): voice synthesizer phonemes
display character on Picturephone...ddsput(III):
split(I): break a file into pieces
pipe(II): open inter process channel
:(I): place label
seek(II): move read or write pointer
pow(III): take powers of numbers
pow(III): take powers of numbers
pr(I): print file with headings
echo(I): print command arguments
opr(I): print file off-line
type(I): print file page-by-page
pr(I): print file with headings
nm(I): print namelist
mesg(III): print string on typewriter
ptime(III): print time
cat(I): concatenate (or print) files
nroff(I): format text for printing
roff(I): format text for printing
ov(I): page overlay file print
bproc(VIII): boot procedure
pipe(II): open inter process channel
ps(VIII): get process status
rele(II): release processor
fork(II): create new process
init(VII): initializer process
kill(II): destroy process
kill(VIII): terminate a process
wait(II): wait for process
break(II): set program break
exec(II): execute program file
size(I): get executable program size
bc(VI): compile B program
cc(I): compile C program
fc(I): compile Fortran program
sno(I): compile Snobol program
tmg(I): compile tmgl program
proof(I): compare text files

- xxvii -
rand(III): pseudo random number generator
ps(VIII): get process status
ptime(III): print time
ptx(VI): permuted index
pc(IV): punched paper tape
putc(III): write character or word
qsort(III): quicker sort
qsort(III): quicker sort
quit(II): inhibit quits
quit(II): inhibit quits
rand(III): pseudo random number generator
rand(III): pseudo random number generator
read(II): read file
nlist(III): read name list
seek(II): move read or write pointer
csw(II): read the console switches
read(II): read file
20boot(VIII): reboot 11/20 system
boot(II): reboot the system
cref(I): cross reference table
rele(II): release processor
rele(II): release processor
reloc(I): relocate object files
strip(I): remove symbols, relocation bits
reloc(I): relocate object files
dc(IV): remote typewriter
mount(VIII): mount removable file system
rmdir(I): remove (delete) directory
rm(I): remove (delete) file
unlink(II): remove (delete) file
strip(I): remove symbols, relocation bits
mv(I): move or rename file
salv(VIII): repair damaged file system
tap(I): save, restore files on DECtape
mt(I): save, restore files on magtape
rew(I): rewind DECtape
rew(I): rewind DECtape
rf(IV): RF disk
rf(IV): RF disk
rk(IV): RK disk
rk(IV): RK disk
rmdir(I): remove (delete) directory
rm(I): remove (delete) file
roff(I): format text for printing
sqrt(III): square root
man(I): run off manual section
salloc(III): storage allocator
salv(VIII): repair damaged file system
tap(I): save, restore files on DECtape
mt(I): save, restore files on magtape
man(I): run off manual section
seek(II): move read or write pointer
mail(I): send mail to another user

- xxviii -
speak(I): send words to voice synthesizer
exit(I): end command sequence
mdate(II): set date modified of file
passwd(I): set login password
nice(II): set low-priority status
stty(II): set mode of typewriter
break(II): set program break
stime(II): set system time
tabs(VII): set tab stops on typewriter
stty(I): set typewriter modes
setuid(II): set user ID
setuid(II): set user ID
msh(VII): mini Shell
sh(I): command interpreter
sin(III): sine, cosine
sin(III): sine, cosine
size(I): get executable program size
get executable program size...size(I):
sleep(II): delay execution
sno(I): compile Snobol program
sno(I): compile Snobol program
sort(I): sort ASCII file
sort(I): sort ASCII file
string compare for sort...compar(III):
qsort(III): quicker sort
df(I): find free disk space
dpd(VII): spawn dataphone daemon
speak(I): send words to voice synthesizer
split(I): break a file into pieces
sqrt(III): square root
sqrt(III): square root
stat(I): get file status
stat(II): get file status
istat(VIII): file status by i-number
fstat(II): status of open file
nice(II): set low-priority status
ps(VIII): get process status
stat(I): get file status
stat(II): get file status
stime(II): set system time
tabs(VII): set tab stops on typewriter
salloc(III): storage allocator
vt(IV): storage-tube display
compar(III): string compare for sort
mesg(III): print string on typewriter
strip(I): remove symbols, relocation bits
stty(I): set typewriter modes
stty(II): set mode of typewriter
sum(I): sum file
sum(I): sum file
csw(II): read the console switches
switch(III): transfer depending on value
db(I): symbolic debugger

- xxix -
strip(I): remove symbols, relocation bits
un(I): find undefined symbols
sync(II): assure synchronization
sync(II): assure synchronization
vs(I): generate voice synthesizer phonemes
vsp(VII): voice synthesizer phonemes
speak(I): send words to voice synthesizer
file system(V): file system format
stime(II): set system time
chk(VIII): check all file systems
file system(V): file system format
20boot(VIII): reboot 11/20 system
boot(II): reboot the system
check consistency of file system...check(VIII):
login(I): log on to system
mount(II): mount file system
mount removable file system...mount(VIII):
repair damaged file system...salv(VIII):
umount(II): dismount file system
who(I): who is on the system
tabs(VII): set tab stops on typewriter
cref(I): cross reference table
tabs(VII): set tab stops on typewriter
pow(III): take powers of numbers
load DEC binary paper tapes...dli(VIII):
pc(IV): punched paper tape
tap(I): save, restore files on DECtape
tap(V): DECtape and magtape format
tc(IV): DECtape
ttyn(III): find teletype name
tty(I): find name of terminal
kill(VIII): terminate a process
exit(II): terminate execution
ed(I): text editor
proof(I): compare text files
nroff(I): format text for printing
roff(I): format text for printing
time(I): get time information
date(I): get date and time of day
time(II): get time of year
ctime(III): convert time to ASCII
time(I): get time information
time(II): get time of year
times(II): get execution times
times(II): get execution times
ptime(III): print time
stime(II): set system time
tm 9-track magtape
tmg(I): compile tmgl program
tmg(I): compile tmgl program
switch(III): transfer depending on value
goto(I): command transfer
cemt(II): catch EMT traps

- xxx -
catch illegal instruction trap...ilgins(II):
tss(I): communicate with MH-TSS (GCOS)
greek(VII): extended TTY 37 typebox map
tty(I): find name of terminal
ttyn(III): find teletype name
greek(VII): extended TTY 37 typebox map
type(I): print file page-by-page
stty(I): set typewriter modes
gtty(II): get typewriter mode
dc(IV): remote typewriter
getty(VII): adapt to typewriter
kl(IV): console typewriter
mesg(III): print string on typewriter
stty(II): set mode of typewriter
tabs(VII): set tab stops on typewriter
typo(I): find typographic errors
typo(I): find typographic errors
umount(II): dismount file system
un(I): find undefined symbols
un(I): find undefined symbols
uniq(I): find duplicate lines in a file
unlink(II): remove (delete) file
du(I): find disk usage
getuid(II): get user ID
setuid(II): set user ID
utmp(V): logged-in user information
mail(I): send mail to another user
write(I): write to another user
utmp(V): logged-in user information
transfer depending on value...switch(III):
dcheck(VIII): verify directory hierarchy
vs(I): generate voice synthesizer phonemes
vsp(VII): voice synthesizer phonemes
speak(I): send words to voice synthesizer
vs(I): generate voice synthesizer phonemes
vsp(VII): voice synthesizer phonemes
vt(IV): storage-tube display
wait(II): wait for process
wait(II): wait for process
wc(I): get (English) word count
who(I): who is on the system
who(I): who is on the system
gerts(III): communicate with GCOS
pr(I): print file with headings
tss(I): communicate with MH-TSS (GCOS)
wc(I): get (English) word count
speak(I): send words to voice synthesizer
hyphen(I): find hyphenated words
putc(III): write character or word
chdir(I): change working directory
chdir(II): change working directory
putc(III): write character or word
write(II): write file

- xxxi -
seek(II): move read or write pointer
write(I): write to another user
write(I): write to another user
write(II): write file
wtmp(V): accounting files
yacc(VI): yet another compiler-compiler
time(II): get time of year
yacc(VI): yet another compiler-compiler

- xxxii -
: (I) 3/15/72 : (I)

NAME : -- place a label

SYNOPSIS _ [ label ]
:

DESCRIPTION : does nothing. Its only function is to place a


_
label for the g
_o_t
_o_ command. :
_ is a command so
the Shell doesn’t have to be fixed to ignore
lines with :’s.

FILES --

SEE ALSO goto(I)

DIAGNOSTICS --

BUGS --

- 1 -
AR (I) 3/15/72 AR (I)

NAME ar -- archive

SYNOPSIS _r
a _ key afile name918 ...

DESCRIPTION ar
_ _ maintains groups of files combined into a sin-
gle archive file. Its main use is to create and
update library files as used by the loader. It
can be used, though, for any similar purpose.

ke
_ _y
_ is one character from the set d _r_t
_u_x
_, option-
ally concatenated with v _. a_f
_i_l
_e_ is the archive
file. The n _a
_m_e
_s_ are constituent files in the ar-
chive file. The meanings of the k _e
_y_ characters
are:

d means delete the named files from the archive


_
file.

r means replace the named files in the archive


_
file. If the archive file does not exist, r_ will
create it. If the named files are not in the ar-
chive file, they are appended.

t prints a table of contents of the archive file.


_
If no names are given, all files in the archive
are tabled. If names are given, only those files
are tabled.

u is similar to r
_ _ except that only those files
that have been modified are replaced. If no
names are given, all files in the archive that
have been modified will be replaced by the modi-
fied version.

x will extract the named files. If no names are


_
given, all files in the archive are extracted.
In neither case does x
_ alter the archive file.

v means verbose. Under the verbose option, a


_ _r
_
gives a file-by-file description of the making of
a new archive file from the old archive and the
constituent files. The following abbreviations
are used:

c
_ copy
_
a append
_
d delete
_
r replace
_
x extract

FILES /tmp/vtm? temporary

SEE ALSO ld(I), archive(V)

- 1 -
AR (I) 3/15/72 AR (I)

DIAGNOSTICS "Bad usage", "afile -- not in archive format",


"cannot open temp file", "name -- cannot open",
"name -- phase error", "name -- cannot create",
"no archive file", "cannot create archive file",
"name -- not found".

BUGS Option v
_t_ should be implemented as a table with
more information.

There should be a way to specify the placement of


a new file in an archive. Currently, it is
placed at the end.

"ar x" changes the modified-date of the current


directory to a random number.

- 2 -
AS (I) 1/15/73 AS (I)

NAME as -- assembler

SYNOPSIS _s
a _ [ -
_ ] name918 ...

DESCRIPTION as
_ _ assembles the concatenation of name1, .... If
the optional first argument -_ is used, all unde-
fined symbols in the assembly are treated as
global.

The output of the assembly is left on the file


"[Link]". It is executable if no errors occurred
during the assembly.

FILES /etc/as2 pass 2 of the assembler


/tmp/atm1? temporary
/tmp/atm2? temporary
/tmp/atm3? temporary
[Link] object

SEE ALSO ld(I), nm(I), un(I), db(I), [Link](V), "UNIX As-


sembler Manual".

DIAGNOSTICS When an input file cannot be read, its name fol-


lowed by a question mark is typed and assembly
ceases. When syntactic or semantic errors occur,
a single-character diagnostic is typed out to-
gether with the line number and the file name in
which it occurred. Errors in pass 1 cause can-
cellation of pass 2. The possible errors are:

) parentheses error
] parentheses error
< String not terminated properly
* Indirection ("*
_") used illegally
A error in A
_ddress
B _ranch instruction is odd or too remote
B
E error in E
_xpression
F error in local ("F_" or "b") type symbol
G _arbage (unknown) character
G
I End of file inside an I_f
_
M _ultiply defined symbol as label
M
O _dd-- word quantity assembled at odd address
O
P _hase error-- "." different in pass 1 and 2
P
R _elocation error
R
U _ndefined symbol
U
X syntaX
_ error

BUGS Symbol table overflow is not checked.

- 1 -
BAS (I) 1/15/73 BAS (I)

NAME bas -- basic

SYNOPSIS _a
b _s
_ [ file ]

DESCRIPTION ba
_ _s
_ is a dialect of basic [1]. If a file argu-
ment is provided, the file is used for input be-
fore the console is read.

_a
b _s
_ accepts lines of the form:

statement
integer statement

Integer numbered statements (known as internal


statements) are stored for later execution. They
are stored in sorted ascending order. Non-num-
bered statements are immediately executed. The
result of an immediate expression statement (that
does not have ’=’ as its highest operator) is
printed.

Statements have the following syntax:

expression
The expression is executed for its side ef-
fects (assignment or function call) or for
printing as described above.

_o
d _n
_e_
Return to system level.

_r
d _a
_w_ expression expression expression
A line is drawn on the Tektronix 611 dis-
play (/dev/vt0) from the current display
position to the XY co-ordinates specified
by the first two expressions. (The scale
is zero to one in both X and Y directions)
If the third expression is zero, the line
is invisible. The current display position
is set to the end point.

_i
d _s
_p_l
_a_y
_ list
The list of expressions and strings is con-
catenated and displayed (i.e. printed) on
the 611 starting at the current display po-
sition. The current display position is
not changed.

_r
e _a
_s_e
_
The 611 screen is erased.

fo
_ _r
_ name _
= expression expression statement
_o
f _r
_ name =
_ expression expression
_e
n _x
_t_

- 1 -
BAS (I) 1/15/73 BAS (I)

The f
_o_r
_ statement repetitively executes a
statement (first form) or a group of state-
ments (second form) under control of a
named variable. The variable takes on the
value of the first expression, then is in-
cremented by one on each loop, not to ex-
ceed the value of the second expression.

_o
g _t
_o_ expression
The expression is evaluated, truncated to
an integer and execution goes to the corre-
sponding integer numbered statment. If ex-
ecuted from immediate mode, the internal
statements are compiled first.

_f
i _ expression statement
The statement is executed if the expression
evaluates to non-zero.

_i
l _s
_t_ [expression [expression]]
_i
l _s
_t_ is used to print out the stored inter-
nal statements. If no arguments are given,
all internal statements are printed. If
one argument is given, only that internal
statement is listed. If two arguments are
given, all internal statements inclusively
between the arguments are printed.

_r
p _i
_n_t
_ list
The list of expressions and strings are
concatenated and printed. (A string is de-
limited by " characters.)

_e
r _t
_u_r
_n_ [expression]
The expression is evaluated and the result
is passed back as the value of a function
call. If no expression is given, zero is
returned.

_u
r _n
_
The internal statements are compiled. The
symbol table is re-initialized. The random
number generator is re-set. Control is
passed to the lowest numbered internal
statement.

Expressions have the following syntax:

name
A name is used to specify a variable.
Names are composed of a letter (’a’ - ’z’)
followed by letters and digits. The first
four characters of a name are significant.

- 2 -
BAS (I) 1/15/73 BAS (I)

number
A number is used to represent a constant
value. A number is composed of digits, at
most one decimal point (’.’) and possibly
a scale factor of the form e
_ digits or e
_-_
digits.

_ expression )
( _
Parentheses are used to alter normal order
of evaluation.

expression operator expression


Common functions of two arguments are ab-
breviated by the two arguments separated by
an operator denoting the function. A com-
plete list of operators is given below.

expression (
_ [expression [,
_ expression ...]] )
_
Functions of an arbitrary number of argu-
ments can be called by an expression fol-
lowed by the arguments in parentheses sepa-
rated by commas. The expression evaluates
to the line number of the entry of the
function in the internally stored state-
ments. This causes the internal statements
to be compiled. If the expression evalu-
ates negative, a builtin function is
called. The list of builtin functions ap-
pears below.

name [
_ expression [,
_ expression ...] ]
_
Each expression is truncated to an integer
and used as a specifier for the name. The
result is syntactically identical to a
name. a[1,2] is the same as a[1][2]. The
truncated expressions are restricted to
values between 0 and 32767.

The following is the list of operators:

=
= is the assignment operator. The left op-
erand must be a name or an array element.
The result is the right operand. Assign-
ment binds right to left, all other opera-
tors bind left to right.

& |
& (logical and) has result zero if either
_
of its arguments are zero. It has result
one if both its arguments are non-zero. | _
(logical or) has result zero if both of its
arguments are zero. It has result one if
either of its arguments are non-zero.

- 3 -
BAS (I) 1/15/73 BAS (I)

< <= > >= == <>


The relational operators (< less than, <=
less than or equal, > greater than, >=
greater than or equal, == equal to, <> not
equal to) return one if their arguments are
in the specified relation. They return ze-
ro otherwise. Relational operators at the
same level extend as follows: a>b>c is the
same as a>b&b>c.

+ -
Add and subtract.

* /
Multiply and divide.

^
Exponentiation.

The following is a list of builtin functions:

arg
Arg(i) is the value of the i
_th actual pa-
rameter on the current level of function
call.

exp
Exp(x) is the exponential function of x.

log
Log(x) is the logarithm base e of x.

sin
Sin(x) is the sine of x (radians).

cos
Cos(x) is the cosine of x (radians).

atn
Atn(x) is the arctangent of x.

rnd
Rnd() is a uniformly distributed random
number between zero and one.

expr
Expr() is the only form of program input.
A line is read from the input and evaluated
as an expression. The resultant value is
returned.

int
Int(x) returns x truncated to an integer.

- 4 -
BAS (I) 1/15/73 BAS (I)

FILES /tmp/btm? temporary

SEE ALSO [1] DEC-11-AJPB-D

DIAGNOSTICS Syntax errors cause the incorrect line to be


typed with an underscore where the parse failed.
All other diagnostics are self explanatory.

BUGS --

- 5 -
CAT (I) 1/15/73 CAT (I)

NAME cat -- concatenate and print

SYNOPSIS _a
c _t
_ file918 ...

DESCRIPTION ca
_ _t
_ reads each file in sequence and writes it on
the standard output. Thus:

_a
c _t
_ f
_i_l
_e_

is about the easiest way to print a file. Also:

_a
c _t
_ f
_i_l
_e_1
_ f
_i_l
_e_2
_ >
_f_i
_l_e
_3_

is about the easiest way to concatenate files.

If no input file is given c


_a_t
_ reads from the
standard input file.

If the argument "-" is encountered, cat reads


from the standard input file.

FILES --

SEE ALSO pr(I), cp(I)

DIAGNOSTICS none; if a file cannot be found it is ignored.

BUGS cat x y >x and cat x y >y cause strange re-


sults.

- 1 -
CC (I) 3/15/72 CC (I)

NAME cc -- C compiler

SYNOPSIS _c
c _ [ -
_c_ ] sfile1.
_c_ ... ofile1 ...

DESCRIPTION cc
_ _ is the UNIX C compiler. It accepts three
types of arguments:

Arguments whose names end with ".c" are assumed


to be C source programs; they are compiled, and
the object program is left on the file sfile1.o
(i.e. the file whose name is that of the source
with ".o" substituted for ".c").

Other arguments (except for "-c") are assumed to


be either loader flag arguments, or C-compatible
object programs, typically produced by an earlier
_c
c _ run, or perhaps libraries of C-compatible rou-
tines. These programs, together with the results
of any compilations specified, are loaded (in the
order given) to produce an executable program
with name a_.
_o_u
_t_.

The "-c" argument suppresses the loading phase,


as does any syntax error in any of the routines
being compiled.

FILES file.c input file


file.o object file
[Link] loaded output
/tmp/ctm? temporary
/lib/c[01] compiler
/lib/crt0.o runtime startoff
/lib/libc.a builtin functions, etc.
/lib/liba.a system library

SEE ALSO C reference manual (in preparation), cdb(I)

DIAGNOSTICS Diagnostics are intended to be self-explanatory.

BUGS --

- 1 -
CDB (I) 1/15/73 CDB (I)

NAME cdb -- C debugger

SYNOPSIS _d
c _b
_ [ core [ [Link] ] ]

DESCRIPTION cd
_ _b
_ is a debugging program for use with C pro-
grams. It is by no means completed, and this
section is essentially only a placeholder for the
actual description.

Cdb resembles d
_b_ in many respects, except that
all integers are decimal.

Even the present c


_d_b
_ has one useful feature: the
command

will give a stack trace of the core image of a


terminated C program. The calls are listed in
the order made; the actual arguments to each rou-
tine are given in octal.

FILES --

SEE ALSO cc(I), db(I), C Reference Manual

DIAGNOSTICS "?"

BUGS --

- 1 -
CHDIR (I) 3/15/72 CHDIR (I)

NAME chdir -- change working directory

SYNOPSIS _h
c _d
_i_r
_ directory

DESCRIPTION _i
d _r
_e_c
_t_o
_r_y
_ becomes the new working directory.

Because a new process is created to execute each


command, c
_h_d
_i_r
_ would be ineffective if it were
written as a normal command. It is therefore
recognized and executed by the Shell.

FILES --

SEE ALSO sh(I)

DIAGNOSTICS "Bad directory" if the directory cannot be


changed to.

BUGS --

- 1 -
CHMOD (I) 3/15/72 CHMOD (I)

NAME chmod -- change mode

SYNOPSIS _h
c _m
_o_d
_ octal file918 ...

DESCRIPTION The octal mode replaces the mode of each of the


files. The mode is constructed from the OR of
the following modes:

01 write for non-owner


02 read for non-owner
04 write for owner
10 read for owner
20 executable
40 set-UID

Only the owner of a file may change its mode.

FILES --

SEE ALSO stat(I), ls(I)

DIAGNOSTICS "?"

BUGS --

- 1 -
CHOWN (I) 3/15/72 CHOWN (I)

NAME chown -- change owner

SYNOPSIS _h
c _o
_w_n
_ owner file918 ...

DESCRIPTION ow
_ _n
_e_r
_ becomes the new owner of the files. The
owner may be either a decimal UID or a login name
found in the password file.

Only the owner of a file is allowed to change the


owner. It is illegal to change the owner of a
file with the set-user-ID mode.

FILES /etc/passwd

SEE ALSO stat(I)

DIAGNOSTICS "Who?" if owner cannot be found, "file?" if file


cannot be found.

BUGS --

- 1 -
CMP (I) 1/15/73 CMP (I)

NAME cmp -- compare two files

SYNOPSIS _m
c _p
_ file918 file928

DESCRIPTION The two files are compared for identical con-


tents. Discrepancies are noted by giving the
offset and the differing words, all in octal.

FILES --

SEE ALSO proof(I)

DIAGNOSTICS Messages are given for inability to open either


argument, premature EOF on either argument, and
incorrect usage.

BUGS If the shorter of the two files is of odd length,


cmp acts as if a null byte had been appended to
it.

- 1 -
CP (I) 1/24/73 CP (I)

NAME cp -- copy

SYNOPSIS _p
c _ file918 file928

DESCRIPTION The first file is copied onto the second. The


mode and owner of the target file are preserved
if it already existed; the mode of the source
file is used otherwise.

If file928 is a directory, then the target file


is a file in that directory with the file-name of
file918.

FILES --

SEE ALSO cat(I), pr(I), mv(I)

DIAGNOSTICS Error returns are checked at every system call,


and appropriate diagnostics are produced.

BUGS Copying a file onto itself destroys its contents.

- 1 -
CREF (I) 2/5/1973 CREF (I)

NAME cref -- make cross reference listing

SYNOPSIS _r
c _e
_f_ [ -
_s_o
_i_ ] name1 ...

DESCRIPTION CREF makes a cross reference listing of files in


assembler format (see AS(I)). The files named as
arguments in the command line are searched for
symbols (defined as a succession of alphabetics,
numerics, ’.’, or ’_’, beginning with an alpha-
betic, ’.’, or ’_’).

The output report is in four columns:

(1) (2) (3) (4)


symbol file see text as it appears in file
below

The third column contains the line number in the


file by default; the -
_s_ option will cause the
most recent name symbol to appear there instead.

CREF uses either an i _g_n


_o_r
_e_ file or an o_n
_l_y
_ file.
If the - _i_ option is given, it will take the next
file name to be an i _g
_n_o
_r_e
_ file; if the - _o_ option
is given, the next file name will be taken as an
_n
o _l
_y_ file. I _g
_n_o
_r_e
_ and o _n
_l_y
_ files should be lists
of symbols separated by new lines. If an i _g
_n_o
_r_e
_
file is given, all the symbols in the file will
be ignored in columns (1) and (3) of the output.
If an o _n
_l_y
_ file is given, only symbols appearing
in the file will appear in column (1), but column
(3) will still contain the most recent name en-
countered. Only one of the options - _i
_ or - _o
_ may
be used. The default setting is - _i
_; all symbols
predefined in the assembler are ignored, except
system call names, which are collected.

FILES Files t.0, t.1, t.2, t.3 are created (i.e. DE-
STROYED) in the working directory of anyone using
_r
c _e
_f_. This nuisance will be repaired soon. The
output is left in file s _.
_o_u
_t_ in the working di-
rectory.

/usr/lem/[Link] is the default i


_g_n
_o_r
_e_ file.

SEE ALSO as(I)

DIAGNOSTICS "line too long" -- input line >131 characters

"symbol too long" -- symbol >20 characters

"too many symbols" -- >10 symbols in line

"cannot open t.?" -- bug; see LEM

- 1 -
CREF (I) 2/5/1973 CREF (I)

"cannot fork; examine [Link]" -- can’t start s _o


_r_t
_
process; intermediate results are on files
_.
t _0
_, t
_._1
_,t
_._2
_,t
_._3
_. These may be sorted inde-
pendently and the results concatenated by the
user.

"cannot sort" -- odd response from s_o


_r_t
_; examine
intermediate results, as above.

"impossible situation" -- system bug

"cannot open" file -- one of the input names


cannot be opened for reading.

BUGS The destruction of unsuspecting users’ files


should soon be fixed. A limitation that may
eventually go away is the restriction to assem-
bler language format. There should be options for
FORTRAN, English, etc., lexical analysis.

File names longer than eight characters cause


misalignment in the output if tabs are set at ev-
ery eighth column.

It should write on the standard output, not


[Link].

- 2 -
CRYPT (I) 10/23/71 CRYPT (I)

NAME crypt -- encode/decode

SYNOPSIS _r
c _y
_p_t
_ [ password ]

DESCRIPTION cr
_ _y
_p_t
_ is an exact implementation of Boris
Hagelin’s cryptographic machine called the M-209
by the U. S. Army [1].

cr
_ _y
_p_t
_ reads from the standard input file and
writes on the standard output. For a given pass-
word, the encryption process is idempotent; that
is,

crypt znorkle <clear >cypher


crypt znorkle <cypher

will print the clear.

_r
c _y
_p_t
_ is suitable for use as a filter:

pr <"crypt bandersnatch"<cypher

FILES --

SEE ALSO [1] U. S. Patent 2,089,603.

DIAGNOSTICS --

BUGS --

- 1 -
DATE (I) 3/15/72 DATE (I)

NAME date -- print and set the date

SYNOPSIS _a
d _t
_e_ [ mmddhhmm ]

DESCRIPTION If no argument is given, the current date is


printed to the second. If an argument is given,
the current date is set. m _m_ is the month number;
_d
d _ is the day number in the month; h_h
_ is the hour
number (24 hour system); m_m
_ is the minute number.
For example:

date 10080045

sets the date to Oct 8, 12:45 AM.

FILES --

SEE ALSO --

DIAGNOSTICS "?" if the argument is syntactically incorrect.

BUGS --

- 1 -
DB (I) 3/15/72 DB (I)

NAME db -- debug

SYNOPSIS _b
d _ [ core [ namelist ] ] [ -
_ ]

DESCRIPTION Unlike many debugging packages (including DEC’s


ODT, on which d_b
_ is loosely based) d _b
_ is not
loaded as part of the core image which it is used
to examine; instead it examines files. Typical-
ly, the file will be either a core image produced
after a fault or the binary output of the assem-
bler. C_o
_r_e
_ is the file being debugged; if omit-
ted "core" is assumed. n _a
_m_e
_l_i
_s_t
_ is a file con-
taining a symbol table. If it is omitted, the
symbol table is obtained from the file being de-
bugged, or if not there from a _._o
_u_t
_. If no appro-
priate name list file can be found, d _b_ can still
be used but some of its symbolic facilities be-
come unavailable.

For the meaning of the optional third argument,


see the last paragraph below.

The format for most d


_b_ requests is an address
followed by a one character command.

Addresses are expressions built up as follows:

1. A name has the value assigned to it when


the input file was assembled. It may be
relocatable or not depending on the use of
the name during the assembly.

2. An octal number is an absolute quantity


with the appropriate value.

3. A decimal number immediately followed by


"." is an absolute quantity with the appro-
priate value.

4. An octal number immediately followed by


"r" is a relocatable quantity with the ap-
propriate value.

5. The symbol "." indicates the current


pointer of d_b
_. The current pointer is set
by many d
_b_ requests.

6. A "*" before an expression forms an expres-


sion whose value is the number in the word
addressed by the first expression. A "*"
alone is equivalent to "*.".

6. Expressions separated by "+" or " " (blank)


are expressions with value equal to the sum

- 1 -
DB (I) 3/15/72 DB (I)

of the components. At most one of the com-


ponents may be relocatable.

8. Expressions separated by "-" form an ex-


pression with value equal to the difference
to the components. If the right component
is relocatable, the left component must be
relocatable.

9. Expressions are evaluated left to right.

Names for registers are built in:

r0 ... r5
sp
pc
fr0 ... fr5

These may be examined. Their values are deduced


from the contents of the stack in a core image
file. They are meaningless in a file that is not
a core image.

If no address is given for a command, the current


address (also specified by ".") is assumed. In
general, "." points to the last word or byte
printed by d
_b_.

There are d
_b_ commands for examining locations in-
terpreted as octal numbers, machine instructions,
ASCII characters, and addresses. For numbers and
characters, either bytes or words may be exam-
ined. The following commands are used to examine
the specified file.

/ The addressed word is printed in octal.

\ The addressed byte is printed in octal.

" The addressed word is printed as two


ASCII characters.

‘ The addressed word is printed in decimal.

? The addressed word is interpreted as a


machine instruction and a symbolic form of
the instruction, including symbolic ad-
dresses, is printed. Often, the result
will appear exactly as it was written in
the source program.

& The addressed word is interpreted as a


symbolic address and is printed as the name

- 2 -
DB (I) 3/15/72 DB (I)

of the symbol whose value is closest to the


addressed word, possibly followed by a
signed offset.

<nl> (i. e., the character "new line")


This command advances the current location
counter "." and prints the resulting loca-
tion in the mode last specified by one of
the above requests.

^ This character decrements "." and prints


the resulting location in the mode last se-
lected one of the above requests. It is a
converse to <nl>.

% Exit.

Odd addresses to word-oriented commands are


rounded down. The incrementing and decrementing
of "." done by the <nl> and ^ requests is by one
or two depending on whether the last command was
word or byte oriented.

The address portion of any of the above commands


may be followed by a comma and then by an expres-
sion. In this case that number of sequential
words or bytes specified by the expression is
printed. "." is advanced so that it points at
the last thing printed.

There are two commands to interpret the value of


expressions.

= When preceded by an expression, the val-


ue of the expression is typed in octal.
When not preceded by an expression, the
value of "." is indicated. This command
does not change the value of ".".

: An attempt is made to print the given


expression as a symbolic address. If the
expression is relocatable, that symbol is
found whose value is nearest that of the
expression, and the symbol is typed, fol-
lowed by a sign and the appropriate offset.
If the value of the expression is absolute,
a symbol with exactly the indicated value
is sought and printed if found; if no
matching symbol is discovered, the octal
value of the expression is given.

The following command may be used to patch the


file being debugged.

- 3 -
DB (I) 3/15/72 DB (I)

! This command must be preceded by an ex-


pression. The value of the expression is
stored at the location addressed by the
current value of ".". The opcodes do not
appear in the symbol table, so the user
must assemble them by hand.

The following command is used after a fault has


caused a core image file to be produced.

$ causes the fault type and the contents


of the general registers and several other
registers to be printed both in octal and
symbolic format. The values are as they
were at the time of the fault.

Db
_ _ should not be used to examine special files,
for example disks and tapes, since it reads one
byte at a time. Use od(I) instead.

For some purposes, it is important to know how


addresses typed by the user correspond with loca-
tions in the file being debugged. The mapping
algorithm employed by d_b
_ is non-trivial for two
reasons: First, in an a_.
_o_u
_t_ file, there is a
20(8) byte header which will not appear when the
file is loaded into core for execution. There-
fore, apparent location 0 should correspond with
actual file offset 20. Second, some systems
cause a "squashed" core image to be written. In
such a core image, addresses in the stack must be
mapped according to the degree of squashing which
has been employed. D_b
_ obeys the following rules:

If exactly one argument is given, and if it ap-


pears to be an a
_._o
_u_t
_ file, the 20-byte header is
skipped during addressing, i.e., 20 is added to
all addresses typed. As a consequence, the head-
er can be examined beginning at location -20.

If exactly one argument is given and if the file


does not appear to be an a
_._o
_u_t
_ file, no mapping
is done.

If zero or two arguments are given, the mapping


appropriate to a core image file is employed.
This means that locations above the program break
and below the stack effectively do not exist (and
are not, in fact, recorded in the core file).
Locations above the user’s stack pointer are
mapped, in looking at the core file, to the place
where they are really stored. The per-process
data kept by the system, which is stored in the

- 4 -
DB (I) 3/15/72 DB (I)

last 512(10) bytes of the core file, can be ad-


dressed at apparent locations 160000-160777.

If one wants to examine a file which has an asso-


ciated name list, but is not a core image file,
the last argument "-" can be used (actually the
only purpose of the last argument is to make the
number of arguments not equal to two). This fea-
ture is used most frequently in examining the
memory file /dev/mem.

FILES --

SEE ALSO as(I), core(V), [Link](V), od(I)

DIAGNOSTICS "File not found" if the first argument cannot be


read; otherwise "?".

BUGS --

- 5 -
DC (I) 1/15/73 DC (I)

NAME dc -- desk calculator

SYNOPSIS _c
d _ [file]

DESCRIPTION dc
_ _ is an arbitrary precision integer arithmetic
package. The overall structure of dc is a stack-
ing (reverse Polish) calculator. The following
constructions are recognized by the calculator:

number
The value of the number is pushed on the
stack. A number is an unbroken string of the
digits 0-9. It may be preceded by an under-
score (_) to input a negative number.

_ -
+ _ _* /
_ %
_ ^
_
The top two values on the stack are added (+_),
subtracted (-
_), multiplied (*_), divided (/
_),
remaindered (%_) or exponentiated (^). The two
entries are popped off the stack; the result
is pushed on the stack in their place.

_x
s
The top of the stack is popped and stored into
a register named x, where x may be any charac-
ter.

_x
l
The value in register x is pushed on the
stack. The register x is not altered. All
registers start with zero value.

_
d
The top value on the stack is pushed on the
stack. Thus the top value is duplicated.

_
p
The top value on the stack is printed. The
top value remains unchanged.

_
f
All values on the stack and in registers are
printed.

q
_
exits the program. If executing a string, the
nesting level is popped by two.

x
_
treats the top element of the stack as a char-
acter string and executes it as a string of dc
commands.

_.
[ _.
_._]
_

- 1 -
DC (I) 1/15/73 DC (I)

puts the bracketed ascii string onto the top


of the stack.

_x _
< =x >
_x
The top two elements of the stack are popped
and compared. Register x is executed if they
obey the stated relation.

v
_
replaces the top element on the stack by its
square root.

_
!
interprets the rest of the line as a UNIX com-
mand.

_
c
All values on the stack are popped.

_
i
The top value on the stack is popped and used
as the number radix for further input.

_
o
the top value on the stack is popped and used
as the number radix for further output.

_
z
the stack level is pushed onto the stack.

_
?
a line of input is taken from the input source
(usually the console) and executed.

new-line
ignored except as the name of a register or to
end the response to a ?
_.

space
ignored except as the name of a register or to
terminate a number.

If a file name is given, input is taken from that


file until end-of-file, then input is taken from
the console.

An example to calculate the monthly, weekly and


hourly rates for a $10,000/year salary.

10000
100* (now in cents)
dsa (non-destructive store)
12/ (pennies per month)
la52/ (pennies per week)

- 2 -
DC (I) 1/15/73 DC (I)

d10* (deci-pennies per week)


375/ (pennies per hour)
f (print all results)
512
19230
83333
"a" 1000000

An example which prints the first ten values of n! is


[la1+dsa*pla10>x]sx
0sa1
lxx

FILES --

SEE ALSO msh(VII), salloc(III)

DIAGNOSTICS (x) ? for unrecognized character x.


(x) ? for not enough elements on the stack to do
what was asked by command x.
"Out of space" when the free list is exhausted
(too many digits).
"Out of headers" for too many numbers being kept
around.
"Out of pushdown" for too many items on the
stack.
"Nesting Depth" for too many levels of nested ex-
ecution.

BUGS --

- 3 -
DF (I) 1/20/73 DF (I)

NAME df -- disk free

SYNOPSIS _f
d _ [ filesystem ]

DESCRIPTION df
_ _ prints out the number of free blocks available
on a file system. If the file system is unspeci-
fied, the free space on all of the normally
mounted file systems is printed.

FILES /dev/rf?, /dev/rk?, /dev/rp?

SEE ALSO check(VIII)

DIAGNOSTICS --

BUGS --

- 1 -
DSW (I) 3/15/72 DSW (I)

NAME dsw -- delete interactively

SYNOPSIS _s
d _w
_ [ directory ]

DESCRIPTION For each file in the given directory ("." if not


specified) d
_s_w
_ types its name. If "y" is typed,
the file is deleted; if "x", d
_s_w
_ exits; if any-
thing else, the file is not removed.

FILES --

SEE ALSO rm(I)

DIAGNOSTICS "?"

BUGS The name "dsw" is a carryover from the ancient


past. Its etymology is amusing but the name is
nonetheless ill-advised.

- 1 -
DU (I) 1/20/73 DU (I)

NAME du -- summarize disk usage

SYNOPSIS _u
d _ [ -
_s_ ] [ -
_a_ ] [ name ... ]

DESCRIPTION du
_ _ gives the number of blocks contained in all
files and (recursively) directories within each
specified directory or file n_a
_m_e
_. If n
_a_m
_e_ is
missing, ._ is used.

The optional argument -


_s_ causes only the grand
total to be given. The optional argument - _a
_
causes an entry to be generated for each file.
Absence of either causes an entry to be generated
for each directory only.

A file which has two links to it is only counted


once.

FILES .

SEE ALSO --

DIAGNOSTICS --

BUGS Non-directories given as arguments (not under -a


option) are not listed.

Removable file systems do not work correctly


since i-numbers may be repeated while the corre-
sponding files are distinct. Du should maintain
an i-number list per root directory encountered.

- 1 -
ECHO (I) 3/15/72 ECHO (I)

NAME echo -- echo arguments

SYNOPSIS _c
e _h
_o_ [ arg89918 ... ]

DESCRIPTION ec
_ _h
_o_ writes all its arguments in order as a line
on the standard output file. It is mainly useful
for producing diagnostics in command files.

FILES --

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
ED (I) 1/15/73 ED (I)

NAME
ed -- editor

SYNOPSIS
_d
e _ [ name ]

DESCRIPTION
_d
e _ is the standard text editor.

If the optional argument is given, e_d


_ simulates an e
_ com-
mand on the named file; that is to say, the file is read
into e
_d_’s buffer so that it can be edited.

ed
_ _ operates on a copy of any file it is editing; changes
made in the copy have no effect on the file until a write
(w_) command is given. The copy of the text being edited
resides in a temporary file called the b_u
_f_f
_e_r
_. There is
only one buffer.

Commands to e _d_ have a simple and regular structure: zero


or more a
_d_d
_r_e
_s_s
_e_s
_ followed by a single character c
_o_m
_m_a
_n_d
_,
possibly followed by parameters to the command. These
addresses specify one or more lines in the buffer. Every
command which requires addresses has default addresses,
so that the addresses can often be omitted.

In general, only one command may appear on a line. Cer-


tain commands allow the input of text. This text is
placed in the appropriate place in the buffer. While e _d
_
is accepting text, it is said to be in i
_n_p
_u_t
_ m
_o_d
_e_. In
this mode, no commands are recognized; all input is mere-
ly collected. Input mode is left by typing a period (.)
alone at the beginning of a line.

ed
_ _ supports a limited form of r
_e_g
_u_l
_a_r
_ e
_x_p
_r_e
_s_s
_i_o
_n_ nota-
tion. A regular expression is an expression which speci-
fies a set of strings of characters. A member of this
set of strings is said to be m_a
_t_c
_h_e
_d_ by the regular ex-
pression. The regular expressions allowed by e _d_ are con-
structed as follows:

1. An ordinary character (not one of those discussed


below) is a regular expression and matches that
character.

2. A circumflex (^) at the beginning of a regular ex-


pression matches the null character at the begin-
ning of a line.

3. A currency symbol ($) at the end of a regular ex-


pression matches the null character at the end of a
line.

4. A period (.) matches any character but a new-line

- 1 -
ED (I) 1/15/73 ED (I)

character.

5. A regular expression followed by an asterisk (*)


matches any number of adjacent occurrences (includ-
ing zero) of the regular expression it follows.

6. A string of characters enclosed in square brackets


([]) matches any character in the string but no
others. If, however, the first character of the
string is a circumflex (^) the regular expression
matches any character but new-line and the charac-
ters in the string.

7. The concatenation of regular expressions is a regu-


lar expression which matches the concatenation of
the strings matched by the components of the regu-
lar expression.

8. The null regular expression standing alone is


equivalent to the last regular expression encoun-
tered.

Regular expressions are used in addresses to specify


lines and in one command (s
_, see below) to specify a por-
tion of a line which is to be replaced.

If it is desired to use one of the regular expression


metacharacters as an ordinary character, that character
may be preceded by "\". This also applies to the charac-
ter bounding the regular expression (often "/") and to
"\" itself.

Addresses are constructed as follows. To understand ad-


dressing in e_d
_ it is necessary to know that at any time
there is a c
_u_r
_r_e
_n_t
_ l
_i_n
_e_. Generally speaking, the current
line is the last line affected by a command; however, the
exact effect on the current line by each command is dis-
cussed under the description of the command.

1. The character "." addresses the current line.

2. The character "^" addresses the line immediately


before the current line.

3. The character "$" addresses the last line of the


buffer.

4. A decimal number n
_ addresses the n
_th line of the
buffer.

6. A regular expression enclosed in slashes "/" ad-


dresses the first line found by searching toward
the end of the buffer and stopping at the first
line containing a string matching the regular ex-

- 2 -
ED (I) 1/15/73 ED (I)

pression. If necessary the search wraps around to


the beginning of the buffer.

5. A regular expression enclosed in queries "?" ad-


dresses the first line found by searching toward
the beginning of the buffer and stopping at the
first line found containing a string matching the
regular expression. If necessary the search wraps
around to the end of the buffer.

7. An address followed by a plus sign "+" or a minus


sign "-" followed by a decimal number specifies
that address plus (resp. minus) the indicated num-
ber of lines. The plus sign may be omitted.

8. "’x" addresses the line associated (marked) with


the mark name character "x" which must be a print-
able character. Lines may be marked with the "k"
command described below.

Commands may require zero, one, or two addresses. Com-


mands which require no addresses regard the presence of
an address as an error. Commands which accept one or two
addresses assume default addresses when insufficient are
given. If more addresses are given than such a command
requires, the last one or two (depending on what is ac-
cepted) are used.

Addresses are separated from each other typically by a


comma (,). They may also be separated by a semicolon
(;). In this case the current line "." is set to the
previous address before the next address is interpreted.
This feature can be used to determine the starting line
for forward and backward searches ("/", "?"). The second
address of any two-address sequence must correspond to a
line following the line corresponding to the first ad-
dress.

In the following list of e


_d_ commands, the default ad-
dresses are shown in parentheses. The parentheses are
not part of the address, but are used to show that the
given addresses are the default.

As mentioned, it is generally illegal for more than one


command to appear on a line. However, any command may be
suffixed by "p" (for "print"). In that case, the current
line is printed after the command is complete.

(.)a
<text>
The a_ppend command reads the given text and appends it
after the addressed line. "." is left on the last
line input, if there were any, otherwise at the ad-
dressed line. Address "0" is legal for this com-

- 3 -
ED (I) 1/15/73 ED (I)

mand; text is placed at the beginning of the buf-


fer.

(.,.)c
<text>
The c
_hange command deletes the addressed lines, then
accepts input text which replaces these lines. "."
is left at the last line input; if there were none,
it is left at the first line not changed.

(.,.)d
The d
_elete command deletes the addressed lines from
the buffer. The line originally after the last
line deleted becomes the current line; if the lines
deleted were originally at the end, the new last
line becomes the current line.

e filename
The e
_dit command causes the entire contents of the
buffer to be deleted, and then the named file to be
read in. "." is set to the last line of the buf-
fer. The number of characters read is typed.
"filename" is remembered for possible use as a de-
fault file name in a subsequent r
_ or w
_ command.

f filename
The f
_ilename command prints the currently remem-
bered file name. If "filename" is given, the cur-
rently remembered file name is changed to "file-
name".

(1,$)g/regular expression/command list


In the g
_lobal command, the first step is to mark
every line which matches the given regular expres-
sion. Then for every such line, the given command
list is executed with "." initially set to that
line. A single command or the first of multiple
commands appears on the same line with the global
command. All lines of a multi-line list except the
last line must be ended with "\". a _, i
_, and c
_ com-
mands and associated input are permitted; the "."
terminating input mode may be omitted if it would
be on the last line of the command list. The
(global) commands, g
_ and v
_, are not permitted in
the command list.

(.)i
<text>
This command i
_nserts the given text before the ad-
dressed line. "." is left at the last line input;
if there were none, at the addressed line. This
command differs from the a
_ command only in the
placement of the text.

- 4 -
ED (I) 1/15/73 ED (I)

(.)kx
The mark
_ command associates or marks the addressed
line with the single character mark name "x". The
ten most recent mark names are remembered. The
current mark names may be printed with the n
_ com-
mand.

(.,.)mA
The m_ove command will reposition the addressed
lines after the line addressed by "A". The line
originally after the last line moved becomes the
current line; if the lines moved were originally at
the end, the new last line becomes the current
line.

n
The markn
_ames command will print the current mark
names.

(.,.)p
The p_rint command prints the addressed lines. "."
is left at the last line printed. The p _ command
_a
m _y
_ be placed on the same line after any command.

_
q
The q
_uit command causes e_d
_ to exit. No automatic
write of a file is done.

($)r filename
The r
_ead command reads in the given file after the
addressed line. If no file name is given, the re-
membered file name, if any, is used (see e
_ and f
_
commands). The remembered file name is not changed
unless "filename" is the very first file name men-
tioned. Address "0" is legal for r_ and causes the
file to be read at the beginning of the buffer. If
the read is successful, the number of characters
read is typed. "." is left at the last line read
in from the file.

(.,.)s/regular expression/replacement/ or,


(.,.)s/regular expression/replacement/g
The s
_ubstitute command searches each addressed line
for an occurrence of the specified regular expres-
sion. On each line in which a match is found, all
matched strings are replaced by the replacement
specified, if the global replacement indicator "g"
appears after the command. If the global indicator
does not appear, only the first occurrence of the
matched string is replaced. It is an error for the
substitution to fail on all addressed lines. Any
character other than space or new-line may be used
instead of "/" to delimit the regular expression
and the replacement. "." is left at the last line

- 5 -
ED (I) 1/15/73 ED (I)

substituted.

The ampersand "&" appearing in the replacement is


replaced by the regular expression that was
matched. The special meaning of "&" in this con-
text may be suppressed by preceding it by "\".

(1,$)v/regular expression/command list


This command is the same as the g _lobal command ex-
cept that the command list is executed with "."
initially set to every line e
_x_c
_e_p
_t_ those matching
the regular expression

(1,$)w filename
The w
_rite command writes the addressed lines onto
the given file. If the file does not exist, it is
created mode 17 (readable and writeable by every-
one). The remembered file name is n_o
_t_ changed un-
less "filename" is the very first file name men-
tioned. If no file name is given, the remembered
file name, if any, is used (see e
_ and f_ commands).
"." is unchanged. If the command is successful,
the number of characters written is typed.

($)=
The line number of the addressed line is typed.
"." is unchanged by this command.

!UNIX command
The remainder of the line after the "!" is sent to
UNIX to be interpreted as a command. "." is un-
changed.

(.+1)<newline>
An address alone on a line causes that line to be
printed. A blank line alone is equivalent to
".+1p"; it is useful for stepping through text.

If an interrupt signal (ASCII DEL) is sent, e


_d_ will print
a "?" and return to its command level.

If invoked with the command name ’-’, (see i


_n_i
_t_) e
_d_ will
sign on with the message "Editing system" and print "*"
as the command level prompt character.

Ed
_ _ has size limitations on the maximum number of lines
that can be edited, and on the maximum number of charac-
ters in a line, in a global’s command list, and in a re-
membered file name. These limitations vary with the
physical core size of the PDP11 computer on which e_d
_ is
being used. The range of limiting sizes for the above
mentioned items is; 1300 - 4000 lines per file, 256 - 512
characters per line, 63 - 256 characters per global com-
mand list, and 64 characters per file name.

- 6 -
ED (I) 1/15/73 ED (I)

FILES
/tmp/etm? temporary
/etc/msh to implement the "!" command.

SEE ALSO --

DIAGNOSTICS "?" for any error

BUGS --

- 7 -
EXIT(I) 3/15/72 EXIT(I)

NAME exit -- terminate command file

SYNOPSIS _x
e _i
_t_

DESCRIPTION ex
_ _i
_t_ performs a s
_e_e
_k_ to the end of its standard
input file. Thus, if it is invoked inside a file
of commands, upon return from e _x
_i_t
_ the shell will
discover an end-of-file and terminate.

FILES --

SEE ALSO if(I), goto(I), sh(I)

DIAGNOSTICS --

BUGS --

- 1 -
FACTOR (I) 1/15/73 FACTOR (I)

NAME factor -- discover prime factors of a number

SYNOPSIS _a
f _c
_t_o
_r_

DESCRIPTION When factor is invoked, it types out "Enter:" at


you. If you type in a positive number less than
2^56 (about 7.2E16), it will repeat the number
back at you and then its prime factors each one
printed the proper number of times. Then it says
"Enter:" again. To exit, feed it an EOT or a
delete.

Maximum time to factor is proportional to sqrt(n)


and occurs when n is prime. It takes 1 minute to
factor a prime near 10^13.

FILES --

SEE ALSO --

DIAGNOSTICS "Ouch." for input out of range or for garbage in-


put.

BUGS --

- 1 -
FC (I) 9/1/72 FC (I)

NAME fc -- fortran compiler

SYNOPSIS _c
f _ [ -
_c_ ] sfile1.
_f_ ... ofile1 ...

DESCRIPTION fc
_ _ is the UNIX Fortran compiler. It accepts
three types of arguments:

Arguments whose names end with ".f" are assumed


to be Fortran source program units; they are com-
piled, and the object program is left on the file
sfile1.o (i.e. the file whose name is that of
the source with ".o" substituted for ".f").

Other arguments (except for "-c") are assumed to


be either loader flags, or object programs, typi-
cally produced by an earlier f
_c_ run, or perhaps
libraries of Fortran-compatible routines. These
programs, together with the results of any compi-
lations specified, are loaded (in the order giv-
en) to produce an executable program with name
_.
a _o
_u_t
_.

The "-c" argument suppresses the loading phase,


as does any syntax error in any of the routines
being compiled.

The following is a list of differences between f


_c_
and ANSI standard Fortran (also see the BUGS sec-
tion):

1. Arbitrary combination of types is allowed in


expressions. Not all combinations are expect-
ed to be supported at runtime. All of the
normal conversions involving integer, real,
double precision and complex are allowed.

2. The ’standard’ implicit statement is recog-


nized.

3. The types doublecomplex, logical*1, integer*2


and real*8 (doubleprecision) are supported.

4. _
& as the first character of a line signals a
continuation card.

5. _
c as the first character of a line signals a
comment.

6. All keywords are recognized in lower case.

7. The notion of ’column 7’ is not implemented.

8. G-format input is free form-- leading blanks


are ignored, the first blank after the start

- 1 -
FC (I) 9/1/72 FC (I)

of the number terminates the field.

9. A comma in any numeric or logical input field


terminates the field.

10. There is no carriage control on output.

In I/O statements, only unit numbers 0-19 are


supported. Unit number n _n
_ corresponds to file
"fortn
_n_;" (e.g. unit 9 is file "fort09"). For
input, the file must exist; for output, it will
be created.

Unit 5 is permanently associated with the stan-


dard input file; unit 6 with the standard output
file.

FILES file.f input file


[Link] loaded output
[Link][123] temporary (deleted)
/usr/fort/fc[1234] compilation phases
/usr/lib/fr0.o runtime startoff
/usr/lib/filib.a interpreter library
/usr/lib/libf.a builtin functions, etc.
/usr/lib/liba.a system library

SEE ALSO ANSI standard

DIAGNOSTICS Compile-time diagnostics are given by number. If


the source code is available, it is printed with
an underline at the current character pointer.
Errors possible are:

1 statement too long


2 syntax error in type statement
3 redeclaration
4 missing ( in array declarator
5 syntax error in dimension statement
6 inappropriate or gratuitous array
declarator
7 syntax error in subscript bound
8 illegal character
9 common variable is a parameter or already
in common
10 common syntax error
11 subroutine/blockdata/function not first
statement
12 subroutine/function syntax error
13 block data syntax error
14 redeclaration in external
15 external syntax error
16 implicit syntax error
17 subscript on non-array
18 incorrect subscript count

- 2 -
FC (I) 9/1/72 FC (I)

19 subscript out of range


20 subscript syntax error
22 DATA syntax error
23 Illegal variable in DATA
23 equivalence inconsistency
24 equivalence syntax error
25 separate common blocks equivalenced
26 common block illegally extended by equiv-
alence
27 common inconsistency created by equiva-
lence
28 DATA table overflow
29 () imbalance in expression
30 expression syntax error
31 illegal variable in equivalence
32 Storage initialized twice by DATA
33 non array/function used with sub-
scripts/arguments
35 goto syntax error
37 illegal return
38 continue, return, stop, call, end, or
pause syntax error
39 assign syntax error
40 if syntax error
41 I/O syntax error
42 do or I/O iteration error
43 do end missing
50 illegal statement in block data
51 multiply defined labels
52 undefined label
53 dimension mismatch
54 expression syntax error
55 end of statement in hollerith constant
56 array too large
99 B table overflow
101 unrecognized statement

Runtime diagnostics:

1 invalid log argument


2 bad arg count to amod
3 bad arg count to atan2
4 excessive argument to cabs
5 exp too large in cexp
6 bad arg count to cmplx
7 bad arg count to dim
8 excessive argument to exp
9 bad arg count to idim
10 bad arg count to isign
11 bad arg count to mod
12 bad arg count to sign
13 illegal argument to sqrt
14 assigned/computed goto out of range
15 subscript out of range

- 3 -
FC (I) 9/1/72 FC (I)

16 real**real overflow

100 illegal I/O unit number


101 inconsistent use of I/O unit
102 cannot create output file
103 cannot open input file
104 EOF on input file
105 illegal character in format
106 format does not begin with (
107 no conversion in format but non-empty
list
108 excessive parenthesis depth in format
109 illegal format specification
110 illegal character in input field
111 end of format in hollerith specification
999 unimplemented input conversion

BUGS The following is a list of those features not yet


implemented:

arithmetic statement functions

backspace, endfile, rewind runtime

binary I/O

no scale factors on input

- 4 -
FED (I) 1/15/73 FED (I)

NAME
fed -- edit associative memory for form letter

SYNOPSIS
_e
f _d
_

DESCRIPTION
fe
_ _d
_ is used to edit a form letter associative
memory file, form.m, which consists of named
strings. Commands consist of single letters fol-
lowed by a list of string names separated by a
single space and ending with a new line. The
conventions of the Shell with respect to ’*’ and
’?’ hold for all commands but m_ where literal
string names are expected. The commands are:

e name918 ...

edit writes the string whose name is name918


_
onto a temporary file and executes the sys-
tem editor e
_d_. On exit from the system edi-
tor the temporary file is copied back into
the associative memory. Each argument is
operated on separately. The sequence of
commands to add the string from ’file’ to
memory with name ’newname’ is as follows:

e newname 0 (printed
by ed) r file 200 w
200 q (get out of ed)
q (get out of fe)

To dump a string onto a file:

e name 200 (printed by


ed) w filename 200
q (get out of ed)
q (get out of fe)

d [ name918 ... ]

deletes a string and its name from the memo-


_
ry. When called with no arguments d_ oper-
ates in a verbose mode typing each string
name and deleting only if a ’y’ is typed. A
’q’ response returns to fed’s command level.
Any other response does nothing.

m name918 name928 ...

(m
_ove) changes the name of name918 to
name928 and removes previous string name928

- 1 -
FED (I) 1/15/73 FED (I)

if one exists. Several pairs of arguments


may be given.

n [ name918 ... ]

(n
_ames) lists the string names in the memo-
ry. If called with the optional arguments,
it just lists those requested.

p name918 ...

prints the contents of the strings with


_
names given by the arguments.

q (q
_uit) returns to the system.

c [ p
_ ] [ f
_ ]

checks the associative memory file for con-


_
sistency and reports the number of free
headers and blocks. The optional arguments
do the following:

p causes any unaccounted for string to be


printed

f fixes broken memories by adding unac-


counted-for headers to free storage and
removing references to released headers
from associative memory.

FILES /tmp/ftmp? temporary


form.m associative memory

SEE ALSO form(I), ed(I), sh(I)

DIAGNOSTICS ’?’ unknown command


’name not in memory.’ if string ’name’ is not in
the associative memory and is used as an argument
for d
_ or m
_.

BUGS --

WARNING It is legal but an unwise idea to have string


names with blanks, ":" or "?" in them.

- 2 -
FORM (I) 6/15/72 FORM (I)

NAME
form -- form letter generator

SYNOPSIS
_o
f _r
_m_ proto arg918 ...

DESCRIPTION
fo
_ _r
_m_ generates a form letter from a prototype
letter, an associative memory, arguments and in a
special case, the current date.

If f
_o_r
_m_ is invoked with the p
_r_o
_t_o
_ argument ’x’,
the associative memory is searched for an entry
with name ’x’ and the contents filed under that
name are used as the prototype. If the search
fails, the message "[x]:" is typed on the console
and whatever text is typed in from the console,
terminated by two new lines, is used as the pro-
totype.

If the prototype argument is missing, ’{letter}’


is assumed.

Basically, f
_o_r
_m_ is a copy process from the proto-
type to the output file. If an element of the
form [n] (where n _ is a digit from 1 to 9) is en-
countered, the n _th argument a
_r_g
_9n8 is inserted in
its place, and that argument is then rescanned.
If [0] is encountered, the current date is in-
serted. If the desired argument has not been
given, a message of the form "[n]:" is typed.
The response typed in then is used for that argu-
ment.

If an element of the form [name] or {name} is en-


countered, the name is looked up in the associa-
tive memory. If it is found, the contents of the
memory under this name replaces the original ele-
ment (again rescanned). If the name is not
found, a message of the form "[name]:" is typed.
The response typed in is used for that element.
The response is entered in the memory under the
name if the name is enclosed in []. The response
is not entered in the memory but is remembered
for the duration of the letter if the name is en-
closed in {}.

In both of the above cases, the response is typed


in by entering arbitrary text terminated by two
new lines. Only the first of the two new lines
is passed with the text.

If one of the special characters [{]}\ is preced-


ed by a \, it loses its special character.

- 1 -
FORM (I) 6/15/72 FORM (I)

If a file named "forma" already exists in the


users directory, "formb" is used as the output
file and so forth to "formz".

The file "form.m" is created if none exists. Be-


cause form.m is operated on by the disc allo-
cater, it should only be changed by using f
_e_d
_,
the form letter editor, or f
_o_r
_m_.

FILES
form.m associative memory
form? output file (read only)

SEE ALSO
fed(I), type(I), roff(I)

DIAGNOSTICS
"cannot open output file" "cannot open memory
file" when the appropriate files cannot be locat-
ed or created.

BUGS
An unbalanced ] or } acts as an end of file but
may add a few strange entries to the associative
memory.

- 2 -
FORML (I) 10/24/72 FORML (I)

NAME forml -- form letter generator processor

SYNOPSIS _o
f _r
_m_l
_ [ name ] ...

DESCRIPTION A streamlined program for typing form letters.


The names pick out prestored form letters pre-
pared according to the conventions of _f_
o_r_
m and
r_
_ o_
f_f_
. The program prompts to get each blank
filled in. When all the forms are completed, it
prompts "Set paper." It waits for a newline be-
fore printing each letter.

If more than one name is given, the name of each


letter is announced before the prompts for it be-
gin. If no names are given, the program asks
"Which letter?" before each. Respond with the
name and a newline, or newline only when done.

On a 2741 type terminal, the program assumes the


letter is to be typed with a correspondence ball,
and also prompts "Change ball." Replace the ball
at the end.

FILES form.m (memory),


forma, formb, ... temporaries

SEE ALSO form(I), fed(I), roff(I)

DIAGNOSTICS "Try again"--can’t get a process

BUGS --

- 1 -
GOTO (I) 3/15/72 GOTO (I)

NAME goto -- command transfer

SYNOPSIS _o
g _t
_o_ label

DESCRIPTION go
_ _t
_o_ is only allowed when the Shell is taking
commands from a file. The file is searched (from
the beginning) for a line beginning with ":" fol-
lowed by one or more spaces followed by the la-
__b
_e_l
_. If such a line is found, the g _o
_t_o
_ command
returns. Since the read pointer in the command
file points to the line after the label, the ef-
fect is to cause the Shell to transfer to the la-
belled line.

":" is a do-nothing command that only serves to


place a label.

FILES --

SEE ALSO sh(I), :(I)

DIAGNOSTICS "goto error", if the input file is a typewriter;


"label not found".

BUGS --

- 1 -
HYPHEN (I) 1/15/73 HYPHEN (I)

NAME hyphen -- find hyphenated words

SYNOPSIS _y
h _p
_h_e
_n_ file1 ...

DESCRIPTION It finds all of the words in a document which are


hyphenated across lines and prints them back at
you in a convenient format.

If no arguments are given, the standard output is


used. Thus h_y
_p__
he_n
_ may be used as a filter.

FILES --

SEE ALSO --

DIAGNOSTICS yes

BUGS yes, it gets confused, but with no ill effects


other than spurious extra output.

- 1 -
IF (I) 3/15/72 IF (I)

NAME if -- conditional command

SYNOPSIS _f
i _ expr command [ arg918 ... ]

DESCRIPTION if
_ _ evaluates the expression e_x
_p_r
_, and if its val-
ue is t_r
_u_e
_, executes the given c_o_m
_m_a
_n_d
_ with the
given arguments.

The following primitives are used to construct


the e
_x_p
_r_:

_r
- _ file
true if the file exists and is readable.

_w
- _ file
true if the file exists and is writable

s1 =
_ s2
true if the strings s
_1_ and s
_2_ are equal.

s1 !
_=_ s2
true if the strings s
_1_ and s
_2_ are not
equal.

These primaries may be combined with the follow-


ing operators:

_
!
unary negation operator

_a
- _
binary a
_n_d
_ operator

_o
- _
binary o
_r_ operator

_ expr )
( _
parentheses for grouping.

-a
_ _ has higher precedence than -
_o_. Notice that
all the operators and flags are separate argu-
ments to i_f
_ and hence must be surrounded by spa-
ces.

FILES --

SEE ALSO sh(I)

DIAGNOSTICS "if error", if the expression has the wrong syn-


tax; "command not found."

BUGS --

- 1 -
LD (I) 3/15/72 LD (I)

NAME ld -- link editor

SYNOPSIS _d
l _ [ -
_s_u
_l_x
_r_ ] name1 ...

DESCRIPTION ld
_ _ combines several object programs into one;
resolves external references; and searches li-
braries. In the simplest case the names of sev-
eral object programs are given, and l
_d_ combines
them, producing an object module which can be ei-
ther executed or become the input for a further
_d
l _ run. In the latter case, the "-r" option must
be given to preserve the relocation bits.

The argument routines are concatenated in the or-


der specified. The entry point of the output is
the beginning of the first routine.

If any argument is a library, it is searched ex-


actly once. Only those routines defining an un-
resolved external reference are loaded. If a
routine from a library references another routine
in the library, the referenced routine must ap-
pear after the referencing routine in the li-
brary. Thus the order of programs within li-
braries is important.

ld
_ _ understands several flag arguments which are
written preceded by a "-":

-s "squash" the output, that is, remove the


symbol table and relocation bits to save
space (but impair the usefulness of the de-
bugger). This information can also be re-
moved by s
_t_r
_i_p
_.

-u take the following argument as a symbol and


enter it as undefined in the symbol table.
This is useful for loading wholly from a
library, since initially the symbol table
is empty and an unresolved reference is
needed to force the loading of the first
routine.

-l This option is an abbreviation for a li-


brary name. "-l" alone stands for
"/usr/lib/liba.a", which is the standard
system library for assembly language pro-
grams. "-lx" stands for "/usr/lib/libx.a"
where x is any character. There are li-
braries for Fortran (x="f"), C (x="c"), Ex-
plor (x="e") and B (x="b").

-x Do not preserve local ([Link]) symbols


in the output symbol table; only enter ex-

- 1 -
LD (I) 3/15/72 LD (I)

ternal symbols. This option saves some


space in the output file.

-r generate relocation bits in the output file


so that it can be the subject of another l
_d_
run.

The output of l
_d_ is left on a
_._o
_u_t
_. This file is
executable only if no errors occurred during the
load.

FILES /usr/lib/lib?.a libraries


[Link] output file

SEE ALSO as(I), ar(I)

DIAGNOSTICS "file not found"-- bad argument

"bad format"-- bad argument

"relocation error"-- bad argument (relocation


bits corrupted)

"multiply defined"-- same symbol defined twice in


same load

"un"-- stands for "undefined symbol"

"symbol not found"-- loader bug

"can’t move output file"-- can’t move temporary


to [Link] file

"no relocation bits"-- an input file lacks relo-


cation information

"too many symbols"-- too many references to ex-


ternal symbols in a given routine

"premature EOF"

"can’t create [Link]"-- cannot make temporary file

"multiple entry point"-- more than one entry


point specified (not possible yet).

BUGS --

- 2 -
LN (I) 3/15/72 LN (I)

NAME ln -- make a link

SYNOPSIS _n
l _ name1 [ name2 ]

DESCRIPTION ln
_ _ creates a link to an existing file name1. If
name2 is given, the link has that name; otherwise
it is placed in the current directory and its
name is the last component of name1.

It is forbidden to link to a directory or to link


across file systems.

FILES --

SEE ALSO rm(I)

DIAGNOSTICS "?"

BUGS There is nothing particularly wrong with l


_n_, but
links don’t work right with respect to the backup
system: one copy is backed up for each link, and
(more serious) in case of a file system reload
both copies are restored and the information that
a link was involved is lost.

- 1 -
LOGIN (I) 3/15/72 LOGIN (I)

NAME login -- sign onto UNIX

SYNOPSIS _o
l _g
_i_n
_ [ username [ password ] ]

DESCRIPTION The l
_o_g
_i_n
_ command is used when a user initially
signs onto UNIX, or it may be used at any time to
change from one user to another. The latter case
is the one summarized above and described here.
See l
_o_g
_i_n
_ (VII) for how to dial up initially.

If l
_o_g
_i_n
_ is invoked without an argument, it will
ask for a user name, and, if appropriate, a pass-
word. Echoing is turned off (if possible) during
the typing of the password, so it will not appear
on the written record of the session.

After a successful login, accounting files are


updated and the user is informed of the existence
of mailbox and message-of-the-day files.

Login is recognized by the Shell and executed di-


rectly (without forking).

FILES /tmp/utmp accounting


/tmp/wtmp accounting
mailbox mail
/etc/motd message-of-the-day /etc/pass-
wd password file

SEE ALSO login(VII), init(VII), getty(VII), mail(I)

DIAGNOSTICS "login incorrect", if the name or the password is


bad. "No Shell,", "cannot open password file,"
"no directory:" consult a UNIX programming coun-
cilor.

BUGS --

- 1 -
LS (I) 3/15/72 LS (I)

NAME ls -- list contents of directory

SYNOPSIS _s
l _ [ -
_l_t
_a_s
_d_ ] name1 ...

DESCRIPTION ls
_ _ lists the contents of one or more directories
under control of several options:

-l list in l
_ong format, giving i-number, mode,
owner, size in bytes, and time of last modi-
fication for each file. (see s_t
_a_t
_ for for-
mat of the mode)

-t sort by time modified (latest first) instead


of by name, as is normal

-a list all entries; usually those beginning


with "." are suppressed

-s give size in blocks for each entry

-d if argument is a directory, list only its


name, not its contents (mostly used with
"-l" to get status on directory)

If no argument is given, "." is listed. If an


argument is not a directory, its name is given.

FILES /etc/passwd to get user ID’s for ls -l

SEE ALSO stat(I)

DIAGNOSTICS "name nonexistent"; "name unreadable"; "name un-


statable."

BUGS --

- 1 -
M6 (I) 11/15/72 M6 (I)

NAME m6 -- general purpose macro processor

SYNOPSIS _6
m _ [ -
_d_ arg1 ] [ arg2 [ arg3 ] ]

DESCRIPTION m6
_ _ takes input from file arg2 (or standard input
if arg2 is missing) and places output on file
arg3 (or standard output). A working file of
definitions, "[Link]", is initialized from file
arg1 if that is supplied. M6 differs from the
standard [1] in these respects:

#trace:, #source: and #end: are not defined.

#meta,arg1,arg2: transfers the role of metachar-


acter arg1 to character arg2. If two metacharac-
ters become identical thereby, the outcome of
further processing is not guaranteed. For exam-
ple, to make []{} play the roles of #:<> type

\.br [meta,<:>,]:
[meta,[substr,<<>>,1,1;,{]
[meta,[substr,{{>>,2,1;,}]

#del,arg1: deletes the definition of macro arg1.

#save: and #rest: save and restore the definition


table together with the current metacharacters on
file [Link].

#def,arg1,arg2,arg3: works as in the standard


with the extension that an integer may be sup-
plied to arg3 to cause the new macro to perform
the action of a specified builtin before its re-
placement text is evaluated. Thus all builtins
except #def: can be retrieved even after dele-
tion. Codes for arg3 are:

0 - no function
1,2,3,4,5,6 - gt,eq,ge,lt,ne,le
7,8 - seq,sne
9,10,11,12,13 - add,sub,mpy,div,exp
20 - if
21,22 - def,copy
23 - meta
24 - size
25 - substr
26,27 - go,gobk
28 - del
29 - dnl
30,31 - save,rest

FILES [Link]--working file of definitions


/usr/lang/mdir/m6a--m6 processor proper
(/usr/bin/m6 is only an initializer)

- 1 -
M6 (I) 11/15/72 M6 (I)

/usr/lang/mdir/m6b--default initialization for


[Link]
/bin/cp--used for copying initial value of [Link]

SEE ALSO [1] A. D. Hall, The M6 Macroprocessor, Bell Tele-


phone Laboratories, 1969

DIAGNOSTICS "err" -- a bug, an unknown builtin or a bad defi-


nition table
"oprd"--can’t open input or initial definitions
"opwr"--can’t open output
"ova" -- overflow of nested arguments
"ovc" -- overflow of calls
"ovd" -- overflow of definitions
"Try again" -- no process available for copying
[Link]

BUGS Characters in internal tables are stored one per


word. They really should be packed to improve
capacity. For want of space (and because of un-
packed formats) no file arguments have been pro-
vided to #save: or #rest:, and no check is made
on the actual opening of file [Link]. Again to
save space, garbage collection makes calls on
#save: and #rest: and so overwrites [Link].

- 2 -
MAIL (I) 10/25/72 MAIL (I)

NAME mail -- send mail to another user

SYNOPSIS ma
_ _i
_l_ [ -
_y_n
_ ]
m_
_ a_
i_l letter person ...
_a
m _i
_l_ person

DESCRIPTION ma
_ _i
_l_ without an argument searches for a file
called m _a
_i_l
_b_o
_x_, prints it if present, and asks if
it should be saved. If the answer is "y", the
mail is renamed m _b
_o_x
_, otherwise it is deleted.
_a
M _i
_l_ with a - _y_n
_ argument works the same way, ex-
cept that the answer to the question is supplied
by the argument.

When followed by the names of a letter and one or


more people, the letter is appended to each per-
son’s m
_a_i
_l_b
_o_x
_. When a p_e
_r_s
_o_n
_ is specified with-
out a l
_e_t
_t_e
_r_, the letter is taken from the
sender’s standard input up to an EOT. Each let-
ter is preceded by the sender’s name and a post-
mark.

A p_e_r
_s_o
_n_ is either a user name recognized by lo-
__g
_i_n
_, in which case the mail is sent to the de-
fault working directory of that user, or the path
name of a directory, in which case m _a
_i_l
_b_o
_x_ in
that directory is used.

When a user logs in he is informed of the pres-


ence of mail.

FILES /etc/passwd to identify sender


to locate persons
mailbox input mail
mbox saved mail

SEE ALSO login(I)

DIAGNOSTICS "Who are you?" if the user cannot be identified


for some reason (a bug). "Cannot send to user"
if m
_a_i
_l_b
_o_x
_ cannot be opened.

BUGS --

- 1 -
MAN (I) 3/15/72 MAN (I)

NAME man -- run off section of UNIX manual

SYNOPSIS _a
m _n
_ title [ section ]

DESCRIPTION ma
_ _n
_ is a shell command file that will locate and
run off a particular section of this manual. Ti-
tle is the the desired part of the manual. Sec-
tion is the section number of the manual. (In
Arabic, not Roman numerals.) If section is miss-
ing, 1_ is assumed. For example,

man man

would reproduce this page.

FILES /sys/man/man?/*

SEE ALSO sh(I), roff(I)

DIAGNOSTICS "File not found", "Usage .."

BUGS --

- 1 -
MESG (I) 3/15/72 MESG (I)

NAME mesg -- permit or deny messages

SYNOPSIS _e
m _s
_g_ [ n
_ ][ y
_ ]

DESCRIPTION me
_ _s
_g_ n
_ forbids messages via w _r
_i_t
_e_ by revoking
non-user write permission on the user’s typewrit-
er. m _e_s
_g_ y
_ reinstates permission. m _e
_s_g
_ with no
argument reverses the current permission. In all
cases the previous state is reported.

FILES /dev/tty?

SEE ALSO write(I)

DIAGNOSTICS "?" if the standard input file is not a typewrit-


er

BUGS --

- 1 -
MKDIR (I) 3/15/72 MKDIR (I)

NAME mkdir -- make a directory

SYNOPSIS _k
m _d
_i_r
_ dirname ...

DESCRIPTION _k
m _d
_i_r
_ creates specified directories in mode 17.

The standard entries "." and ".." are made auto-


matically.

FILES --

SEE ALSO rmdir(I)

DIAGNOSTICS "dirname ?"

BUGS --

- 1 -
MT (I) 6/12/72 MT (I)

NAME mt -- manipulate magtape

SYNOPSIS _t
m _ [ key ] [ name ... ]

DESCRIPTION mt
_ _ saves and restores selected portions of the
file system hierarchy on magtape. Its actions
are controlled by the k_e
_y_ argument. The key is a
string of characters containing at most one func-
tion letter and possibly one or more function
modifiers. Other arguments to the command are
file or directory names specifying which files
are to be dumped, restored, or tabled.

The function portion of the key is specified by


one of the following letters:

r The indicated files and directories, to-


gether with all subdirectories, are dumped
onto the tape. The old contents of the
tape are lost.

x extracts the named files from the tape to


the file system. The owner, mode, and
date-modified are restored to what they
were when the file was dumped. If no file
argument is given, the entire contents of
the tape are extracted.

t lists the names of all files stored on the


tape which are the same as or are hierar-
chically below the file arguments. If no
file argument is given, the entire contents
of the tape are tabled.

l is the same as t
_ except that an expanded
listing is produced giving all the avail-
able information about the listed files.

The following characters may be used in addition


to the letter which selects the function desired.

0, ..., 7 This modifier selects the drive on


which the tape is mounted. "0" is the de-
fault.

v Normally m
_t_ does its work silently. The v
_
(verbose) option causes it to type the name
of each file it treats preceded by a letter
to indicate what is happening.

a file is being added


x file is being extracted

The v
_ option can be used with r
_ and x
_ only.

- 1 -
MT (I) 6/12/72 MT (I)

f causes new entries copied on tape to be


’fake’ in that only the entries, not the
data associated with the entries are updat-
ed. Such fake entries cannot be extracted.
Usable only with r
_.

w causes m_t
_ to pause before treating each
file, type the indicative letter and the
file name (as with v_) and await the user’s
response. Response "y" means "yes", so the
file is treated. Null response means "no",
and the file does not take part in whatever
is being done. Response "x" means "exit";
the m
_t_ command terminates immediately. In
the x
_ function, files previously asked
about have been extracted already. With r _,
no change has been made to the tape.

m make (create) directories during an x


_ if
necessary.

FILES /dev/mt?

SEE ALSO tap(I), tap(V)

DIAGNOSTICS Tape open error


Tape read error
Tape write error
Directory checksum
Directory overflow
Seek error
Tape overflow
Phase error (a file has changed after it was se-
lected for dumping but before it was dumped)

BUGS If, during an "x", the files are specified in a


different order than they are on the tape, seek
errors will result because the tape cannot be re-
wound.

- 2 -
MV (I) 2/9/73 MV (I)

NAME mv -- move or rename a file

SYNOPSIS _v
m _ name1 name2

DESCRIPTION mv
_ _ changes the name of name1 to name2. If name2
is a directory, name1 is moved to that directory
with its original file-name. Directories may on-
ly be moved within the same parent directory
(just renamed).

FILES --

SEE ALSO --

DIAGNOSTICS yes

BUGS --

- 1 -
NM (I) 3/15/72 NM (I)

NAME nm -- print name list

SYNOPSIS _m
n _ [ name ]

DESCRIPTION nm
_ _ prints the symbol table from the output file
of an assembler or loader run. Each symbol name
is preceded by its value (blanks if undefined)
and one of the letters "U" (undefined) "A" (abso-
lute) "T" (text segment symbol), "D" (data seg-
ment symbol), or "B" (bss segment symbol). Glob-
al symbols have their first character underlined.
The output is sorted alphabetically.

If no file is given, the symbols in a


_._o
_u_t
_ are
listed.

FILES [Link]

SEE ALSO as(I), ld(I)

DIAGNOSTICS "?"

BUGS --

- 1 -
NROFF (I) 1/15/73 NROFF (I)

NAME nroff -- format text

SYNOPSIS _r
n _o
_f_f
_ [+
_N] [-
_s_] [-
_h_] [-
_q_] [-
_i_] files

DESCRIPTION nr
_ _o
_f_f
_ formats text according to control lines em-
bedded in the text files. The non-file option
arguments are interpreted as follows:

+N Output will commence at the first page


whose page number is N (independent of
whether or not the page number is being
printed).

-s Stop between pages. Printing will halt pri-


or to each page (including the first) to
permit paper loading and changing. Printing
is restarted by typing either a "newline"
or "delete" character.

-h High-speed output. During output, strings


of space characters are replaced where pos-
sible with tab characters to speed up out-
put. Futhermore, if the output is directed
into a file or a pipe, this mode effective-
ly reduces the total number of characters
in the file or pipe; this is especially im-
portant in multi-column output where the
temporary file(s) or pipe(s) would other-
wise contain a large number of space char-
acters.

-q The prompt names for insertions are not


printed and the bell character is sent in-
stead; in addition, the insertion is not
echoed. This mode permits insertions during
the actual output printing

-i Index mode. NROFF creates a file called


"index" containing every word output to-
gether with the line and page number. The
format is word, tab, page, tab, line, new-
line, etc. Invoking this mode slows down
the execution of NROFF considerably.

Nroff is more completely described in [1]. A


condensed Request Summary is included here.

FILES /etc/suftab suffix hyphenation tables


/tmp/rtm? temporary

SEE ALSO [1] NROFF User’s Manual (available as


MM-73-1271-2).

DIAGNOSTICS none

- 1 -
NROFF (I) 1/15/73 NROFF (I)

BUGS -

- 2 -
NROFF (I) 1/15/73 NROFF (I)

REQUEST REFERENCE AND INDEX

Request Initial If no Cause


_o
F _r
_m_ _a
V _l
_u_e
_ _r
A _g
_u_m
_e_n
_t_ B
_r_e
_a_k
_ _
Ex_p
_l_a
_n_a
_t_i
_o_n
_

I. _a
P _g
_e_ C
_o_n
_t_r
_o_l
_

.pl +N
_ N=66 N=66 no Page L
_ _ength.
.bp _N
+ N=1 - yes _egin P
B _age.
.pn _N
+ N=1 ignored no _age N
P _umber.
.po _N
+ N=0 N=prev no _age O
P _ffset.
.ne N - N=1 no _E
N _ed N lines.

II. _e
T _x
_t_ F
_i_l
_l_i
_n_g
_, A
_d_j
_u_s
_t_i
_n_g
_, a
_n_d
_ C
_e_n
_t_e
_r_i
_n_g
_

.br - - yes BR
_ _eak.
.fi fill - yes _I
F _ll output lines.
.nf fill - yes _oF
N _ill.
.ad c adj,norm adjust no _D
A _just mode on.
.na adjust - no _oA
N _djust.
.ce N off N=1 yes _E
C _nter N input text lines.

III. _i
L _n
_e_ S
_p_a
_c_i
_n_g
_ a
_n_d
_ B
_l_a
_n_k
_ L
_i_n
_e_s
_

.ls +N
_ N=1 N=prev no Line S
_ _pacing.
.sp N - N=1 yes _P
S _ace N lines
.lv N - N=1 no OR-
.sv N - N=1 no _aV
S _e N lines.
.os - - no _utput S
O _aved lines.
.ns space - no _o-S
N _pace mode on.
.rs - - no _estore S
R _pacing.
.xh off - no EX_tra-H
_alf-line mode on.

IV. _i
L _n
_e_ L
_e_n
_g_t
_h_ a
_n_d
_ I
_n_d
_e_n
_t_i
_n_g
_

.ll _
+N N=65 N=prev no Line L
_ _ength.
.in +
_N N=0 N=prev yes _N
I _dent.
.ti +
_N - N=1 yes _emporary I
T _ndent.

V. _a
M _c
_r_o
_s_, D
_i_v
_e_r
_s_i
_o_n
_, a
_n_d
_ L
_i_n
_e_ T
_r_a
_p_s
_

.de xx - ignored no DE
_ _fine or redefine a macro.
.rm xx - - no _eM
R _ove macro name.
.di xx - end no _I
D _vert output to macro "xx".
.wh _N
- xx - no _H
W _en; set a line trap.
.ch _N
- _M
- - no OR-
.ch xx _M
- - no OR-
.ch _N
- y - no OR-
.ch xx y - no _H
C _ange trap line.

VI. _u
N _m
_b_e
_r_ R
_e_g
_i_s
_t_e
_r_s
_

.nr a +
_N -_M - no OR-
.nr ab +_N -
_M - no _umber R
N _egister.

.tl ’’- % -’’


.tl ’NROFF (I)’1/15/73’NROFF (I)’

.nc c \n \n no Number C
_ _haracter.
.ar arabic - no Arabic numbers.
.ro arabic - no Roman numbers.
.RO arabic - no ROMAN numbers.

VII. _n
I _p
_u_t
_ a
_n_d
_ O
_u_t
_p_u
_t_ C
_o_n
_v_e
_n_t
_i_o
_n_s
_ a
_n_d
_ C
_h_a
_r_a
_c_t
_e_r
_ T
_r_a
_n_s
_l_a
_t_i
_o_n
_s_

.ta N,M,... none no PseudoT_A


_bs setting.
.tc c space space no _ab replacement C
T _haracter.
.lc c . . no _eader replacement C
L _haracter.
.ul N - N=1 no _N
U _derline input text lines.
.cc c . . no Basic C_ontrol C
_haracter.
.c2 c ’ ’ no Nobreak control character.
.li N - N=1 no Accept input lines L _I
_terally.
.tr abcd.... - no _R
T _anslate on output.

VIII. _y
H _p
_h_e
_n_a
_t_i
_o_n
_.

.nh on - no No H
_ _yphen.
.hy on - no _Y
H _phenate.
.hc c none none no _yphenation indicator C
H _haracter.

IX. _h
T _r
_e_e
_ P
_a_r
_t_ T
_i_t
_l_e
_s_.

.tl ’left’center’right’ no TitL


_ _e.
.lt N N=65 N=prev no _ength of T
L _itle.

X. _u
O _t
_p_u
_t_ L
_i_n
_e_ N
_u_m
_b_e
_r_i
_n_g
_.

.nm _
+N M S I off no Number _
_ Mode on or off, set parameters.
.np M S I reset no _umber P
N _arameters set or reset.

XI. _o
C _n
_d_i
_t_i
_o_n
_a_l
_ I
_n_p
_u_t
_ L
_i_n
_e_ A
_c_c
_e_p
_t_a
_n_c
_e_

.if c anything - no OR-


.if !c anything - no OR-
.if N anything - no OR-
.if !N anything - no _F
I _ true accept line of "anything".

XII. _n
E _v
_i_r
_o_n
_m_e
_n_t
_ S
_w_i
_t_c
_h_i
_n_g
_.

.ev N N=0 N=prev no _nV


E _ironment switched.

XIII. _n
I _s
_e_r
_t_i
_o_n
_s_ f
_r_o
_m_ t
_h_e
_ S
_t_a
_n_d
_a_r
_d_ I
_n_p
_u_t
_ S
_t_r
_e_a
_m_

.rd prompt bell no ReaD


_ _ insert.
.ex - - no _X
E _it.

XIV. _n
I _p
_u_t
_ F
_i_l
_e_ S
_w_i
_t_c
_h_i
_n_g
_

.so filename - no Switch S


_O_urce file (push down).
.nx filename - no _eX
N _t file.
.sp
XV. M_i
_s_c
_e_l
_l__
an_e
_o_u
_s_

.tl ’’- % -’’


.tl ’NROFF (I)’1/15/73’NROFF (I)’

.ig - - no IG
_ _nore.
.fl - - no _L
F _ush output buffer.
.ab - - no _B
A _ort.

- 5 -
OD (I) 1/15/73 OD (I)

NAME od -- octal dump

SYNOPSIS _d
o _ [ -
_a_b
_c_d
_h_o
_ ] [ file ] [ [+
_]offset[.
_][b
_] ]

DESCRIPTION od
_ _ dumps f
_i_l
_e_ in one or more formats as selected
by the first argument. (If the first argument is
missing, -_o_ is default.) The meanings of the
format argument characters are:

_ interprets words as PDP-11 instructions and


a
dis-assembles the operation code. Unknown
operation codes print as ???.

_ interprets bytes in octal.


b

_ interprets bytes in ascii. Unknown ascii


c
characters are printed as \?.

_ interprets words in decimal.


d

_ interprets words in hex.


h

_ interprets words in octal.


o

The file argument specifies which file is to be


dumped. If no file argument is specified, the
standard input is used. Thus od can be used as a
filter.

The offset argument specifies the offset in the


file where dumping is to commence. This argument
is normally interpreted as octal bytes. If ’.’
is appended, the offset is interpreted in deci-
mal. If ’b’ is appended, the offset is inter-
preted in blocks. (A block is 512 bytes.) If
the file argument is omitted, the offset argument
must be preceded by ’+’.

Dumping continues until an end-of-file condition


or until halted by sending an interrupt signal.

FILES --

SEE ALSO db(I)

DIAGNOSTICS --

BUGS --

- 1 -
OPR (I) 1/15/73 OPR (I)

NAME opr -- off line print

SYNOPSIS _p
o _r
_ [-
_-_] [-
_] [+
_] [+
_-_]file918 ...

DESCRIPTION op
_ _r
_ will arrange to have the 201 data phone dae-
mon submit a job to the Honeywell 6070 to print
the file arguments. Normally, the output appears
at the GCOS central site. If the first argument
is - _-
_, the output is remoted to station R1.
(Station R1 has a 1403 printer.)

Normally, each file is printed in the state it is


found when the data phone daemon reads it. If a
particular file argument is preceded by +_, or a
preceding argument of +_ has been encountered,
then o
_p_r
_ will make a copy for the daemon to
print. If the file argument is preceded by - _, or
a preceding argument of -_ has been encountered,
then opr will unlink (remove) the file.

If there are no arguments except for the optional


_-
- _, then the standard input is read and off-line
printed. Thus o _p
_r_ may be used as a filter.

FILES /usr/dpd/* spool area


/etc/passwd personal ident cards
/etc/dpd daemon

SEE ALSO dpd(I), passwd(V)

DIAGNOSTICS --

BUGS --

- 1 -
OV (I) 6/12/72 OV (I)

NAME ov -- overlay pages

SYNOPSIS _v
o _ [ file ]

DESCRIPTION ov
_ _ is a postprocessor for producing double column
formatted text when using nroff(I). o _v
_ literally
overlays successive pairs of 66-line pages.

If the file argument is missing, the standard in-


put is used. Thus o_v
_ may be used as a filter.

FILES none

SEE ALSO nroff(I), pr(I)

DIAGNOSTICS none

BUGS Other page lengths should be permitted.

- 1 -
PASSWD (I) 9/1/72 PASSWD (I)

NAME passwd -- set login password

SYNOPSIS _a
p _s
_s_w
_d_ name password

DESCRIPTION The password is placed on the given login name.


This can only be done by the user ID correspond-
ing to the login name or by the super-user. An
explicit null argument ("") for the password ar-
gument will remove any password from the login
name.

FILES /etc/passwd

SEE ALSO login(I), passwd(V), crypt(III)

DIAGNOSTICS Diagnostics are given for a non-match of the lo-


gin name, lack of permission and for password
file format errors.

BUGS --

- 1 -
PR (I) 1/15/73 PR (I)

NAME pr -- print file

SYNOPSIS _r
p _ [-
_c_m
_] [-
_h_ name] [-
_n] [+
_n] [file918 ...]

DESCRIPTION pr
_ _ produces a printed listing of one or more
files. The output is separated into pages headed
by a date, the name of the file or a header (if
any), and the page number. If there are no file
arguments, p_r
_ prints the standard input file, and
is thus usable as a filter.

Options apply to all following files but may be


reset between files:

-c
_ _ print current date
_m
- _ print date file last modified (default)

_n produce n-column output


-

_n begin printing with page n


+

_h
- _ treats the next argument as a header

If there is a header in force, it is printed in


place of the file name.

Interconsole messages via w


_r_i
_t_e
_(I) are forbidden
during a p
_r_.

FILES /dev/tty? to suspend messages.

SEE ALSO cat(I), cp(I)

DIAGNOSTICS none (files not found are ignored)

BUGS In multi-column output, non-printing characters


other than new-line cause misalignment.

- 1 -
PROOF (I) 1/15/73 PROOF (I)

NAME proof -- compare two text files

SYNOPSIS _r
p _o
_o_f
_ oldfile newfile

DESCRIPTION pr
_ _o
_o_f
_ lists those lines of _ n_
e_w_
f_i_
l_e that differ
from corresponding lines in _ o_l_
d_f_
i_l_
e_. The line
number in _ n_
e_w_
f_i_
l_e is given. When changes, inser-
tions or deletions have been made the program at-
tempts to resynchronize the text in the two files
by finding a sequence of lines in both files that
again agree.

FILES --

SEE ALSO cmp(I)

DIAGNOSTICS yes, but they are undecipherable, e.g. "?1".

BUGS pr
_ _o
_o_f
_ is still evolving. Any bugs discovered or
suggestions should be brought to ENP.

- 1 -
RELOC (I) 2/7/73 RELOC (I)

NAME reloc -- relocate object files

SYNOPSIS _e
r _l
_o_c
_ file [-
_]octal [ -
_ ]

DESCRIPTION re
_ _l
_o_c
_ modifies the named object program file so
that it will operate correctly at a different
core origin than the one for which it was assem-
bled or loaded.

The new core origin is the old origin increased


by the given o
_c_t
_a_l
_ number (or decreased if the
number has a "-" sign).

If the object file was generated by the link-edi-


tor l
_d_, the "-r" l
_d_ option must have been given
to preserve the relocation information in the
file.

If the optional last argument is given, then any


"setd" instruction at the start of the file will
be replaced by a no-op.

The purpose of this command is to simplify the


preparation of object programs for systems which
have no relocation hardware. It is hard to imag-
ine a situation in which it would be useful to
attempt directly to execute a program treated by
_e
r _l
_o_c
_.

FILES --

SEE ALSO as(I), ld(I), [Link](V)

DIAGNOSTICS As appropriate

BUGS --

- 1 -
REW (I) 1/15/73 REW (I)

NAME rew -- rewind tape

SYNOPSIS _e
r _w
_ [ [m
_]digit ]

DESCRIPTION re
_ _w
_ rewinds DECtape or magtape drives. The digit
is the logical tape number, and should range from
0 to 7. If the digit is preceded by ’m’, r_e
_w_ ap-
plies to magtape rather than DECtape. A missing
digit indicates drive 0.

FILES /dev/tap?
/dev/mt?

SEE ALSO --

DIAGNOSTICS "?" if there is no tape mounted on the indicated


drive or if the file cannot be opened.

BUGS --

- 1 -
RM (I) 1/20/73 RM (I)

NAME rm -- remove (unlink) files

SYNOPSIS _m
r _ [ -
_f_ ] [ -
_r_ ] name1 ...

DESCRIPTION rm
_ _ removes the entries for one or more files from
a directory. If an entry was the last link to
the file, the file is destroyed. Removal of a
file requires write permission in its directory,
but neither read nor write permission on the file
itself.

If there is no write permission to a file desig-


nated to be removed, r_m
_ will print the file name,
its mode and then read a line from the standard
input. If the line begins with ’y’, the file is
removed, otherwise it is not. The optional argu-
ment -
_f_ prevents the above interaction.

If a designated file is a directory, an error


comment is printed unless the optional argument
_r
- _ has been used. In that case, r
_m_ recursively
deletes the entire contents of the specified di-
rectory. To remove directories per se see
rmdir(I).

FILES /etc/glob to implement -


_r_ flag

SEE ALSO rmdir(I)

DIAGNOSTICS "name: non existent"


"name: not removed" if cannot remove
"name: try again" error from fork

BUGS When r_m


_ removes the contents of a directory under
the -
_r_ flag, full pathnames are not printed in
diagnostics.

- 1 -
RMDIR (I) 3/15/72 RMDIR (I)

NAME rmdir -- remove directory

SYNOPSIS _m
r _d
_i_r
_ dir1 ...

DESCRIPTION rm
_ _d
_i_r
_ removes (deletes) directories. The direc-
tory must be empty (except for the standard en-
tries "." and "..", which r _m
_d_i
_r_ itself removes).
Write permission is required in the directory in
which the directory appears.

FILES none

SEE ALSO --

DIAGNOSTICS "dir?" is printed if directory d_i


_r_ cannot be
found, is not a directory, or is not removable.

"dir -- directory not empty" is printed if d


_i_r
_
has entries other than "." or "..".

BUGS --

- 1 -
ROFF (I) 6/12/72 ROFF (I)

NAME roff -- format text

SYNOPSIS _o
r _f
_f_ [ +
_number ] [ -
_s_ ] [ -
_h_ ] file1 ...

DESCRIPTION ro
_ _f
_f_ formats text according to control lines em-
bedded in the text in file918, ... . Encounter-
ing a nonexistent file terminates printing. The
optional argument "+ _number" causes printing to
begin at the first page with that number. The
optional argument "- _s
_" causes printing to stop
before each page including the first to allow pa-
per manipulation; printing is resumed upon re-
ceipt of an interrupt signal. The optional argu-
ment "-h" causes the output to contain horizontal
tabs for two or more spaces that end on a tab
stop. An interrupt signal received during print-
ing terminates all printing. Incoming intercon-
sole messages are turned off during printing, and
the original message acceptance state is restored
upon termination.

At the present time, there is no document de-


scribing ROFF in full. A Request Summary is at-
tached.

FILES /etc/suftab suffix hyphenation tables


/tmp/rtm? temporary

SEE ALSO --

DIAGNOSTICS none

BUGS -

- 1 -
ROFF (I) 6/12/72 ROFF (I)

REQUEST SUMMARY

R_
_ e_
q_u_
e_s_
t _
B_r_
e_a_
k I_
_ n_
i_t_
i_a_
l _
M_e_
a_n_
i_n_
g

.ad yes yes Begin adjusting right margins.


.ar no arabic Arabic page numbers.
.br yes - Causes a line break - thoa filling of the
current line is stopped.
.bl n yes - Insert contiguous block of n blank lines.
If necessary, a new page will be started
to accomodate the entire block.
.bp +n yes n=1 Begin new page and number it n. If n is
not given, normal sequencing occurs.
.cc c no c=. Control character becomes ‘c’.
.ce n yes - Center the next n input lines, without
filling.
.de xx no - Define macro named "xx" (definition ends
with a line beginning with "..").
.ds yes no Double space; same as ".ls 2".
.ef t no t=’’’’ Even foot title becomes t.
.eh t no t=’’’’ Even head title becomes t.
.fi yes yes Begin filling output lines.
.fo no t=’’’’ All foot titles are t.
.hc c no none Hyphenation character set to ‘c’.
.he t no t=’’’’ All head titles are t.
.hx no - Title lines are suppressed.
.hy n no n=1 Hyphenation is done, if n=1; and is not
done, if n=0.
.ig no - Ignore input lines until and including a
line beginning with "..".
.in +n yes - Indent n spaces from left margin.
.ix +n no - Same as ".in" but without break.
.li n no - Literal, treat next n lines as text.
.ll +n no n=65 Line length including indent is n charac-
ters.
.ls +n yes n=1 Line spacing set to n lines per output
line.
.m1 n no n=2 n blank lines are put between the top of
a new page and the head title.
.m2 n no n=2 n blanks lines put between head title and
beginning of text on page.
.m3 n no n=1 n blank lines put between the end of text
and the foot title.
.m4 n no n=3 n blank lines put between the foot title
and the bottom of page.
.na yes no Stop adjusting the right margin.
.ne n no - Begin new page, if n output lines cannot
fit on present page.
.nn +n no - The next n output lines are not numbered.
.n1 no no Output lines are numbered sequentially
beginning with 1 on each new page. Head
and foot titles are not numbered.
.n2 no no Output lines are numbered sequentially

- 2 -
ROFF (I) 6/12/72 ROFF (I)

beginning with 1 on the next output line.


.ni +n no n=0 Line numbers are indented n.
.nf yes no Stop filling output lines.
.nx filename - Change to input file "filename".
.of t no t=’’’’ Odd foot title becomes t.
.oh t no t=’’’’ Odd head title becomes t.
.pa +n yes n=1 Same as ".bp".
.pl +n no n=66 Total paper length taken to be n lines.
.po +n no n=0 Page offset. All lines are preceded by N
spaces.
.ro no arabic Roman page numbers.
.sk n no - n pages with head and foot titles but
otherwise blank will be output beginning
with the next page containing text.
.sp n yes - Insert block of n blank lines. If the
bottom of a page is reached, remaining
lines are n
_o_t
_ put on next page.
.ss yes yes Single space output lines, equivalent to
".ls 1".
.ta N M ... - Pseudotab settings. Initial tab settings
are columns 9,17,25,...
.tc c no c=" " Tab replacement character becomes "c".
.ti +n yes - Temporarily indent next output line n
spaces.
.tr abcd.. no - Translate a into b, c into d, etc.
.ul n no - Underline the letters and numbers on the
next n input lines.

- 3 -
SH (I) 1/15/73 SH (I)

NAME sh -- shell (command interpreter)

SYNOPSIS _h
s _ [ name [ arg1 ... [ arg9 ] ] ]

DESCRIPTION
_h
s _ is the standard command interpreter. It is the pro-
gram which reads and arranges the execution of the com-
mand lines typed by most users. It may itself be called
as a command to interpret files of commands. Before dis-
cussing the arguments to the shell used as a command, the
structure of command lines themselves will be given.

C_
_ o_
m_m_
a_n_
d _
l_i_
n_e_
s

Command lines are sequences of commands separated by com-


mand delimiters. Each command is a sequence of non-blank
command arguments separated by blanks. The first argu-
ment specifies the name of a command to be executed. Ex-
cept for certain types of special arguments discussed be-
low, the arguments other than the command name are passed
without interpretation to the invoked command.

If the first argument is the name of an executable file,


it is invoked; otherwise the string "/bin/" is prepended
to the argument. (In this way most standard commands,
which reside in "/bin", are found.) If no such command
is found, the string "/usr" is further prepended (to give
"/usr/bin/command") and another attempt is made to exe-
cute the resulting file. (Certain "overflow" commands
live in "/usr/bin".) If the "/usr/bin" file exists, but
is not executable, it is used by the shell as a command
file. That is to say it is executed as though it were
typed from the console. If all attempts fail, a diagnos-
tic is printed.

The remaining non-special arguments are simply passed to


the command without further interpretation by the shell.

C_
_ o_
m_m_
a_n_
d _
d_e_
l_i_
m_i_
t_e_
r_s

There are three command delimiters: the new-line, ";",


and "&". The semicolon ";" specifies sequential execu-
tion of the commands so separated; that is,

coma; comb

causes the execution first of command c


_o_m
_a_, then of c
_o_m
_b_.
The ampersand "&" causes simultaneous execution:

coma & comb

causes c
_o_m
_a_ to be called, followed immediately by c _o
_m_b
_
without waiting for c _o
_m_a
_ to finish. Thus c
_o_m
_a_ and c
_o_m
_b_
execute simultaneously. As a special case,

- 1 -
SH (I) 1/15/73 SH (I)

coma &

causes c
_o_m
_a_ to be executed and the shell immediately to
request another command without waiting for c _o
_m_a
_.

T_
_ e_
r_m_
i_n_
a_t_
i_o_
n _
R_e_
p_o_
r_t_
i_n_
g

If a command (not followed by "&") terminates abnormally,


a message is printed. (All terminations other than exit
and interrupt are considered abnormal.) The following is
a list of the abnormal termination messages:

Bus error Trace/BPT trap Illegal


instruction IOT trap Power fail trap
EMT trap Bad system call Quit
PIR trap Floating exception Memo-
ry violation Killed User I/O Er-
ror

If a core image is produced, " -- Core dumped" is append-


ed to the appropriate message.

R_
_ e_
d_i_
r_e_
c_t_
i_o_
n _
o_f _
I_/_
O

Three character sequences cause the immediately following


string to be interpreted as a special argument to the
shell itself, not passed to the command.

An argument of the form "<arg" causes the file a


_r_g
_ to be
used as the standard input file of the given command.

An argument of the form ">arg" causes file "arg" to be


used as the standard output file for the given command.
"Arg" is created if it did not exist, and in any case is
truncated at the outset.

An argument of the form ">>arg" causes file "arg" to be


used as the standard output for the given command. If
"arg" did not exist, it is created; if it did exist, the
command output is appended to the file.

P_
_ i_
p_e_
s _
a_n_
d _
F_i_
l_t_
e_r_
s

A p
_i_p
_e_ is a channel such that information can be written
into one end of the pipe by one program, and read at the
other end by another program. (See p _i
_p_e
_ (II)). A f
_i_l
_t_e
_r_
is a program which reads the standard input file, per-
forms some transformation, and writes the result on the
standard output file. By extending the syntax used for
redirection of I/O, a command line can specify that the
output produced by a command be passed via a pipe through
another command which acts as a filter. For example:

command >filter>

- 2 -
SH (I) 1/15/73 SH (I)

More generally, special arguments of the form

>f1>f2>...>

specify that output is to be passed successively through


the filters f1, f2, ..., and end up on the standard out-
put stream. By saying instead

>f1>f2>...>file

the output finally ends up in f


_i_l
_e_. (The last ">" could
also have been a ">>" to specify concatenation onto the
end of f
_i_l
_e_.)

In exactly analogous manner input filtering can be speci-


fied via one of

<f1<f2<...< <f1<f2<...<file

Both input and output filtering can be specified in the


same command, though not in the same special argument.

For example:

ls >pr>

produces a listing of the current directory with page


headings, while

ls >pr>xx

puts the paginated listing into the file xx.

If any of the filters needs arguments, quotes can be used


to prevent the required blank characters from violating
the blankless syntax of filters. For example:

ls >"pr -h ’My directory’">

uses quotes twice, once to protect the entire p


_r_ command,
once to protect the heading argument of p
_r_. (Quotes are
discussed fully below.)

G_
_ e_
n_e_
r_a_
t_i_
o_n _
o_f _
a_r_
g_u_
m_e_
n_t _
l_i_
s_t_
s

If any argument contains any of the characters "?", "*"


or ’[’, it is treated specially as follows. The current
directory is searched for files which m
_a_t
_c_h
_ the given ar-
gument.

The character "*" in an argument matches any string of


characters in a file name (including the null string).

The character "?" matches any single character in a file

- 3 -
SH (I) 1/15/73 SH (I)

name.

Square brackets "[...]" specify a class of characters


which matches any single file-name character in the
class. Within the brackets, each ordinary character is
taken to be a member of the class. A pair of characters
separated by "-" places in the class each character lexi-
cally greater than or equal to the first and less than or
equal to the second member of the pair.

Other characters match only the same character in the


file name.

For example, "*" matches all file names; "?" matches all
one-character file names; "[ab]*.s" matches all file
names beginning with "a" or "b" and ending with ".s";
"?[zi-m]" matches all two-character file names ending
with "z" or the letters "i" through "m".

If the argument with "*" or "?" also contains a "/", a


slightly different procedure is used: instead of the
current directory, the directory used is the one obtained
by taking the argument up to the last "/" before a "*" or
"?". The matching process matches the remainder of the
argument after this "/" against the files in the derived
directory. For example: "/usr/dmr/a*.s" matches all
files in directory "/usr/dmr" which begin with "a" and
end with ".s".

In any event, a list of names is obtained which match the


argument. This list is sorted into alphabetical order,
and the resulting sequence of arguments replaces the sin-
gle argument containing the "*", "[", or "?". The same
process is carried out for each argument (the resulting
lists are n
_o_t
_ merged) and finally the command is called
with the resulting list of arguments.

For example: directory /usr/dmr contains the files a1.s,


a2.s, ..., a9.s. From any directory, the command

as /usr/dmr/a?.s

calls a
_s_ with arguments /usr/dmr/a1.s, /usr/dmr/a2.s, ...
/usr/dmr/a9.s in that order.

Q_
_ u_
o_t_
i_n_
g

The character "\" causes the immediately following char-


acter to lose any special meaning it may have to the
shell; in this way "<", ">", and other characters mean-
ingful to the shell may be passed as part of arguments.
A special case of this feature allows the continuation of
commands onto more than one line: a new-line preceded by

- 4 -
SH (I) 1/15/73 SH (I)

"\" is translated into a blank.

Sequences of characters enclosed in double (") or single


(’) quotes are also taken literally.

A_
_ r_
g_u_
m_e_
n_t _
p_a_
s_s_
i_n_
g

When the shell is invoked as a command, it has additional


string processing capabilities. Recall that the form in
which the shell is invoked is

sh [ name [ arg1 ... [ arg9 ] ] ]

The n
_a_m
_e_ is the name of a file which will be read and in-
terpreted. If not given, this subinstance of the shell
will continue to read the standard input file.

In command lines in the file (not in command input),


character sequences of the form "$n", where n
_ is a digit
0, ..., 9, are replaced by the n
_th argument to the invo-
cation of the shell (argn). "$0" is replaced by n_a
_m_e
_.

E_
_ n_
d _
o_f _
f_i_
l_e

An end-of-file in the shell’s input causes it to exit. A


side effect of this fact means that the way to log out
from UNIX is to type an end of file.

S_
_ p_
e_c_
i_a_
l _
c_o_
m_m_
a_n_
d_s

Two commands are treated specially by the shell.

"Chdir" is done without spawning a new process by execut-


ing the s
_y__
s c
_h_d
_i_r
_ primitive.

"Login" is done by executing /bin/login without creating


a new process.

These peculiarities are inexorably imposed upon the shell


by the basic structure of the UNIX process control sys-
tem. It is a rewarding exercise to work out why.

C_
_ o_
m_m_
a_n_
d _
f_i_
l_e _
e_r_
r_o_
r_s_
; _
i_n_
t_e_
r_r_
u_p_
t_s

Any shell-detected error, or an interrupt signal, during


the execution of a command file causes the shell to cease
execution of that file.

FILES /etc/glob, which interprets "*", "?", and "[".

SEE ALSO "The UNIX Time-sharing System", which gives the


theory of operation of the shell.

DIAGNOSTICS

- 5 -
SH (I) 1/15/73 SH (I)

"Input not found", when a command file is specified which


cannot be read;
"Arg count", if the number of arguments to the chdir
pseudo-command is not exactly 1, or if "*", "?", or "["
is used inappropriately;
"Bad directory", if the directory given in "chdir" cannot
be switched to;
"Try again", if no new process can be created to execute
the specified command;
""’ imbalance", if single or double quotes are not
matched;
"Input file", if an argument after "<" cannot be read;
"Output file", if an argument after ">" or ">>" cannot be
written (or created);
"Command not found", if the specified command cannot be
executed.
"No match", if no arguments are generated for a command
which contains "*", "?", or "[".
Termination messages described above.

BUGS If any argument contains a quoted "*", "?", or


"[", then all instances of these characters must
be quoted. This is because s_h
_ calls the g
_l_o
_b_
routine whenever an unquoted "*", "?", or "[" is
noticed; the fact that other instances of these
characters occurred quoted is not noticed by
_l
g _o
_b_.

When output is redirected, particularly through a


filter, diagnostics tend to be sent down the pipe
and are sometimes lost altogether.

- 6 -
SIZE (I) 9/2/72 SIZE (I)

NAME size -- size of an object file

SYNOPSIS _i
s _z
_e_ [ object ... ]

DESCRIPTION The size, in bytes, of the object files are


printed. If no file is given, a_.
_o_u
_t_ is default.
The size is printed in octal for the text, data,
and bss portions of each file. The sum of these
is also printed in octal and decimal.

FILES [Link] default

SEE ALSO --

DIAGNOSTICS "object not found" if the input cannot be read.


"bad format: object" if the input file does not
have a valid object header.

BUGS --

- 1 -
SNO (I) 2/9/73 SNO (I)

NAME sno -- SNOBOL interpreter

SYNOPSIS _n
s _o
_ [ file ]

DESCRIPTION sn
_ _o
_ is a SNOBOL III (with slight differences)
compiler and interpreter. s _n
_o_ obtains input from
the concatenation of f_i
_l_e
_ and the standard input.
All input through a statement containing the la-
bel ’end’ is considered program and is compiled.
The rest is available to ’syspit’.

The following is a list of differences between


_n
s _o
_ and SNOBOL III:

There are no unanchored searches. To get the


same effect:

a ** b unanchored search for b


a *x* b = x c unanchored assignment

No back referencing

x = "abc"
a *x* x unanchored search for "abc"

Different function declaration. The function


declaration is done at compile time by the use
of the label ’define’. Thus there is no abil-
ity to define functions at run time and the
use of the name ’define’ is preempted. There
is also no provision for ’automatic’ variables
other than the parameters.

define f()
or
define f(a,b,c)

All labels except ’define’ (even ’end’) must


have a non-empty statement.

If ’start’ is a label in the program, program


execution will start there. If not, execution
begins with the first executable statement.
(’define’ is not an executable statement)

There are no builtin functions

Variable length patterns at the end of a pat-


tern match are not treated specially. They
still match the shortest rather than longest
text.

Parentheses for arithmetic are not needed.


Normal (eg FORTRAN) precedence applies. Be-

- 1 -
SNO (I) 2/9/73 SNO (I)

cause of this, the arithmetic operators ’/’


and ’*’ must be set off by space.

The right side of assignments must be non-emp-


ty.

Either ’ or " may be used for literal quotes.

The pseudo-variable ’sysppt’ is not available.

FILES --

SEE ALSO SNOBOL III manual. (J


_A_C
_M_; Vol. 11 No. 1; Jan
1964; pp 21)

DIAGNOSTICS As appropriate

BUGS Runtime diagnostics give the last program line


number rather than the executing statement line
number.

- 2 -
SORT (I) 9/2/72 SORT (I)

NAME sort -- sort a file

SYNOPSIS _o
s _r
_t_ [ -
_ ] [ input [ output ] ]

DESCRIPTION so
_ _r
_t_ will sort the input file and write the sort-
ed file on the output file. If the output file
is not given, the input file is rewritten. If
the input file is missing, sort uses the standard
input as input and the standard output for out-
put. Thus s _o
_r_t
_ may be used as a filter.

The sort is line-by-line in increasing ASCII col-


lating sequence, except that upper-case letters
are considered the same as the lower-case let-
ters.

The optional argument -


_ will cause a reverse
sort.

_o
s _r
_t_ is implemented in such a way that

sort /dev/mt0

works correctly provided the tape is not too big.

FILES /tmp/stm?

SEE ALSO --

DIAGNOSTICS --

BUGS The largest file that can be sorted is about 128K


bytes.

- 1 -
SPEAK (I) 2/1/73 SPEAK (I)

NAME speak -- word to voice translator

SYNOPSIS _p
s _e
_a_k
_ [ -
_ ] [ vocabulary ]

DESCRIPTION sp
_ _e
_a_k
_ turns a stream of ascii words into utter-
ances and outputs them to a voice synthesizer.
It has facilities for maintaining a vocabulary.
It receives, from the standard input

- working lines - text of words separated by


blanks
- phonetic lines - strings of phonemes for one
word preceded and separated by commas. The
phonetic code is given in v
_s_p
_(VII).
- empty lines
- command lines - beginning with !_. The follow-
ing forms are recognized:

!r
_ _ file replace coded vocabulary from file
_w
! _ file write coded vocabulary on file
_p
! _ print phonetics for working word
_l
! _ list vocabulary on standard output
with phonetics
_c
! _ word copy phonetics from working word to
specified word
_s
! _ file (save) append working word and phonet-
ics to file in style of !
_l_

Each working line replaces its predecessor. Its


first word is the "working word". Each phonetic
line replaces the phonetics stored for the work-
ing word. Each working line, phonetic line or
empty line causes the working line to be uttered.
The process terminates at the end of input.

Unknown words are spelled as strings of one-let-


ter words. Unknown one-letter words burp.

A phonetic line of comma only will delete the en-


try for the working word.

sp
_ _e
_a_k
_ is initialized with a coded vocabulary
stored in file _ /_
e_t_
c_/_
s_p_
e_a_
k_._
m_. The vocabulary op-
tion substitutes a different file for s _p
_e_a
_k_.
_m_.

The -
_ option suppresses all utterances.

FILES /etc/speak.m

SEE ALSO vsp(VII), speakm(V), vt(IV)

BUGS Vocabulary overflow is unchecked. Excessively


long words cause dumps. Space is not reclaimed
from deleted entries.

- 1 -
SPLIT (I) 1/15/73 SPLIT (I)

NAME split -- split a file into pieces

SYNOPSIS split [ [ file1 ] file2 ]

DESCRIPTION Split reads file1 and writes it in 1000-line


pieces, as many as are necessary, onto a set of
output files. The name of the first output file
is file2 with an "a" appended, and so on through
the alphabet and beyond. If no output name is
given, "x" is default.

If no input file is given, or the first argument


is "-", then the standard input file is used.

FILES -

SEE ALSO --

DIAGNOSTICS yes

BUGS Watch out for 8-character file names.

- 1 -
STAT (I) 3/15/72 STAT (I)

NAME stat -- get file status

SYNOPSIS _t
s _a
_t_ name1 ...

DESCRIPTION st
_ _a
_t_ gives several kinds of information about one
or more files:

i-number
access mode
number of links
owner
size in bytes
date and time of last modification
name (useful when several files are named)

All information is self-explanatory except the


mode. The mode is a six-character string whose
characters mean the following:

1 s: file is small (smaller than 4096 bytes)


l: file is large

2 d: file is a directory
x: file is executable
u: set user ID on execution
-: none of the above

3 r: owner can read


-: owner cannot read

4 w: owner can write


-: owner cannot write

5 r: non-owner can read


-: non-owner cannot read

6 w: non-owner can write


-: non-owner cannot write

The owner is almost always given in symbolic


form; however if he cannot be found in
"/etc/passwd" a number is given.

If the number of arguments to s


_t_a
_t_ is not exactly
1 a header is generated identifying the fields of
the status information.

FILES /etc/passwd

SEE ALSO istat(I), ls(I) (-l option)

DIAGNOSTICS "name?" for any error.

- 1 -
STRIP (I) 3/15/72 STRIP (I)

NAME strip -- remove symbols and relocation bits

SYNOPSIS _t
s _r
_i_p
_ name1 ...

DESCRIPTION st
_ _r
_i_p
_ removes the symbol table and relocation
bits ordinarily attached to the output of the as-
sembler and loader. This is useful to save space
after a program has been debugged.

The effect of s_t


_r_i
_p_ is the same as use of the -
_s_
option of l
_d_.

FILES /tmp/stm? temporary file

SEE ALSO ld(I), as(I)

DIAGNOSTICS Diagnostics are given for: non-existent argument;


inability to create temporary file;
improper format (not an object file);
inability to re-read temporary file.

BUGS --

- 1 -
STTY (I) 6/12/72 STTY (I)

NAME stty -- set teletype options

SYNOPSIS _t
s _t
_y_ option918 ...

DESCRIPTION St
_ _t
_y_ will set certain I/O options on the current
output teletype. The option strings are selected
from the following set:

ev
_ _e
_n_ allow even parity.
_e
- _v
_e_n_ disallow even parity.
_d
o _d
_ allow odd parity
_o
- _d
_d_ disallow odd parity
_a
r _w
_ raw mode input
(no erase/kill/interrupt/quit/EOT)
-r
_ _a_w_ negate raw mode
_n
- _l_ allow cr for lf (and echo lf cr)
_l
n _ allow nl only
_c
e _h_o_ echo back every character typed.
_e
- _c_h_o_ do not echo characters.
_c
l _a_s_e_ map upper case to lower case
_l
- _c_a_s_e_ do not map case
_t
- _a_b_s_ replace tabs by spaces
_a
t _b_s_ preserve tabs
_e
d _l_a_y_ calculate cr and tab delays.
_d
- _e_l_a_y_ no cr/tab delays
_b
e _c_d_i_c_ ebcdic ball conversion (2741 only)
_o
c _r_r_e_s_ correspondence ball conversion (2741 only)

FILES standard output.

SEE ALSO stty(II)

DIAGNOSTICS "Bad options"

BUGS --

- 1 -
SUM (I) 3/15/72 SUM (I)

NAME sum -- sum file

SYNOPSIS _u
s _m
_ name1 ...

DESCRIPTION su
_ _m
_ sums the contents of the bytes (mod 2^16) of
one or more files and prints the answer in octal.
A separate sum is printed for each file speci-
fied, along with the number of whole or partial
512-byte blocks read.

In practice, s
_u_m
_ is often used to verify that all
of a special file can be read without error.

FILES none

SEE ALSO --

DIAGNOSTICS "oprd" if the file cannot be opened; "?" if an


error is discovered during the read.

BUGS none

- 1 -
TAP (I) 3/15/72 TAP (I)

NAME tap -- manipulate DECtape

SYNOPSIS _a
t _p
_ [ key ] [ name ... ]

DESCRIPTION ta
_ _p
_ saves and restores selected portions of the
file system hierarchy on DECtape. Its actions
are controlled by the k_e
_y_ argument. The key is a
string of characters containing at most one func-
tion letter and possibly one or more function
modifiers. Other arguments to the command are
file or directory names specifying which files
are to be dumped, restored, or tabled.

The function portion of the key is specified by


one of the following letters:

r The indicated files and directories, to-


gether with all subdirectories, are dumped
onto the tape. If files with the same
names already exist, they are replaced
(hence the "r"). "Same" is determined by
string comparison, so "./abc" can never be
the same as "/usr/dmr/abc" even if
"/usr/dmr" is the current directory. If no
file argument is given, "." is the default.

u updates the tape. u_ is the same as r_, but


a file is replaced only if its modification
date is later than the date stored on the
tape; that is to say, if it has changed
since it was dumped. u _ is the default com-
mand if none is given.

d deletes the named files and directories


from the tape. At least one file argument
must be given.

x extracts the named files from the tape to


the file system. The owner, mode, and
date-modified are restored to what they
were when the file was dumped. If no file
argument is given, the entire contents of
the tape are extracted.

t lists the names of all files stored on the


tape which are the same as or are hierar-
chically below the file arguments. If no
file argument is given, the entire contents
of the tape are tabled.

l is the same as t
_ except that an expanded
listing is produced giving all the avail-
able information about the listed files.

- 1 -
TAP (I) 3/15/72 TAP (I)

The following characters may be used in addition


to the letter which selects the function desired.

0, ..., 7 This modifier selects the drive on


which the tape is mounted. "0" is the de-
fault.

v Normally t
_a_p
_ does its work silently. The v
_
(verbose) option causes it to type the name
of each file it treats preceded by a letter
to indicate what is happening.

r file is being replaced


a file is being added (not there before)
x file is being extracted
d file is being deleted

The v
_ option can be used with r
_, u
_, d
_, and
_ only.
x

c means a fresh dump is being created; the


tape directory will be zeroed before begin-
ning. Usable only with r_ and u
_.

f causes new entries copied on tape to be


’fake’ in that no data is present for these
entries. Such fake entries cannot be ex-
tracted. Usable only with r_ and u
_.

w causes t _a
_p_ to pause before treating each
file, type the indicative letter and the
file name (as with v _) and await the user’s
response. Response "y" means "yes", so the
file is treated. Null response means "no",
and the file does not take part in whatever
is being done. Response "x" means "exit";
the t
_a_p
_ command terminates immediately. In
the x
_ function, files previously asked
about have been extracted already. With r _,
_, and d
u _ no change has been made to the
tape.

m make (create) directories during an x


_ if
necessary.

FILES /dev/tap?

SEE ALSO mt(I)

DIAGNOSTICS Tape open error


Tape read error
Tape write error
Directory checksum
Directory overflow

- 2 -
TAP (I) 3/15/72 TAP (I)

Tape overflow
Phase error (a file has changed after it was se-
lected for dumping but before it was dumped)

BUGS Asks about "fake" entries on "xw", when it should


ignore them. If a fake entry is extracted, and
the file already exists on disk, the extraction
does not take place (as is correct), but the mode
and user ID of the file are set to 0.

- 3 -
TIME (I) 10/26/72 TIME (I)

NAME time -- time a command

SYNOPSIS _i
t _m
_e_ command

DESCRIPTION The given command is timed; after it is complete,


_i
t _m
_e_ prints the time spent in the system, waiting
for disk, and in execution of the command.

The disk I/O time can be variable depending on


other activity in the system.

FILES --

SEE ALSO tm (VIII)

DIAGNOSTICS "?"
"command terminated abnormally"
"Command not found."

- 1 -
TMG (I) 10/21/72 TMG (I)

NAME tmg -- compiler compiler

SYNOPSIS _m
t _g
_ name

DESCRIPTION tm
_ _g
_ produces a translator for the language whose
parsing and translation rules are described in
file name._t
_. The new translator appears in [Link]
and may be used thus:

_.
a _o
_u_t
_ input [ output ]

Except in rare cases input must be a randomly ad-


dressable file. If no output file is specified,
the standard output file is assumed.

FILES /sys/tmg/tmgl.o -- the compiler-compiler


/sys/tmg[abc] -- libraries
alloc.d -- table storage

SEE ALSO A Manual for the Tmg Compiler-writing Language,


MM-72-1271-8.

DIAGNOSTICS Syntactic errors result in "???" followed by the


offending line.
Situations such as space overflow with which the
Tmg processor or a Tmg-produced processor can not
cope result in a descriptive comment and a dump.

BUGS 9.2 footnote 1 is not enforced, causing trouble.


Restrictions (7.) against mixing bundling primi-
tives should be lifted.
Certain hidden reserved words exist: gpar,
classtab, trans.
Octal digits include 8=10 and 9=11.

- 1 -
TSS (I) 3/15/72 TSS (I)

NAME tss -- interface to Honeywell TSS

SYNOPSIS _s
t _s
_

DESCRIPTION ts
_ _s
_ will call the Honeywell 6070 on the 201 data
phone. It will then go into direct access with
TSS. Output generated by TSS is typed on the
standard output and input requested by TSS is
read from the standard input with UNIX typing
conventions.

An interrupt signal (ASCII DEL) is transmitted as


a "break" to TSS.

Input lines beginning with !


_ are interpreted as
UNIX commands. Input lines beginning with ˜_ are
interpreted as commands to the interface routine.

˜<file insert input from named UNIX file

˜>file deliver tss output to named UNIX file

˜p pop the output file

˜q disconnect from tss (quit)

˜r file receive from HIS routine CSR/DACCOPY

˜s file send file to HIS routine CSR/DACCOPY

Ascii files may be most efficiently transmitted


using the HIS routine CSR/DACCOPY in this fash-
ion. Underlined text comes from TSS. AFTname is
the 6070 file to be dealt with.

SY
_ _S
_T_E
_M_?
_ CSR/DACCOPY (s) AFTname
_e
S _n
_d__E_n
_c_o
_d_e
_d__F
_i_l
_e_ ˜s file

SY
_ _S
_T_E
_M_? CSR/DACCOPY (r) AFTname
_e
R _c
_e_i
_v_e
__E
_n_c
_o_d
_e_d
__F
_i_l
_e_ ˜r file

FILES /dev/dn0, /dev/dp0

SEE ALSO --

DIAGNOSTICS DONE when communication is broken.

BUGS When diagnostic problems occur, t


_s_s
_ exits rather
abruptly.

- 1 -
TTY (I) 3/15/72 TTY (I)

NAME tty -- get tty name

SYNOPSIS _t
t _y
_

DESCRIPTION tt
_ _y
_ gives the name of the user’s typewriter in
the form "ttyn" for n_ a digit. The actual path
name is then "/dev/ttyn".

FILES --

SEE ALSO --

DIAGNOSTICS "not a tty" if the standard input file is not a


typewriter.

BUGS --

- 1 -
TYPE (I) 6/12/72 TYPE (I)

NAME type -- type on single sheet paper

SYNOPSIS _y
t _p
_e_ file918 ...

DESCRIPTION ty
_ _p
_e_ copies its input files to the standard out-
put. Before each new page (66 lines) and before
each new file, type stops and reads the standard
input for a new line character before continuing.
This allows time for insertion of single sheet
paper.

FILES --

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
TYPO (I) 1/15/73 TYPO (I)

NAME typo -- find possible typo’s

SYNOPSIS _y
t _p
_o_ [ -
_ ] file1 ...

DESCRIPTION typo hunts through a document for unusual words,


typographic errors, and hapax legomena and prints
them on the standard output.

All words used in the document are printed out in


decreasing order of peculiarity along with an in-
dex of peculiarity. An index of 10 or more is
considered peculiar. Printing of certain very
common English words is suppressed.

The statistics for judging words are taken from


the document itself; with some help from known
statistics of English. The "-" option suppresses
the help from English and should be used if the
document is written in, for example, Urdu.

Roff and Nroff control lines are ignored. Upper


case is mapped into lower case. Quote marks,
vertical bars, hyphens, and ampersands are
stripped from within words. Words hyphenated
across lines are put back together.

FILES /tmp/ttmp??, /etc/salt, /etc/w2006

SEE ALSO --

DIAGNOSTICS yes, lots

BUGS Because of the mapping into lower case and the


stripping of special characters, words may be
hard to locate in the original text.

- 1 -
UN (I) 3/15/72 UN (I)

NAME un -- undefined symbols

SYNOPSIS _n
u _ [ name ]

DESCRIPTION un
_ _ prints a list of undefined symbols from an as-
sembly or loader run. If the file argument is
not specified, a_.
_o_u
_t_ is the default. Names are
listed alphabetically except that non-global sym-
bols come first. Undefined global symbols (unre-
solved external references) have their first
character underlined.

FILES [Link]

SEE ALSO as(I), ld(I)

DIAGNOSTICS "?" if the file cannot be found.

BUGS --

- 1 -
UNIQ (I) 12/1/72 UNIQ (I)

NAME uniq -- report repeated lines in a file

SYNOPSIS _n
u _i
_q_ [ -
_u_d
_ ] [ input [ output ] ]

DESCRIPTION un
_ _i
_q_ reads the input file comparing adjacent
lines. In the normal case, the second and suc-
ceeding copies of repeated lines are removed; the
remainder is written on the output file. Note
that repeated lines must be adjacent in order to
be found. (See sort(I)) If the - _u
_ flag is used,
just the lines that are not repeated in the orig-
inal file are output. The - _d
_ option specifies
that one copy of just the repeated lines is to be
written. Note that the normal mode output is the
union of the - _u
_ and -
_d_ mode outputs.

The following example will print one copy of all


lines in the file a
_ that do not occur in b
_:

sort a x uniq x a1 sort b


x uniq x b1 cat a1 b1 >x
sort x uniq -u x >>a1
sort a1 uniq -d a1

FILES --

SEE ALSO sort(I)

DIAGNOSTICS "cannot open input", "cannot create output"

BUGS --

- 1 -
VS (I) 2/13/73 VS(I)

NAME vs -- phoneme list to voice synthesizer

SYNOPSIS _s
v _

DESCRIPTION vs
_ _ accepts phoneme descriptor lists and trans-
lates them into byte strings suitable for the
Federal Screw Works Voice Synthesizer. Phoneme
descritors should be separated by commas and have
the general form "%NIxx" where "xx" is a one or
two character phoneme name, "I" is an optional
inflection parameter, and "%N" is an optional
count of the number of times the phoneme is to be
repeated (maximum 9). "I" can have the values 0,
1, 2, 3 representing decreasing strength (default
is 2). A description of the phonemes and their
names can be found in the file v_s
_p_(VII). For ex-
ample,

a0,o1,t,r,1ai,1ay,d,j,ih,u1,%2s

will generate the word "outrageous". The output


is buffered; a newline will cause the buffered
output to be sent to the Voice Synthesizer.

FILES -

SEE ALSO vsp(VII), speak(I)

DIAGONOSTICS -

BUGS -

- 1 -
WC (I) 3/15/72 WC (I)

NAME wc -- get (English) word count

SYNOPSIS _c
w _ name918 ...

DESCRIPTION wc
_ _ provides a count of the words, text lines, and
control lines for each argument file.

A text line is a sequence of characters not be-


ginning with ".", "!" or "’" and ended by a new-
line. A control line is a line beginning with
".", "!" or "’". A word is a sequence of charac-
ters bounded by the beginning of a line, by the
end of a line, or by a blank or a tab.

When there is more than one input file, a grand


total is also printed.

FILES --

SEE ALSO roff(I)

DIAGNOSTICS none; arguments not found are ignored.

BUGS --

- 1 -
WHO (I) 3/15/72 WHO (I)

NAME who -- who is on the system

SYNOPSIS _h
w _o
_ [ who-file ]

DESCRIPTION wh
_ _o
_, without an argument, lists the name, type-
writer channel, and login time for each current
UNIX user.

Without an argument, w _h_o


_ examines the /_t
_m_p
_/_u
_t_m
_p_
file to obtain its information. If a file is
given, that file is examined. Typically the giv-
en file will be /_t
_m_p
_/_w
_t_m
_p_, which contains a
record of all the logins since it was created.
Then w
_h_o
_ will list logins, logouts, and crashes
since the creation of the wtmp file.

Each login is listed with user name, last charac-


ter of input device name (with /
_d_e
_v_/
_t_t
_y_ sup-
pressed), date and time. Certain logouts produce
a similar line without a user name. Reboots pro-
duce a line with "x" in the place of the device
name, and a fossil time indicative of when the
system went down.

FILES /tmp/utmp

SEE ALSO login(I), init(VII)

DIAGNOSTICS "?" if a named file cannot be read.

BUGS --

- 1 -
WRITE (I) 3/15/72 WRITE (I)

NAME write -- write to another user

SYNOPSIS _r
w _i
_t_e
_ user

DESCRIPTION wr
_ _i
_t_e
_ copies lines from your typewriter to that
of another user. When first called, w _r
__it
_e_ sends
the message

message from yourname...

The recipient of the message should write back at


this point. Communication continues until an end
of file is read from the typewriter or an inter-
rupt is sent. At that point w_r
_i_t
_e_ writes "EOT"
on the other terminal.

Permission to write may be denied or granted by


use of the m_e
_s_g
_ command. At the outset writing
is allowed. Certain commands, in particular r _o
_f_f
_
and p
_r_, disallow messages in order to prevent
messy output.

If the character "!" is found at the beginning of


a line, w
_r_i
_t_e
_ calls the mini-shell m
_s_h
_ to execute
the rest of the line as a command.

The following protocol is suggested for using


_r
w _i
_t_e
_: When you first write to another user, wait
for him to write back before starting to send.
Each party should end each message with a dis-
tinctive signal ("(o)" for "over" is convention-
al) that the other may reply. "(oo)" (for "over
and out") is suggested when conversation is about
to be terminated.

FILES /tmp/utmp to find user


/etc/msh to execute !

SEE ALSO mesg(I), msh(VII)

DIAGNOSTICS "user not logged in"; "permission denied".

BUGS wr
_ _i
_t_e
_ should check the mode of the other user’s
typewriter and refuse to proceed unless non-user
write permission is given. Currently it is pos-
sible to write to another person with the same
user-ID even though he has forbidden messages.

wr
_ _i
_t_e
_ should also allow specification of the
typewriter name of a user who is logged in sever-
al times instead of picking out the instance with
the lowest name.

- 1 -
BOOT (II) 7/29/72 BOOT (II)

NAME boot -- reboot UNIX

SYNOPSIS sys boot / boot = 39. not in assembler

DESCRIPTION UNIX will clean up outstanding IO, and then exe-


cute the reboot read-only program. This call is
restricted to the super-user. All users will be
logged out.

SEE ALSO boot procedures (VII)

DIAGNOSTICS the c-bit is set if you are not the super-user

BUGS It often doesn’t work (for unknown reasons).


It depends on switch settings.

- 1 -
BREAK (II) 3/15/72 BREAK (II)

NAME break -- set program break

SYNOPSIS sys break; addr / break = 17.

DESCRIPTION br
_ _e
_a_k
_ sets the system’s idea of the highest loca-
tion used by the program to a _d
_d_r
_. Locations
greater than a _d
_d_r
_ and below the stack pointer are
not swapped and are thus liable to unexpected
modification.

An argument of 0 is taken to mean 16K bytes. If


the argument is higher than the stack pointer the
entire user core area is swapped.

When a program begins execution via e


_x_e
_c_ the
break is set at the highest location defined by
the program and data storage areas. Ordinarily,
therefore, only programs with growing data areas
need to use b
_r_e
_a_k
_.

SEE ALSO exec(II)

DIAGNOSTICS none; strange addresses cause the break to be set


at 16K bytes.

BUGS --

- 1 -
CEMT (II) 9/4/72 CEMT (II)

NAME cemt -- catch emt traps

SYNOPSIS sys cemt; arg / cemt = 29.

DESCRIPTION This call allows one to catch traps resulting


from the e
_m_t
_ instruction. A _r
_g_ is a location
within the program; e_m
_t_ traps are sent to that
location. The normal effect of e _m
_t_ traps may be
restored by giving an a _r
_g_ equal to 0.

To return after catching the e


_m_t
_ trap, execute
the r
_t_i
_ instruction.

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
CHDIR (II) 3/15/72 CHDIR (II)

NAME chdir -- change working directory

SYNOPSIS sys chdir; dirname / chdir = 12.

DESCRIPTION di
_ _r
_n_a
_m_e
_ is the address of the pathname of a di-
rectory, terminated by a 0 byte. c _h
_d_i
_r_ causes
this directory to become the current working di-
rectory.

SEE ALSO chdir(I)

DIAGNOSTICS The error bit (c-bit) is set if the given name is


not that of a directory or is not readable.

BUGS --

- 1 -
CHMOD (II) 3/15/72 CHMOD (II)

NAME chmod -- change mode of file

SYNOPSIS sys chmod; name; mode / chmod = 15.

DESCRIPTION The file whose name is given as the null-termi-


nated string pointed to by n_a
_m_e
_ has its mode
changed to m
_o_d
_e_. Modes are constructed by o_r_ing
together some combination of the following:

01 write, non-owner
02 read, non-owner
04 write, owner
10 read, owner
20 executable
40 set user ID on execution

Only the owner of a file (or the super-user) may


change the mode.

SEE ALSO chmod(I)

DIAGNOSTICS Error bit (c-bit) set if n


_a_m
_e_ cannot be found or
if current user is neither the owner of the file
nor the super-user.

BUGS --

- 1 -
CHOWN (II) 3/15/72 CHOWN (II)

NAME chown -- change owner of file

SYNOPSIS sys chown; name; owner / chown = 16.

DESCRIPTION The file whose name is given by the null-termi-


nated string pointed to by n_a
_m_e
_ has its owner
changed to o
_w_n
_e_r
_. Only the present owner of a
file (or the super-user) may donate the file to
another user. Also, one may not change the owner
of a file with the set-user-ID bit on, otherwise
one could create Trojan Horses.

SEE ALSO chown(I), uids(V)

DIAGNOSTICS The error bit (c-bit) is set on illegal owner


changes.

BUGS --

- 1 -
CLOSE (II) 3/15/72 CLOSE (II)

NAME close -- close a file

SYNOPSIS (file descriptor in r0)


sys close / close = 6.

DESCRIPTION Given a file descriptor such as returned from an


open or creat call, c_l_o
_s_e
_ closes the associated
file. A close of all files is automatic on exit,
but since processes are limited to 10 simultane-
ously open files, c
_l_o
_s_e
_ is necessary for programs
which deal with many files.

SEE ALSO creat(II), open(II)

DIAGNOSTICS The error bit (c-bit) is set for an unknown file


descriptor.

BUGS --

- 1 -
CREAT (II) 3/15/72 CREAT (II)

NAME creat -- create a new file

SYNOPSIS sys creat; name; mode / creat = 8.


(file descriptor in r0)

DESCRIPTION cr
_ _e
_a_t
_ creates a new file or prepares to rewrite
an existing file called n _a
_m_e
_; n
_a_m
_e_ is the address
of a null-terminated string. If the file did not
exist, it is given mode m _o
_d_e
_; if it did exist,
its mode and owner remain unchanged but it is
truncated to 0 length.

The file is also opened for writing, and its file


descriptor is returned in r0.

The m
_o_d
_e_ given is arbitrary; it need not allow
writing. This feature is used by programs which
deal with temporary files of fixed names. The
creation is done with a mode that forbids writ-
ing. Then if a second instance of the program
attempts a c _r
_e_a
_t_, an error is returned and the
program knows that the name is unusable for the
moment.

SEE ALSO write(II), close(II)

DIAGNOSTICS The error bit (c-bit) may be set if: a needed di-
rectory is not readable; the file does not exist
and the directory in which it is to be created is
not writable; the file does exist and is un-
writable; the file is a directory; there are al-
ready 10 files open.

BUGS --

- 1 -
CSW (II) 7/29/72 CSW (II)

NAME csw -- read console switches

SYNOPSIS sys csw / csw = 38. not in assembler


(value of csw in r0)
(value of buttons in r1)

DESCRIPTION The setting of the console switches is returned


in r0. The setting of the external buttons is
returned in r1. The return is synced to a 30 CPS
clock for graphical applications.

SEE ALSO --

DIAGNOSTICS none

BUGS Currently the buttons are unavailable.

- 1 -
DUP (II) 1/15/73 DUP (II)

NAME dup -- duplicate an open file descriptor

SYNOPSIS (file descriptor in r0)


sys dup / dup = 41.; not in assembler
(file descriptor in r0)

DESCRIPTION Given a file descriptor returned from an open or


creat call, d
_u_p
_ will allocate another file de-
scriptor synonymous with the original. The new
file descriptor is returned in r0.

Du
_ _p
_ is used more to manipulate the value of file
descriptors than to genuinely duplicate a file
descriptor. Since the algorithm to allocate file
descriptors is known to use the lowest available
value between 0 and 9, combinations of d _u
_p_ and
_l
c _o
_s_e
_ can be used to manipulate file descriptors
in a general way. This is handy for manipulating
standard input and/or standard output.

SEE ALSO creat(II), open(II), close(II)

DIAGNOSTICS The error bit (c-bit) is set if: the given file
descriptor is invalid; there are already 10 open
files.

BUGS --

- 1 -
EXEC (II) 3/15/72 EXEC (II)

NAME exec -- execute a file

SYNOPSIS sys exec; name; args / exec = 11.


name: <...\0>
args: arg1; arg2; ...; 0
arg1: <...\0>

DESCRIPTION ex
_ _e
_c_ overlays the calling process with the named
file, then transfers to the beginning of the core
image of the file. The first argument to e _x
_e_c
_ is
a pointer to the name of the file to be executed.
The second is the address of a list of pointers
to arguments to be passed to the file. Conven-
tionally, the first argument is the name of the
file. Each pointer addresses a string terminated
by a null byte.

There can be no return from the file; the calling


core image is lost.

The program break is set from the executed file;


see the format of [Link].

Once the called file starts execution, the argu-


ments are available as follows. The stack point-
er points to a word containing the number of ar-
guments. Just above this number is a list of
pointers to the argument strings.

sp-> nargs arg1 ...


argn

arg1: <arg1\0> ...


argn: <argn\0>

The arguments are placed as high as possible in


core: just below 57000(8).

Files remain open across e _x


_e_c
_ calls. However,
the illegal instruction, e _m
_t_, quit, and interrupt
trap specifications are reset to the standard
values. (See i_l
_g_i
_n_s
_, c
_e_m
_t_, q_u_i
_t_, i
_n_t
_r_.)

Each user has a r


_e_a
_l_ user ID and an e_f
_f_e
_c_t
_i_v
_e_ us-
er ID (The real ID identifies the person using
the system; the effective ID determines his ac-
cess privileges.) e _x
_e_c
_ changes the effective us-
er ID to the owner of the executed file if the
file has the "set-user-ID" mode. The real user
ID is not affected.

SEE ALSO fork(II)

DIAGNOSTICS If the file cannot be read or if it is not exe-

- 1 -
EXEC (II) 3/15/72 EXEC (II)

cutable, a return from e


_x_e
_c_ constitutes the diag-
nostic. The error bit (c-bit) is set.

BUGS Very high core and very low core are used by e
_x_e
_c_
to construct the argument list for the new core
image. If the original copies of the arguments
reside in these places, problems can result.

- 2 -
EXIT (II) 3/15/72 EXIT (II)

NAME exit -- terminate process

SYNOPSIS (status in r0)


sys exit / exit = 1

DESCRIPTION ex
_ _i
_t_ is the normal means of terminating a
process. Exit closes all the process’ files and
notifies the parent process if it is executing a
_a
w _i
_t_. The low byte of r0 is available as status
to the parent process.

This call can never return.

SEE ALSO wait(II)

DIAGNOSTICS -

BUGS --

- 1 -
FORK (II) 3/15/72 FORK (II)

NAME fork -- spawn new process

SYNOPSIS sys fork / fork = 2.


(new process return)
(old process return)

DESCRIPTION fo
_ _r
_k_ is the only way new processes are created.
The new process’s core image is a copy of that of
the caller of f _o
_r_k
_; the only distinction is the
return location and the fact that r0 in the old
process contains the process ID of the new
process. This process ID is used by w _a
_i_t
_.

SEE ALSO wait(II), exec(II)

DIAGNOSTICS The error bit (c-bit) is set in the old process


if a new process could not be created because of
lack of process space.

BUGS See wait(II) for a subtile bug in process de-


struction.

- 1 -
FPE (II) 9/2/72 FPE (II)

NAME fpe -- set floating exception handling

SYNOPSIS sys fpe; arg / fpe = 40. not in assembler

DESCRIPTION This call allows one to catch traps resulting


from floating point exceptions. A_r
_g_ is a loca-
tion within the program; floating exception traps
are sent to that location. The normal effect of
floating exception traps may be restored by giv-
ing an a
_r_g
_ equal to 0.

To return after catching the f


_p_e
_ trap, execute
the r
_t_i
_ instruction.

SEE ALSO --

DIAGNOSTICS --

BUGS The floating point exception (FEC) register is


not saved per process. Examining this register
for possible remedial action after a floating
point exception trap is not guaranteed to work.

- 1 -
FSTAT (II) 3/15/72 FSTAT (II)

NAME fstat -- get status of open file

SYNOPSIS (file descriptor in r0)


sys fstat; buf / fstat = 28.

DESCRIPTION This call is identical to s


_t_a
_t_, except that it
operates on open files instead of files given by
name. It is most often used to get the status of
the standard input and output files, whose names
are unknown.

SEE ALSO stat(II)

DIAGNOSTICS The error bit (c-bit) is set if the file descrip-


tor is unknown.

BUGS --

- 1 -
GETUID (II) 3/15/72 GETUID (II)

NAME getuid -- get user identification

SYNOPSIS sys getuid / getuid = 24.


(user ID in r0)

DESCRIPTION ge
_ _t
_u_i
_d_ returns the real user ID of the current
process. The real user ID identifies the person
who is logged in, in contradistinction to the ef-
fective user ID, which determines his access per-
mission at each moment. It is thus useful to
programs which operate using the "set user ID"
mode, to find out who invoked them.

SEE ALSO setuid(II)

DIAGNOSTICS --

BUGS --

- 1 -
GTTY (II) 3/15/72 GTTY (II)

NAME gtty -- get typewriter status

SYNOPSIS (file descriptor in r0)


sys gtty; arg / gtty = 32.
arg: .=.+6

DESCRIPTION gt
_ _t
_y_ stores in the three words addressed by a
_r_g
_
the status of the typewriter whose file descrip-
tor is given in r0. The format is the same as
that passed by s _t
_t_y
_.

SEE ALSO stty(II)

DIAGNOSTICS Error bit (c-bit) is set if the file descriptor


does not refer to a typewriter.

BUGS --

- 1 -
ILGINS (II) 3/15/72 ILGINS (II)

NAME ilgins -- catch illegal instruction trap

SYNOPSIS sys ilgins; arg / ilgins = 33.

DESCRIPTION il
_ _g
_i_n
_s_ allows a program to catch illegal instruc-
tion traps. If a _r
_g_ is zero, the normal instruc-
tion trap handling is done: the process is termi-
nated and a core image is produced. If a _r
_g_ is a
location within the program, control is passed to
_r
a _g
_ when the trap occurs.

This call is used to implement the floating point


simulator, which catches and interprets 11/45
floating point instructions.

To return after catching the i


_l_g
_i_n
_s_ trap, execute
the r
_t_i
_ instruction.

SEE ALSO PDP-11 manual

DIAGNOSTICS --

BUGS --

- 1 -
INTR (II) 3/15/72 INTR (II)

NAME intr -- set interrupt handling

SYNOPSIS sys intr; arg / intr = 27.

DESCRIPTION When a
_r_g
_ is 0, interrupts (ASCII DELETE) are ig-
nored. When a _r
_g_ is 1, interrupts cause their
normal result, that is, force an e _x
_i_t
_. When a_r
_g_
is a location within the program, control is
transferred to that location when an interrupt
occurs.

After an interrupt is caught, it is possible to


resume execution by means of an r
_t_i
_ instruction;
however, great care must be exercised, since all
I/O is terminated abruptly upon an interrupt. In
particular, reads of the typewriter tend to re-
turn with 0 characters read, thus simulating an
end of file.

SEE ALSO quit(II)

DIAGNOSTICS --

BUGS --

- 1 -
KILL (II) 6/12/72 KILL (II)

NAME kill -- destroy process

SYNOPSIS (process number in r0)


sys kill / kill = 37.; not in assembler

DESCRIPTION ki
_ _l
_l_ destroys a process, given its process num-
ber. The process leaves a core image.

This call is restricted to the super-user, and is


intended only to kill an otherwise unstoppable
process.

SEE ALSO --

DIAGNOSTICS c-bit set if user is not the super-user, or if


process does not exist.

BUGS Under strange circumstances, k


_i_l
_l_ is ineffective.

- 1 -
LINK (II) 3/15/72 LINK (II)

NAME link -- link to a file

SYNOPSIS sys link; name1; name2 / link = 9.

DESCRIPTION A link to n_a


_m_e
_1 is created; the link has name
_a
n _m
_e_2. Either name may be an arbitrary path
name.

SEE ALSO link(I), unlink(II)

DIAGNOSTICS The error bit (c-bit) is set when n _a


_m_e
_1 cannot be
found; when n _a
_m_e
_2 already exists; when the direc-
tory of n
_a_m
_e_2 cannot be written; when an attempt
is made to link to a directory by a user other
than the super-user.

BUGS --

- 1 -
MAKDIR (II) 3/15/72 MAKDIR (II)

NAME makdir -- make a directory

SYNOPSIS sys makdir; name; mode / makdir = 14.

DESCRIPTION ma
_ _k
_d_i
_r_ creates an empty directory whose name is
the null-terminated string pointed to by n _a
_m_e
_.
The mode of the directory is m _o
_d_e
_. The special
entries "." and ".." are not present.

_a
m _k
_d_i
_r_ may be invoked only by the super-user.

SEE ALSO mkdir(I)

DIAGNOSTICS Error bit (c-bit) is set if the directory already


exists or if the user is not the super-user.

BUGS --

- 1 -
MDATE (II) 3/15/72 MDATE (II)

NAME mdate -- set modified date on file

SYNOPSIS (time to r0-r1)


sys mdate; file / mdate = 30.

DESCRIPTION Fi
_ _l
_e_ is the address of a null-terminated string
giving the name of a file. The modified time of
the file is set to the time given in the r0-r1
registers.

This call is allowed only to the super-user or to


the owner of the file.

SEE ALSO --

DIAGNOSTICS Error bit is set if the user is neither the owner


nor the super-user or if the file cannot be
found.

BUGS --

- 1 -
MOUNT (II) 3/15/72 MOUNT (II)

NAME mount -- mount file system

SYNOPSIS sys mount; special; name / mount = 21.

DESCRIPTION mo
_ _u
_n_t
_ announces to the system that a removable
file system has been mounted on special file spe-
___c
_i_a
_l_; from now on, references to file n _a
_m_e
_ will
refer to the root file on the newly mounted file
system. S _p
_e_c
_i_a
_l_ and n
_a_m
_e_ are pointers to null-
terminated strings containing the appropriate
path names.

Na
_ _m
_e_ must exist already. If it had contents,
they are inaccessible while the file system is
mounted.

SEE ALSO mount(I), umount(II)

DIAGNOSTICS Error bit (c-bit) set if: s _p


_e_c
_i_a
_l_ is inaccessi-
ble; n
_a_m
_e_ does not exist; s_p
_e_c
_i_a
_l_ is already
mounted; n _a
_m_e
_ is not on the RF; there are already
four special files mounted.

BUGS At most four removable devices can be mounted at


a time. This call should be restricted to the
super-used.

- 1 -
NICE (II) 3/15/72 NICE (II)

NAME nice -- set program in low priority

SYNOPSIS sys nice / nice = 34.

DESCRIPTION The currently executing process is set into the


lowest priority execution queue. Background jobs
that execute a very long time should do this.
Once done, there is no way to restore a process
to normal priority.

SEE ALSO formerly known as "hog"

DIAGNOSTICS --

BUGS --

- 1 -
OPEN (II) 3/15/72 OPEN (II)

NAME open -- open for reading or writing

SYNOPSIS sys open; name; mode / open = 5.


(descriptor in r0)

DESCRIPTION op
_ _e
_n_ opens the file n_a
_m_e
_ for reading (if m_o_d
_e_ is
0) or writing (if m _o
_d_e
_ is non-zero). n _a
_m_e
_ is the
address of a string of ASCII characters repre-
senting a path name, terminated by a null charac-
ter.

The file descriptor should be saved for subse-


quent calls to read (or write) and close.

In both the read and write case the file pointer


is set to the beginning of the file.

SEE ALSO creat(II), read(II), write(II), close(II)

DIAGNOSTICS The error bit (c-bit) is set if the file does not
exist, if one of the necessary directories does
not exist or is unreadable, if the file is not
readable (resp. writable), or if 10 files are
open.

BUGS --

- 1 -
PIPE (II) 1/15/73 PIPE (II)

NAME pipe -- create a pipe

SYNOPSIS sys pipe / pipe = 42.; not in assembler


(file descriptor in r0)

DESCRIPTION The p
_i_p
_e_ system call creates an I/O mechanism
called a pipe. The file descriptor returned can
be used in both read and write operations. When
the pipe is written, the data is buffered up to
504 bytes at which time the writing process is
suspended. A read on the pipe will pick up the
buffered data.

It is assumed that after the p _i


_p_e
_ has been set
up, two (or more) cooperating processes (created
by subsequent f
_o_r
_k_ calls) will pass data through
the pipe with r
_e_a
_d_ and w
_r_i
_t_e
_ calls.

The shell has a syntax to set up a linear array


of processes connected by pipes.

Read calls on an empty pipe (no buffered data)


with only one end (no synonymous file descriptors
resulting from f
_o_r
_k_ or d
_u_p
_) return an end-of-
file. Write calls under similar conditions are
ignored.

SEE ALSO sh(I), read(II), write(II), fork(II)

DIAGNOSTICS The error bit (c-bit) is set if 10 files are al-


ready open.

BUGS --

- 1 -
QUIT (II) 3/15/72 QUIT (II)

NAME quit -- turn off quit signal

SYNOPSIS sys quit; flag / quit = 26.

DESCRIPTION When f
_l_a
_g_ is 0, this call disables quit signals
from the typewriter (ASCII FS). When f _l
_a_g
_ is
non-zero, quits are re-enabled, and cause execu-
tion to cease and a core image to be produced.

Quits should be turned off only with due consid-


eration.

SEE ALSO intr(II)

DIAGNOSTICS --

BUGS --

- 1 -
READ (II) 3/15/72 READ (II)

NAME read -- read from file

SYNOPSIS (file descriptor in r0)


sys read; buffer; nbytes / read = 3.
(nread in r0)

DESCRIPTION A file descriptor is a word returned from a suc-


cessful o
_p_e
_n_ or c
_r_e
_a_t
_ call.

Bu
_ _f
_f_e
_r_ is the location of n _b
_y_t
_e_s
_ contiguous bytes
into which the input will be placed. It is not
guaranteed that all n _b
_y_t
_e_s
_ bytes will be read;
for example if the file refers to a typewriter at
most one line will be returned. In any event the
number of characters read is returned in r0.

If r0 returns with value 0, then end-of-file has


been reached.

SEE ALSO open(II), creat(II)

DIAGNOSTICS As mentioned, r0 is 0 on return when the end of


the file has been reached. If the read was
otherwise unsuccessful the error bit (c-bit) is
set. Many conditions, can generate an error:
physical I/O errors, bad buffer address, prepos-
terous n
_b_y
_t_e
_s_, file descriptor not that of an in-
put file.

BUGS --

- 1 -
RELE (II) 3/15/72 RELE (II)

NAME rele -- release processor

SYNOPSIS sys rele / rele = 0; not in assembler

DESCRIPTION This call causes the process to be swapped out


immediately if another process wants to run. Its
main reason for being is internal to the system,
namely to implement timer-runout swaps. However,
it can be used beneficially by programs which
wish to loop for some reason without consuming
more processor time than necessary.

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
SEEK (II) 3/15/72 SEEK (II)

NAME seek -- move read/write pointer

SYNOPSIS (file descriptor in r0)


sys seek; offset; ptrname / seek = 19.

DESCRIPTION The file descriptor refers to a file open for


reading or writing. The read (resp. write)
pointer for the file is set as follows:

if p
_t_r
_n_a
_m_e
_ is 0, the pointer is set to o
_f_f
_s_e
_t_.

if p
_t_r
_n_a
_m_e
_ is 1, the pointer is set to its
current location plus o _f
_f_s
_e_t
_.

if p
_t_r
_n_a
_m_e
_ is 2, the pointer is set to the
size of the file plus o _f
_f_s
_e_t
_.

SEE ALSO --

DIAGNOSTICS The error bit (c-bit) is set for an undefined


file descriptor.

BUGS A file can conceptually be as large as 2**20


bytes. Clearly only 2**16 bytes can be addressed
by s
_e_e
_k_. The problem is most acute on the large
special files.

- 1 -
SETUID (II) 3/15/72 SETUID (II)

NAME setuid -- set process ID

SYNOPSIS (process ID in r0)


sys setuid / setuid = 23.

DESCRIPTION The user ID of the current process is set to the


argument in r0. Both the effective and the real
user ID are set. This call is only permitted to
the super-user or if r0 is the real user ID.

SEE ALSO getuid(II)

DIAGNOSTICS Error bit (c-bit) is set as indicated.

BUGS --

- 1 -
SLEEP (II) 9/4/72 SLEEP (II)

NAME sleep -- stop execution for interval

SYNOPSIS (seconds in r0)


sys sleep / sleep = 35.; not in assembler

DESCRIPTION The current process is suspended from execution


for the number of seconds specified by the con-
tents of register 0.

SEE ALSO --

DIAGNOSTICS --

BUGS Due to the implementation, the sleep interval is


only accurate to 256 60ths of a second (4.26
sec). Even then, the process is placed on a low
priority queue and must be scheduled.

- 1 -
STAT (II) 3/15/72 STAT (II)

NAME stat -- get file status

SYNOPSIS sys stat; name; buf / stat = 18.

DESCRIPTION na
_ _m
_e_ points to a null-terminated string naming a
file; b _u
_f_ is the address of a 34(10) byte buffer
into which information is placed concerning the
file. It is unnecessary to have any permissions
at all with respect to the file, but all directo-
ries leading to the file must be readable.

After s
_t_a
_t_, b
_u_f
_ has the following format:

buf, +1 i-number
+2,+3 flags (see below)
+4 number of links
+5 user ID of owner
+6,+7 size in bytes
+8,+9 first indirect block or contents block
+22,+23 eighth indirect block or contents block
+24,+25,+26,+27 creation time
+28,+29,+30,+31 modification time
+32,+33 unused

The flags are as follows:

100000 used (always on)


040000 directory
020000 file has been modified (always on)
010000 large file
000040 set user ID
000020 executable
000010 read, owner
000004 write, owner
000002 read, non-owner
000001 write, non-owner

SEE ALSO stat(I), fstat(II)

DIAGNOSTICS Error bit (c-bit) is set if the file cannot be


found.

BUGS --

- 1 -
STIME (II) 3/15/72 STIME (II)

NAME stime -- set time

SYNOPSIS (time in r0-r1)


sys stime / stime = 25.

DESCRIPTION st
_ _i
_m_e
_ sets the system’s idea of the time and
date. Only the super-user may use this call.

SEE ALSO date(I), time(II)

DIAGNOSTICS Error bit (c-bit) set if user is not the super-


user.

BUGS --

- 1 -
STTY (II) 6/12/72 STTY (II)

NAME stty -- set mode of typewriter

SYNOPSIS (file descriptor in r0)


sys stty; arg / stty = 31.
arg: dcrsr; dctsr; mode

DESCRIPTION st
_ _t
_y_ sets mode bits for a typewriter whose file
descriptor is passed in r0. First, the system
delays until the typewriter is quiescent. Then,
the argument d _c
_r_s
_r_ is placed into the typewri-
ter’s receiver control and status register, and
_c
d _t
_s_r
_ is placed in the transmitter control and
status register. The DC-11 manual must be con-
sulted for the format of these words. For the
purpose of this call, the most important ro ^le of
these arguments is to adjust to the speed of the
typewriter.

The m
_o_d
_e_ argument contains several bits which de-
termine the system’s treatment of the typewriter:

200 even parity allowed on input (e. g. for M37s)


100 odd parity allowed on input
040 raw mode: wake up on all characters
020 map CR into LF; echo LF or CR as LF-CR
010 echo (full duplex)
004 map upper case to lower on input (e. g. M33)
002 echo and print tabs as spaces
001 inhibit all function delays (e. g. CRTs)

Characters with the wrong parity, as determined


by bits 200 and 100, are ignored.

In raw mode, every character is passed back imme-


diately to the program. No erase or kill pro-
cessing is done; the end-of-file character (EOT),
the interrupt character (DELETE) and the quit
character (FS) are not treated specially.

Mode 020 causes input carriage returns to be


turned into new-lines; input of either CR or LF
causes LF-CR both to be echoed (used for GE Ter-
miNet 300’s and other terminals without the new-
line function).

Additional bits in the high order byte of the


mode argument are used to indicate that the ter-
minal is an IBM 2741 and to specify 2741 modes.
These mode bits are:

400 terminal is an IBM 2741


1000 the 2741 has the transmit interrupt feature
(currently ignored)
2000 use correspondence code conversion on output

- 1 -
STTY (II) 6/12/72 STTY (II)

4000 use correspondence code conversion on input


(currently ignored)

Normal input and output code conversion for 2741s


is EBCDIC (e. g. 963 ball and corresponding key-
board). The presence of the transmit interrupt
feature permits the system to do read-ahead while
no output is in progress. In 2741 mode, the low
order bits 331 are ignored.

SEE ALSO stty(I), gtty(II)

DIAGNOSTICS The error bit (c-bit) is set if the file descrip-


tor does not refer to a typewriter.

BUGS This call should be used with care.

- 2 -
SYNC (II) 6/12/72 SYNC (II)

NAME sync -- update super-block

SYNOPSIS sys sync / sync = 36.; not in assembler

DESCRIPTION sy
_ _n
_c_ causes the super block for all file systems
to be written out. It is only necessary on sys-
tems in which this writing may be delayed for a
long time, i.e., those which incorporate hardware
protection facilities.

It should be used by programs which examine a


file system, for example check, df, tm, etc.

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
TIME (II) 3/15/72 TIME (II)

NAME time -- get time of year

SYNOPSIS sys time / time = 13.


(time r0-r1)

DESCRIPTION ti
_ _m
_e_ returns the time since [Link], Jan. 1,
1972, measured in sixtieths of a second. The
high order word is in the r0 register and the low
order is in the r1.

SEE ALSO date(I), mdate(II)

DIAGNOSTICS --

BUGS The time is stored in 32 bits. This guarantees a


crisis every 2.26 years.

- 1 -
TIMES(II) 2/10/73 TIMES(II)

NAME times -- get process times

SYNOPSIS sys times; buffer / times = 43.; not in assembler


buffer: .=.+[24.*3]

DESCRIPTION ti
_ _m
_e_s
_ returns time-accounting information for the
system as a whole, for the current process, and
for the terminated child processes of the current
process. All the times are 2-word (32-bit) num-
bers, and the unit of measurement is 1/60 second.

After the call, the buffer will appear as fol-


lows:

buffer:
system: .=.+4 / absolute time
.=.+4 / total system time
.=.+4 / total swap time
.=.+4 / other I/O wait time
.=.+4 / idle time
.=.+4 / total user time

process: .=.+4 / (ignore)


.=.+4 / time in system
.=.+4 / (ignore)
.=.+4 / I/O wait time
.=.+4 / (ignore)
.=.+4 / processor time

child: .=.+24.

The format of the "child" times is the same as


that for the process times; the numbers are the
sum of the times for all terminated direct or in-
direct descendants of the current process.

The "absolute" time returned is the same as that


given by time(II). The "total system times" are
times since the last cold boot.

FILES --

SEE ALSO time(II), time(I)

DIAGNOSTICS --

BUGS --

- 1 -
UMOUNT (II) 3/15/72 UMOUNT (II)

NAME umount -- dismount file system

SYNOPSIS sys umount; special / umount = 22.

DESCRIPTION um
_ _o
_u_n
_t_ announces to the system that special file
_p
s _e
_c_i
_a_l
_ is no longer to contain a removable file
system. The file associated with the special
file reverts to its ordinary interpretation (see
_o
m _u
_n_t
_).

The user must take care that all activity on the


file system has ceased.

SEE ALSO umount(I), mount(II)

DIAGNOSTICS Error bit (c-bit) set if no file system was


mounted on the special file.

BUGS Use of this call should be restricted to the su-


per-user.

- 1 -
UNLINK (II) 3/15/72 UNLINK (II)

NAME unlink -- remove directory entry

SYNOPSIS sys unlink; name / unlink = 10.

DESCRIPTION Na
_ _m
_e_ points to a null-terminated string. U
_n_l
_i_n
_k_
removes the entry for the file pointed to by n _a
_m_e_
from its directory. If this entry was the last
link to the file, the contents of the file are
freed and the file is destroyed. If, however,
the file was open in any process, the actual de-
struction is delayed until it is closed, even
though the directory entry has disappeared.

SEE ALSO rm(I), rmdir(I), link(II)

DIAGNOSTICS The error bit (c-bit) is set to indicate that the


file does not exist or that its directory cannot
be written. Write permission is not required on
the file itself. It is also illegal to unlink a
directory (except for the super-user).

BUGS --

- 1 -
WAIT (II) 9/4/72 WAIT (II)

NAME wait -- wait for process to die

SYNOPSIS sys wait / wait = 7.


(process ID in r0)
(termination status/user status in r1)

DESCRIPTION wa
_ _i
_t_ causes its caller to delay until one of its
child processes terminates. If any child has
died since the last w _a
_i_t
_, return is immediate; if
there are no children, return is immediate with
the error bit set. In the case of several chil-
dren several w _a
_i_t
_s are needed to learn of all the
deaths.

If the error bit is not set on return, the r1


high byte contains the low byte of the child
process r0 when it terminated. The r1 low byte
contains the termination status of the process
from the following list:

0 exit
1 bus error
2 illegal instruction
3 trace trap
4 IOT trap
5 power fail trap
6 EMT trap
7 bad system call
8 PIR interrupt
9 floating point exception
10 memory violation
11 quit
12 interrupt
13 kill (see kill(II))
14 User I/O (not currently possible)
+16 core image produced

SEE ALSO exit(II), fork(II)

DIAGNOSTICS error bit (c-bit) on if no children not previous-


ly waited for.

BUGS A child which dies, but is never waited for con-


sumes a slot in the process table. When this ta-
ble is full, the system is effectively hung.

- 1 -
WRITE (II) 3/15/72 WRITE (II)

NAME write -- write on file

SYNOPSIS (file descriptor in r0)


sys write; buffer; nbytes / write = 4.
(number written in r0)

DESCRIPTION A file descriptor is a word returned from a suc-


cessful o
_p_e
_n_ or c
_r_e
_a_t
_ call.

bu
_ _f
_f_e
_r_ is the address of n
_b_y
_t_e
_s_ contiguous bytes
which are written on the output file. The number
of characters actually written is returned in r0.
It should be regarded as an error if this is not
the same as requested.

Writes which are multiples of 512 characters long


and begin on a 512-byte boundary are more effi-
cient than any others.

SEE ALSO creat(II), open(II)

DIAGNOSTICS The error bit (c-bit) is set on an error: bad de-


scriptor, buffer address, or count; physical I/O
errors.

BUGS --

- 1 -
ATAN, ATAN2 (III) 1/15/73 ATAN, ATAN2 (III)

NAME atan -- arc tangent function

SYNOPSIS jsr r5,atan[2]

DESCRIPTION The atan entry returns the arc tangent of fr0 in


fr0. The range is -J/2 to J/2.

The atan2 entry returns the arc tangent of


fr0/fr1 in fr0. The range is -J to J.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS there is no error return

BUGS --

- 1 -
ATOF (III) 1/15/73 ATOF (III)

NAME atof -- ascii to floating

SYNOPSIS jsr r5,atof; subr

DESCRIPTION at
_ _o
_f_ will convert an ascii stream to a floating
number returned in fr0.

The subroutine s_u


_b_r
_ (supplied by the caller) is
called on r5 for each character of the ascii
stream. s_u
_b_r
_ should return the character in r0.
The first character not used in the conversion is
left in r0.

The only numbers recognized are: an optional mi-


nus sign followed by a string of digits optional-
ly containing one decimal point, then followed
optionally by the letter "e" followed by a signed
integer.

The subroutine s
_u_b
_r_ must not disturb any regis-
ters.

FILES kept in /lib/liba.a

SEE ALSO Calls atoi (III)

DIAGNOSTICS There are none; overflow results in a very large


number and garbage characters terminate the scan.

BUGS The routine should accept initial "+", initial


blanks, and "E" for "e".

Overflow should be signalled with the carry bit.

- 1 -
ATOI (III) 1/15/73 ATOI (III)

NAME atoi -- ascii to integer

SYNOPSIS jsr r5,atoi; subr

DESCRIPTION at
_ _o
_i_ will convert an ascii stream to a binary
number returned in r1.

The subroutine s_u


_b_r
_ (supplied by the caller) is
called on r5 for each character of the ascii
stream. s_u
_b_r
_ should return the character in r0.
The first character not used in the conversion is
left in r0.

The numbers recognized are: an optional minus


sign followed by a string of digits.

The subroutine s
_u_b
_r_ must not disturb any regis-
ters.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS There are none; the routine charges on regardless


of consequences; see BUGS.

BUGS It pays no attention to overflow - you get what-


ever the machine instructions mul and div happen
to leave in the low order half - in fact, the
carry bit should be set and isn’t.

The routine should accept initial "+" and initial


blanks.

- 1 -
COMPAR (III) 1/15/73 COMPAR (III)

NAME compar -- default comparison routine for qsort

SYNOPSIS jsr pc,compar

DESCRIPTION Compar is the default comparison routine called


by qsort and is separated out so that the user
can supply his own comparison.

The routine is called with the width (in bytes)


of an element in r3 and it compares byte-by-byte
the element pointed to by r0 with the element
pointed to by r4.

Return is via the condition codes, which are


tested by the instructions "blt" and "bgt". That
is, in the absence of overflow, then the condi-
tion (r0) < (r4) should leave the Z-bit off and
N-bit on while (r0) > (r4) should leave Z and N
off. Still another way of putting it is that
for elements of length 1 the instruction

cmpb (r0),(r4)

suffices.

Only r0 is changed by the call.

FILES kept in /lib/liba.a

SEE ALSO qsort (III)

DIAGNOSTICS --

BUGS It could be recoded to run faster.

- 1 -
CRYPT (III) 1/15/73 CRYPT (III)

NAME crypt -- password encoding

SYNOPSIS mov $key,r0


jsr pc,crypt

DESCRIPTION On entry, r0 should point to a string of charac-


ters terminated by an ASCII NULL. The routine
performs an operation on the key which is diffi-
cult to invert (i.e. encrypts it) and leaves the
resulting eight bytes of ASCII alphanumerics in a
global cell called "word".

Login uses this result as a password.

FILES kept in /lib/liba.a

SEE ALSO passwd(I),passwd(V), login(I)

DIAGNOSTICS there are none; garbage is accepted.

BUGS --

- 1 -
CTIME (III) 1/15/73 CTIME (III)

NAME ctime -- convert date and time to ASCII

SYNOPSIS sys time


mov $buffer,r2
jsr pc,ctime

DESCRIPTION The output buffer is 16 characters long and the


time has the format

Oct 9 [Link]\0

The input time must be in the r0 and r1 registers


in the form returned by s
_y_s
_ t
_i_m
_e_.

FILES kept in /lib/liba.a

SEE ALSO ptime(III), time(II)

DIAGNOSTICS --

BUGS The routine must be reassembled for leap year.


Dec 31 is followed by Dec 32 and so on.

- 1 -
DDSPUT, DDSINIT (III) 1/15/73 DDSPUT, DDSINIT (III)

NAME ddsput -- put a character on display data set

SYNOPSIS (file descriptor in r0)


jsr pc,ddsinit

(character in r0)
jsr pc,ddsput

DESCRIPTION These routines provide an interface to the Dis-


play Data Set, a peculiar device which can be
called by Picturephone sets and which will dis-
play some of the ASCII character set and certain
other graphics on the Picturephone screen.

If the DC11 or other interface hardware is not


already set up to talk to the Display Data Set,
the d
_d_s
_i_n
_i_t
_ entry should be called with the ap-
propriate file descriptor in r0. On the only
known DDS attached to UNIX, the associated spe-
cial file is called "/dev/ttyc". d _d
_s_i
_n_i
_t_ also
clears the display.

Thereafter, characters may be displayed by call-


ing d
_d_s
_p_u
_t_. To the extent possible, d
_d_s
_p_u
_t_ simu-
lates an ordinary terminal. Characters falling
to the right of the 22X22 screen area are ig-
nored; the 23rd line on the screen causes the
screen to be erased and that line to be put at
the top of the new display. Certain ASCII char-
acters are interpreted specially as follows:

FF clear screen, go to top left


HT expand to right number of spaces
DC1 treat as reverse line feed (move N)
DC2 move cursor 1 place right (move E)
DC3 forward line feed (move S)
DC4 backspace 1 position (move W)
SO enter graph mode
SI leave graph mode
CR put cursor at start of current line

Graph mode allows display of the non-ASCII char-


acters and will be described when hell freezes
over.

Lower-case ASCII alphabetics are mapped into up-


per case. Several ASCII non-alphabetic graphics
are unavailable as well. Also the lower right
circle of the "%" character is missing. Also one
of the circuit cards in the DDS has a crack in it
and sometimes it doesn’t work. All in all, it is
best to avoid this device.

FILES kept in /lib/liba.a

- 1 -
DDSPUT, DDSINIT (III) 1/15/73 DDSPUT, DDSINIT (III)

SEE ALSO AT&T writeup on DDS

DIAGNOSTICS --

BUGS yes

- 2 -
ECVT, FCVT (III) 1/15/73 ECVT, FCVT (III)

NAME ecvt, fcvt -- output conversion

SYNOPSIS jsr pc,ecvt

or

jsr pc,fcvt

DESCRIPTION Ecvt is called with a floating point number in


fr0.

On exit, the number has been converted into a


string of ascii digits in a buffer pointed to by
r0. The number of digits produced is controlled
by a global variable "_ndigits".

Moreover, the position of the decimal point is


contained in r2: r2=0 means the d.p. is at the
left hand end of the string of digits; r2>0 means
the d.p. is within or to the right of the string.

The sign of the number is indicated by r1 (0 for


+; 1 for -).

The low order digit has suffered decimal rounding


(i. e. may have been carried into).

Fcvt is identical to ecvt, except that the cor-


rect digit has had decimal rounding for F-style
output of the number of digits specified by
"_ndigits".

FILES kept in /lib/liba.a

SEE ALSO ftoa(III)

DIAGNOSTICS --

BUGS --

- 1 -
EXP (III) 1/15/73 EXP (III)

NAME exp -- exponential function

SYNOPSIS jsr r5,exp

DESCRIPTION The exponential of fr0 is returned in fr0.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS If the result is not representable, the c-bit is


set and the largest positive number is returned.

Zero is returned if the result would underflow.

BUGS ---

- 1 -
FTOA (III) 1/15/73 FTOA (III)

NAME ftoa -- floating to ascii conversion

SYNOPSIS jsr r5,ftoa; subr

DESCRIPTION ft
_ _o
_a_ will convert the floating point number in
fr0 into ascii in the form

[-][Link]*

if possible, otherwise in the form

[-][Link]
_[-]dd*.

For each character generated by ftoa, the subrou-


tine s
_u_b
_r_ (supplied by the caller) is called on
register r5 with the character in r0.

The number of digits can be changed by changing


the value of "_ndigits" in ecvt (default is 10.).

The subroutine s
_u_b
_r_ must not disturb any regis-
ters.

FILES kept in /lib/liba.a

SEE ALSO ecvt(III), itoa(III)

DIAGNOSTICS --

BUGS --

- 1 -
FTOO (III) 1/15/73 FTOO (III)

NAME ftoo -- floating to octal conversion

SYNOPSIS jsr r5,ftoo; subr

DESCRIPTION ftoo wil convert the floating point number in fr0


into ascii in the conventional octal form

000000;000000;000000;000000

For each character generated by ftoo, the subrou-


tine s
_u_b
_r_ (supplied by the caller) is called on
register r5 with the character in r0.

The subroutine s
_u_b
_r_ must not disturb any regis-
ters.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
CONNECT, GERTS (III) 3/15/72 CONNECT, GERTS (III)

NAME connect, gerts -- Gerts communication over 201

SYNOPSIS jsr r5,connect


(error return)

jsr r5,gerts; fc; oc; ibuf; obuf


(error return)

other entry points: gcset, gout

DESCRIPTION The GCOS GERTS interface is so bad that a de-


scription here is inappropriate. Anyone needing
to use this interface should seek divine guid-
ance.

FILES /dev/dn0, /dev/dp0


kept in /lib/liba.a

SEE ALSO dn(IV), dp(IV), HIS documentation

DIAGNOSTICS --

BUGS --

- 1 -
GETC, GETW, FOPEN (III) 3/15/72 GETC, GETW, FOPEN (III)

NAME getw, getc, fopen -- buffered input

SYNOPSIS mov $filename,r0


jsr r5,fopen; iobuf

jsr r5,getc; iobuf


(character in r0)

jsr r5,getw; iobuf


(word in r0)

DESCRIPTION These routines are used to provide a buffered in-


put facility. i_o
_b_u
_f_ is the address of a 518(10)
byte buffer area whose contents are maintained by
these routines. Its format is:

ioptr: .=.+2 / file descriptor


.=.+2 / characters left in buffer
.=.+2 / ptr to next character
.=.+512. / the buffer

fo
_ _p
_e_n
_ may be called initially to open the file.
On return, the error bit (c-bit) is set if the
open failed. If f _o
_p_e
_n_ is never called, g
_e_t
_ will
read from the standard input file.

ge
_ _t
_c_ returns the next byte from the file in r0.
The error bit is set on end of file or a read er-
ror.

ge
_ _t
_w_ returns the next word in r0. g
_e_t
_c_ and g
_e_t
_w_
may be used alternately; there are no odd/even
problems.

io
_ _b
_u_f
_ must be provided by the user; it must be on
a word boundary.

To reuse the same buffer for another file, it is


sufficient to close the original file and call
_o
f _p
_e_n
_ again.

FILES kept in /lib/liba.a

SEE ALSO open(II), read(II), putc(III)

DIAGNOSTICS c-bit set on EOF or error

BUGS --

- 1 -
HYPOT (III) 6/12/72 HYPOT (III)

NAME hypot -- calculate hypotenuse

SYNOPSIS movf a,fr0


movf b,fr1
jsr r5,hypot
movf fr0,...

DESCRIPTION The square root of fr0*fr0 + fr1*fr1 is returned


in fr0. The calculation is done in such a way
that overflow will not occur unless the answer is
not representable in floating point.

FILES kept in /lib/liba.a

SEE ALSO sqrt(III)

DIAGNOSTICS The c-bit is set if the result cannot be repre-


sented.

BUGS --

- 1 -
ITOA (III) 3/15/72 ITOA (III)

NAME itoa -- integer to ascii conversion

SYNOPSIS jsr r5,itoa; subr

DESCRIPTION it
_ _o
_a_ will convert the number in r0 into ascii
decimal preceded by a - sign if appropriate. For
each character generated by itoa, the subroutine
_u
s _b
_r_ (supplied by the caller) is called on regis-
ter r5 with the character in r0.

The subroutine s
_u_b
_r_ must not disturb any regis-
ters.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
LOG (III) 3/15/72 LOG (III)

NAME log -- logarithm (base e)

SYNOPSIS jsr r5,log

DESCRIPTION The logarithm (base e) of fr0 is returned in fr0.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS The error bit (c-bit) is set if the input argu-


ment is less than or equal to zero and the result
is set to the largest negative number.

BUGS --

- 1 -
MESG (III) 3/15/72 MESG (III)

NAME mesg -- write message on typewriter

SYNOPSIS jsr r5,mesg; <Now is the time\0>; .even

DESCRIPTION me
_ _s
_g_ writes the string immediately following its
call onto the standard output file. The string
must be terminated by an ASCII NULL byte.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
NLIST (III) 6/12/72 NLIST (III)

NAME nlist -- get entries from name list

SYNOPSIS jsr r5,nlist; file; list


file: <file name\0>; .even
list:
<name1xxx>; type1; value1
<name2xxx>; type2; value2
0

DESCRIPTION nl
_ _i
_s_t
_ will examine the name list in the given as-
sembler output file and selectively extract a
list of values. The name list consists of a list
of 8-character names (null padded) each followed
by two words. The list is terminated with a ze-
ro. Each name is looked up in the name list of
the file. If the name is found, the type and
value of the name are placed in the two words
following the name. If the name is not found,
the type entry is set to -1.

This subroutine is useful for examining the sys-


tem name list kept in the file /sys/sys/unix. In
this way programs can obtain system ’magic’ num-
bers that are up to date.

FILES kept in /lib/liba.a

SEE ALSO [Link](V)

DIAGNOSTICS All type entries are set to -1 if the file cannot


be found or if it is not a valid namelist.

BUGS --

- 1 -
POW (III) 1/15/73 POW (III)

NAME pow -- floating exponentiation x^y

SYNOPSIS movf x,fr0


movf y,fr1
jsr pc,pow
movf fr0,...

DESCRIPTION The value of x^y (i.e. xy) is returned in fr0.

0^x returns zero for all x.

(-x)^y returns a result only if y is an integer.

FILES kept in /lib/liba.a

SEE ALSO exp(III), log(III)

DIAGNOSTICS The carry bit is set on return in case of over-


flow or in case of 0^0 or (-x)^y for y non-inte-
ger.

BUGS --

- 1 -
PTIME (III) 3/15/72 PTIME (III)

NAME ptime -- print date and time

SYNOPSIS sys time


mov file,r2
jsr pc,ptime

DESCRIPTION _t
p _i
_m_e
_ prints the date and time in the form

Oct 9 [Link].sp on the file whose file


descriptor is in r2. The string is 15 characters
long. The time to be printed must be placed in
the r0 and r1 registers in the form returned by
_y
s _s
_ t
_i_m
_e_.

FILES kept in /lib/liba.a

SEE ALSO time(II), ctime(III) (used to do the conversion)

DIAGNOSTICS --

BUGS see ctime

- 1 -
PUTC,PUTW,FCREAT,FLUSH (III) 6/12/72 PUTC,PUTW,FCREAT,FLUSH (III)

NAME putc, putw, fcreat, flush -- buffered output

SYNOPSIS mov $filename,r0


jsr r5,fcreat; iobuf

(get byte in r0)


jsr r5,putc; iobuf

(get word in r0)


jsr r5,putw; iobuf

jsr r5,flush; iobuf

DESCRIPTION fc
_ _r
_e_a
_t_ creates the given file (mode 17) and sets
up the buffer i _o
_b_u
_f_ (size 518(10) bytes); p
_u_t
_c_
and p _u_t
_w_ write a byte or word respectively onto
the file; f _l
_u_s
_h_ forces the contents of the buffer
to be written, but does not close the file. The
format of the buffer is:

iobuf: .=.+2 / file descriptor


.=.+2 / characters unused in buffer
.=.+2 / ptr to next free character
.=.+512. / buffer

fc
_ _r
_e_a
_t_ sets the error bit (c-bit) if the file
creation failed; none of the other routines re-
turn error information.

Before terminating, a program should call f


_l_u
_s_h
_
to force out the last of the output.

The user must supply i


_o_b
_u_f
_, which should begin on
a word boundary.

To write a new file using the same buffer, it


suffices to call f
_l_u
_s_h
_, close the file, and call
_c
f _r
_e_a
_t_ again.

FILES kept in /lib/liba.a

SEE ALSO creat(II), write(II), getc(III)

DIAGNOSTICS error bit possible on f


_c_r
_e_a
_t_ call

BUGS --

- 1 -
QSORT (III) 6/12/72 QSORT (III)

NAME qsort -- quicker sort

SYNOPSIS (base of data in r1)


(end+1 of data in r2)
(element width in r3)
jsr pc,qsort

DESCRIPTION qs
_ _o
_r_t
_ is an implementation of the quicker sort
algorithm. It is designed to sort equal length
elements. Registers r1 and r2 delimit the region
of core containing the array of byte strings to
be sorted: r1 points to the start of the first
string, r2 to the first location above the last
string. Register r3 contains the length of each
string. r2-r1 should be a multiple of r3. On
return, r0, r1, r2, r3, r4 are destroyed.

The routine compar (q.v.) is called to compare


elements and may be replaced by the user.

FILES kept in /lib/liba.a

SEE ALSO compar(III)

DIAGNOSTICS --

BUGS It scribbles on r4.

- 1 -
RAND (III) 1/15/73 RAND (III)

NAME rand -- random number generator

SYNOPSIS jsr pc,srand /to initialize


jsr pc,rand /to get a random number

DESCRIPTION The routine uses a multiplicative congruential


random number generator to return successive
pseudo-random numbers in r0 in the range from 1
to 2^15-1.

The generator is reinitialized by calling srand


with 1 in r0.

It can be set to a random starting point by call-


ing srand with whatever you like in r0, for exam-
ple the result left in r1 from s
_y_s
_ t
_i_m
_e_.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS --

BUGS --

WARNING The author of this routine has been writing ran-


dom-number generators for many years and has nev-
er been known to write one that worked.

- 1 -
SALLOC (III) 6/15/72 SALLOC (III)

NAME salloc -- string manipulation routines

SYNOPSIS (get size in r0)


jsr pc,allocate

(get source pointer in r0,


destination pointer in r1)
jsr pc,copy

jsr pc,wc

(all following instructions assume r1 contains pointer)

jsr pc,release

(get character in r0)


jsr pc,putchar

jsr pc,lookchar
(character in r0)

jsr pc,getchar
(character in r0)

(get character in r0)


jsr pc,alterchar

(get position in r0)


jsr pc,seekchar

jsr pc,backspace
(character in r0)

(get word in r0)


jsr pc,putword

jsr pc,lookword
(word in r0)

jsr pc,getword
(word in r0)

(get word in r0)


jsr pc,alterword

jsr pc,backword
(word in r0)

jsr pc,length
(length in r0)

jsr pc,position
(position in r0)

- 1 -
SALLOC (III) 6/15/72 SALLOC (III)

jsr pc,rewind

jsr pc,create

jsr pc,fsfile

jsr pc,zero

DESCRIPTION This package is a complete set of routines for


dealing with almost arbitrary length strings of
words and bytes. The strings are stored on a
disk file, so the sum of their lengths can be
considerably larger than the available core.

For each string there is a header of four words,


namely a write pointer, a read pointer and point-
ers to the beginning and end of the block con-
taining the string. Initially the read and write
pointers point to the beginning of the string.
All routines that refer to a string require the
header address in r1. Unless the string is de-
stroyed by the call, upon return r1 will point to
the same string, although the string may have
grown to the extent that it had to be be moved.

__
a l_
l_o_
c_a_
t_e obtains a string of the requested size
and returns a pointer to its header in r1.

_e
r _l
_e_a
_s_e
_ releases a string back to free storage.

pu
_ _t
_c_h
_a_r
_ and p
_u_t
_w_o
_r_d
_ write a byte or word respec-
tively into the string and advance the write
pointer.

__
l o_
o_k_
c_h_
a_r and _
l_o_
o_k_
w_o_
r_d read a byte or word respec-
tively from the string but do not advance the
read pointer.

ge
_ _t
_c_h
_a_r
_ and g
_e_t
_w_o
_r_d
_ read a byte or word respec-
tively from the string and advance the read
pointer.

al
_ _t
_e_r
_c_h
_a_r
_ and a
_l_t
_e_r
_w_o
_r_d
_ write a byte or word re-
spectively into the string where the read pointer
is pointing and advance the read pointer.

ba
_ _c
_k_s
_p_a
_c_e
_ and b
_a_c
_k_w
_o_r
_d_ read the last byte or word
written and decrement the write pointer.

All write operations will automatically get a


larger block if the current block is exceeded.
All read operations return with the error bit set
if attempting to read beyond the write pointer.

- 2 -
SALLOC (III) 6/15/72 SALLOC (III)

se
_ _e
_k_c
_h_a
_r_ moves the read pointer to the offset
specified in r0.

le
_ _n
_g_t
_h_ returns the current length of the string
(beginning pointer to write pointer) in r0.

po
_ _s
_i_t
_i_o
_n_ returns the current offset of the read
pointer in r0.

re
_ _w
_i_n
_d_ moves the read pointer to the beginning of
the string.

cr
_ _e
_a_t
_e_ returns the read and write pointers to the
beginning of the string.

fs
_ _f
_i_l
_e_ moves the read pointer to the current po-
sition of the write pointer.

ze
_ _r
_o_ zeros the whole string and sets the write
pointer to the beginning of the string.

co
_ _p
_y_ copies the string whose header pointer is in
r0 to the string whose header pointer is in r1.
Care should be taken in using the copy instruc-
tion since r1 will be changed if the contents of
the source string is bigger than the destination
string.

wc
_ _ forces the contents of the internal buffers
and the header blocks to be written on disc.

FILES The allocator is in /lib/libs.a; the -_s


_ option to
_d
l _ will link edit references to the allocator.

alloc.d is the temporary file used to contain the


strings.

SEE ALSO --

DIAGNOSTICS "error in copy" if a disk write error occurs dur-


ing the execution of the copy instruction. "er-
ror in allocator" if any routine is called with a
bad header pointer. "Cannot open output file" if
file alloc.d cannot be created or opened. "Out
of space" if there’s no available block of the
requested size or no headers available for a new
block.

BUGS --

- 3 -
SIN, COS (III) 3/15/72 SIN, COS (III)

NAME sin, cos -- sine cosine

SYNOPSIS jsr r5,sin (cos)

DESCRIPTION The sine (cosine) of fr0 in radians is returned


in fr0.

The magnitude of the argument should be checked


by the caller to make sure the result is meaning-
ful.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS there are none

BUGS --

- 1 -
SQRT (III) 3/15/72 SQRT (III)

NAME sqrt -- square root function

SYNOPSIS jsr r5,sqrt

DESCRIPTION The square root of fr0 is returned in fr0.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS The c-bit is set on negative arguments and 0 is


returned.

BUGS --

- 1 -
SWITCH (III) 3/15/72 SWITCH (III)

NAME switch -- switch on value

SYNOPSIS (switch value in r0)


jsr r5,switch; swtab
(not-found return)
swtab: val1; lab1;
valn; labn

DESCRIPTION sw
_ _i
_t_c
_h_ compares the value of r0 against each of
the vali; if a match is found, control is trans-
ferred to the corresponding labi (after popping
the stack once). If no match has been found by
the time a null labi occurs, s _w
_i_t
_c_h
_ returns.

FILES kept in /lib/liba.a

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
TTYN (III) 1/15/73 TTYN (III)

NAME ttyn -- return name of current tty

SYNOPSIS jsr pc,ttyn

DESCRIPTION The routine hunts up the name of the input tty


attached to the process (one byte from the set
{012345678abc} at present) and returns it in r0.

"x" is returned if no genuine input tty is at-


tached to the process.

FILES kept in /lib/liba.a

SEE ALSO fstat(II)

DIAGNOSTICS --

BUGS --

- 1 -
DC (IV) 6/12/72 DC (IV)

NAME dc -- DC-11 communications interfaces

DESCRIPTION
The special files /dev/tty0, /dev/tty1, ... refer to the
DC11 asynchronous communications interfaces. At the mo-
ment there are ten of them, but the number is subject to
change.

When one of these files is opened, it causes the process


to wait until a connection is established. (In practice,
however, user’s programs seldom open these files; they
are opened by i
_n_i
_t_ and become a user’s standard input and
output file.) The very first typewriter file open in a
process becomes the c _o
_n_t
_r_o
_l_ t
_y_p
_e_w
_r_i
_t_e
_r_ for that process.
The control typewriter plays a special role in handling
quit or interrupt signals, as discussed below. The con-
trol typewriter is inherited by a child process during a
_o
f _r
_k_.

A terminal associated with one of these files ordinarily


operates in full-duplex mode. Characters may be typed at
any time, even while output is occurring, and are only
lost when the system’s character input buffers become
completely choked, which is rare, or when the user has
accumulated the maximum allowed number of input charac-
ters which have not yet been read by some program. Cur-
rently this limit is 150 characters. When this is hap-
pening the character "#" is echoed for every lost input
character.

When first opened, the interface mode is ASCII charac-


ters; 150 baud; even parity only accepted; 10 bits/char-
acter (one stop bit); and newline action character. The
system delays transmission after sending certain function
characters. Delays for horizontal tab, newline, and form
feed are calculated for the Teletype Model 37; the delay
for carriage return is calculated for the GE Ter-
miNet 300. Most of these operating states can be changed
by using the system call stty(II). In particular the
following hardware states are program settable indepen-
dently for input and output (see DC11 manual): 134.5,
150, 300, or 1200 baud; one or two stop bits on output;
and 5, 6, 7, or 8 data bits/character. In addition, the
following software modes can be invoked: acceptance of
even parity, odd parity, or both; a raw mode in which all
characters may be read one at a time; a carriage return
(CR) mode in which CR is mapped into newline on input and
either CR or line feed (LF) cause echoing of the sequence
LF-CR; mapping of upper case letters into lower case;
suppression of echoing; suppression of delays after func-
tion characters; the printing of tabs as spaces; and set-
ting the system to handle IBM 2741s. See getty(VII) for
the way that terminal speed and type are detected.

- 1 -
DC (IV) 6/12/72 DC (IV)

Normally, typewriter input is processed in units of


lines. This means that a program attempting to read will
be suspended until an entire line has been typed. Also,
no matter how many characters are requested in the read
call, at most one line will be returned. It is not how-
ever necessary to read a whole line at once; any number
of characters may be requested in a read, even one, with-
out losing information.

During input, erase and kill processing is normally done.


The character "#" erases the last character typed, except
that it will not erase beyond the beginning of a line or
an EOT. The character "@" kills the entire line up to
the point where it was typed, but not beyond an EOT.
Both these characters operate on a keystroke basis inde-
pendently of any backspacing or tabbing that may have
been done. Either "@" or "#" may be entered literally by
preceding it by "\"; the erase or kill character remains,
but the "\" disappears.

It is possible to use raw mode in which the program read-


ing is awakened on each character. In raw mode, no erase
or kill processing is done; and the EOT, quit and inter-
rupt characters are not treated specially.

The ASCII EOT character may be used to generate an end of


file from a typewriter. When an EOT is received, all the
characters waiting to be read are immediately passed to
the program, without waiting for a new-line. Thus if
there are no characters waiting, which is to say the EOT
occurred at the beginning of a line, zero characters will
be passed back, and this is the standard end-of-file sig-
nal. The EOT is not passed on except in raw mode.

When the carrier signal from the dataset drops (usually


because the user has hung up his terminal) any read re-
turns with an end-of-file indication. Thus programs
which read a typewriter and test for end-of-file on their
input can terminate appropriately when hung up on.

Two characters have a special meaning when typed. The


ASCII DEL character (sometimes called "rubout") is the
_n
i _t
_e_r
_r_u
_p_t
_ signal. When this character is received from a
given typewriter, a search is made for all processes
which have this typewriter as their control typewriter,
and which have not informed the system that they wish to
ignore interrupts. If there is more than one such
process, one of these is selected, for practical purposes
at random. The process is either forced to exit or a
trap is simulated to an agreed-upon location in the
process. See intr(II).

The ASCII character FS is the q


_u_i
_t_ signal. Its treatment
is identical to the interrupt signal except that unless

- 2 -
DC (IV) 6/12/72 DC (IV)

the receiving process has made other arrangements it will


not only be terminated but a core image file will be gen-
erated. See quit(II). The character is not passed on
except in raw mode.

Output is prosaic compared to input. When one or more


characters are written, they are actually transmitted to
the terminal as soon as previously-written characters
have finished typing. Input characters are echoed by
putting them in the output queue as they arrive. When a
process produces characters more rapidly than they can be
typed, it will be suspended when its output queue exceeds
some limit. When the queue has drained down to some
threshold the program is resumed. Even-parity is always
generated on output. The EOT character is not transmit-
ted to prevent terminals which respond to it from being
hung up.

The system will handle IBM 2741 terminals. See get-


ty(VII) for the way that 2741s are detected. In 2741
mode, the hardware state is: 134.5 baud; one output stop
bit; and 7 bits/character. Because the 2741 is inherent-
ly half-duplex, input is not echoed. Proper function de-
lays are provided. For 2741s without a feature known as
"transmit interrupt" it is not possible to collect input
ahead of the time that a program reads the typewriter,
because once the keyboard has been enabled there is no
way to send further output to the 2741. It is currently
assumed that the feature is absent; thus the keyboard is
unlocked only when some program reads. The interrupt
signal (normally ASCII DEL) is simulated when the 2741
"attention" key is pushed to generate either a 2741 style
EOT or a break. It is not possible to generate anything
corresponding to the end-of-file EOT or the quit signal.
Currently IBM EBCDIC is default for input and output;
correspondence code output is settable (see stty(I)).
The full ASCII character set is not available: "[", "]",
"{", "}", "˜", are missing on input and are printed as
blank on output; "c
|" is used for "\"; "_" for "^"; " "
for both "’" and"‘"on output; and " " maps into "’" on
input. Similar mappings occur with correspondence code
output.

FILES /dev/tty[01234567ab] 113B dataphones


/dev/ttyc display data set
/dev/ttyd 113B with /dev/dn1

SEE ALSO kl(IV), getty(VII)

BUGS The primarily Model 37 oriented delays may not be


appropriate for all other ASCII terminals.

- 3 -
DN (IV) 3/15/72 DN (IV)

NAME dn -- dn-11 ACU interface

DESCRIPTION dn
_ _?
_ is a write-only file. Bytes written on d
_n_?
_
must be ASCII as follows:

0-9 dial 0-9


: dial *
; dial #
= end-of-number

The entire telephone number must be presented in


a single w
_r_i
_t_e
_ system call.

It is recommended that an end-of-number code be


given even though only one of the ACU’s (113C)
actually requires it.

FILES /dev/dn0 connected to 801 with dp0


/dev/dn1 connected to 113C with ttyd
/dev/dn2 not currently connected

SEE ALSO dp(IV), dc(IV), write(II)

BUGS --

- 1 -
DP (IV) 3/15/72 DP (IV)

NAME dp -- dp-11 201 data-phone interface

DESCRIPTION dp
_ _?
_ is a 201 data-phone interface file. r _e
_a_d
_ and
_r
w _i
_t_e
_ calls to d
_p_?
_ are limited to a maximum of
400 bytes. Each write call is sent as a single
record. Seven bits from each byte are written
along with an eighth odd parity bit. The sync
must be user supplied. Each read call returns
characters received from a single record. Seven
bits are returned unaltered; the eighth bit is
set if the byte was not received in odd parity.
A 20 second time out is set and a zero byte
record is returned if nothing is received in that
time.

FILES /dev/dp0 201 dataphone used to call GCOS

SEE ALSO dn(IV), gerts(III)

BUGS The d
_p_ file is GCOS oriented. It should be more
flexible.

- 1 -
KL (IV) 3/15/72 KL (IV)

NAME kl -- KL-11/TTY-33 console typewriter

DESCRIPTION tt
_ _y
_ (as distinct from t
_t_y
_?_) refers to the console
typewriter hard-wired to the PDP-11 via a KL-11
interface.

Generally, the disciplines involved in dealing


with t
_t_y
_ are similar to those for t
_t_y
_?_ and sec-
tion dc(IV) should be consulted. The following
differences are salient:

The system calls s


_t_t
_y_ and g
_t_t
_y_ do not apply to
this device. It cannot be placed in raw mode; on
input, upper case letters are always mapped into
lower case letters; a carriage return is echoed
when a line-feed is typed.

The quit character is not FS (as with t


_t_y
_?_) but
is generated by the key labelled "alt mode."

By appropriate console switch settings, it is


possible to cause UNIX to come up as a single-us-
er system with I/O on this device.

FILES /dev/tty
/dev/tty8 synonym for /dev/tty

SEE ALSO dc(IV), init(VII)

BUGS --

- 1 -
MEM (IV) 3/15/72 MEM (IV)

NAME mem -- core memory

DESCRIPTION me
_ _m
_ is a special file that is an image of the
core memory of the computer. It may be used, for
example, to examine, and even to patch the system
using the debugger.

Me
_ _m
_ is a byte-oriented file; its bytes are num-
bered 0 to 65,535.

If a non-existent memory location is referenced,


the user suffers the resultant bus error.

Memory referenced through the file is treated


with m
_o_v
_b_ instructions. Certain device registers
do not implement DATOB cycles to odd addresses.
Other registers react strangely to this address-
ing.

FILES /dev/mem

SEE ALSO --

BUGS --

- 1 -
PC (IV) 3/15/72 PC (IV)

NAME pc -- PC-11 paper tape reader/punch

DESCRIPTION pp
_ _t
_ refers to the PC-11 paper tape reader or
punch, depending on whether it is read or writ-
ten.

When p
_p_t
_ is opened for writing, a 100-character
leader is punched. Thereafter each byte written
is punched on the tape. No editing of the char-
acters is performed. When the file is closed, a
100-character trailer is punched.

When p
_p_t
_ is opened for reading, the process waits
until tape is placed in the reader and the reader
is on-line. Then requests to read cause the
characters read to be passed back to the program,
again without any editing. This means that sev-
eral null leader characters will usually appear
at the beginning of the file. Likewise several
nulls are likely to appear at the end. End-of-
file is generated when the tape runs out.

Seek calls for this file are meaningless.

FILES /dev/ppt

SEE ALSO --

BUGS --

- 1 -
RF (IV) 3/15/72 RF (IV)

NAME rf -- RF11-RS11 fixed-head disk file

DESCRIPTION This file refers to the concatenation of both


RS-11 disks. It may be either read or written,
although writing is inherently very dangerous,
since a file system resides there.

The disk contains 2048 256-word blocks, numbered


0 to 2047. Like the other block-structured de-
vices (TC, RK) this file is addressed in blocks,
not bytes. This has two consequences: s_e
_e_k
_ calls
refer to block numbers, not byte numbers; and se-
quential reading or writing always advance the
read or write pointer by at least one block.
Thus successive reads of 10 characters from this
file actually read the first 10 characters from
successive blocks.

FILES /dev/rf0

SEE ALSO tc(IV), rk(IV)

BUGS The fact that this device is addressed in terms


of blocks, not bytes, is extremely unfortunate.
It is due entirely to the fact that read and
write pointers (and consequently the arguments to
_e
s _e
_k_) are single-precision numbers.

- 1 -
RK (IV) 3/15/72 RK (IV)

NAME rk -- RK-11/RK03 (or RK05) disk

DESCRIPTION rk
_ _?
_ refers to an entire RK03 disk as a single se-
quentially-addressed file. Its 256-word blocks
are numbered 0 to 4871. Like the RF disk and the
tape files, its addressing is block-oriented.
Consult the rf(IV) section.

FILES /dev/rk0 user available drive


/dev/rk1 /usr file system
/dev/rk2 /sys file system
/dev/rk3 /crp file system

SEE ALSO rf(IV), tc(IV)

BUGS See rf(IV)

- 1 -
TC (IV) 3/15/72 TC (IV)

NAME tc -- TC-11/TU56 DECtape

DESCRIPTION The files tap0 ... tap7 refer to the TC-11/TU56


DECtape drives 0 to 7. Since the logical drive
number can be manually set, all eight files exist
even though at present there are fewer physical
drives.

The 256-word blocks on a standard DECtape are


numbered 0 to 577. However, the system makes no
assumption about this number; a block can be read
or written if it exists on the tape and not oth-
erwise. An error is returned if a transaction is
attempted for a block which does not exist.

Addressing on the tape files, like that on the RK


and RF disks, is block-oriented.

FILES /dev/tap?

SEE ALSO rf(IV), tap(I)

BUGS see rf(IV)

- 1 -
TM (IV) 6/12/72 TM (IV)

NAME tm -- TM-11/TU-10 magtape interface

DESCRIPTION mt
_ _?
_ is the DEC TU10/TM11 magtape. When opened
for reading or writing, the magtape is rewound.
A tape consists of a series of 512 byte records
terminated by an end-of-file. Reading less than
512 bytes causes the rest of a record to be ig-
nored. Writing less than a record causes null
padding to 512 bytes. When the magtape is closed
after writing, an end-of-file is written.

Seek has no effect on the magtape. The magtape


can only be opened once at any instant.

FILES /dev/mt0 selected drive 0

SEE ALSO mt(I)

BUGS Seek should work on the magtape. Also, a provi-


sion of having the tape open for reading and
writing should exist. A multi-file and multi-
reel facility should be incorporated.

- 1 -
VT (IV) 2/11/73 VT (IV)

NAME vt -- 11/20 (vt01) interface

DESCRIPTION
The file v
_t_0
_ provides the interface to a PDP 11/20 which
runs both a VT01A-controlled Tektronix 611 storage dis-
play, and a Federal Screw Works (Vocal Interface Divi-
sion) voice synthesizer. The inter-computer interface is
a pair of DR-11C word interfaces.

Although the display has essentially only two commands,


namely "erase screen" and "display point", the 11/20 pro-
gram will draw points, lines, and arcs, and print text on
the screen. The 11/20 can also type information on the
attached 33 TTY and generate utterances via the voice
synthesizer.

This special file operates in two basic modes, selected


by bit 2 (octal 04) on the 11/20’s console switches. If
this bit is on at the opening of the file, all bytes
written on the file are interpreted as ASCII characters
and written on the screen. The screen has 33 lines (1/2
a standard page). The file simulates a 37 TTY: the con-
trol characters NL, CR, BS, and TAB are interpreted cor-
rectly. It also interprets the usual escape sequences
for forward and reverse half-line motion and for full-
line reverse. Greek is not available yet. Normally,
when the screen is full (i.e. the 34th line is started)
the screen is erased before starting a new page. To al-
low perusal of the displayed text, it is usual to assert
bit 0 of the console switches (octal 01). As explained
below, this causes the program to pause before erasing
until one of the attached pushbuttons is depressed.

If bit 2 of the switches is down, the display is in


graphic mode. In this case bytes written on the file are
interpreted as display and vocal commands. Each command
consists of a single byte usually followed by parameter
bytes. Often the parameter bytes represent points in the
plotting area. Each point coordinate consists of 2 bytes
interpreted as a 2’s complement 16-bit number. The plot-
ting area itself measures (+
_03777)X(+
_03777) (numbers in
octal); that is, 12 bits of precision. Attempts to plot
points outside the screen limits are ignored.

The graphic and sonic commands are:

order (1); 1 parameter byte


The parameter indicates a subcommand, possibly fol-
lowed by subparameter bytes, as follows:

erase (1)
The screen is erased. This action may be de-
layed, as explained below, until a pushbutton
is depressed.

- 1 -
VT (IV) 2/11/73 VT (IV)

label (2); several subparameter bytes


The following bytes up to a null character are
taken as a label and typed on the console TTY.
One of the console switches gives labels a spe-
cial interpretation, as explained below.

display label (3); several subparameter bytes


The following bytes up to a null byte are
printed as ASCII text on the screen. The ori-
gin of the text is the last previous point
plotted; or the upper left hand of the screen
if there were none.

point (2); 4 parameter bytes


The 4 parameter bytes are taken as a pair of coordi-
nates representing a point to be plotted.

line (3); 8 parameter bytes


The parameter bytes are taken as 2 pairs of coordi-
nates representing the ends of a line segment which
is plotted. Only the portion lying within the
screen is displayed.

frame (4); 1 parameter byte


The parameter byte is taken as a number of sixtieths
of a second; an externally-available lead is assert-
ed for that time. Typically the lead is connected
to an automatic camera which advances its film and
opens the shutter for the specified time.

circle (5); 6 parameter bytes


The parameter bytes are taken as a coordinate pair
representing the origin, and a word representing the
radius of a circle. That portion of the circle
which lies within the screen is plotted.

arc (6); 12 parameter bytes


The first 4 parameter bytes are taken to be a coor-
dinate-pair representing the center of a circle.
The next 4 represent a coordinate-pair specifying a
point on this circle. The last 4 should represent
another point on the circle. An arc is drawn
counter-clockwise from the first circle point to the
second. If the two points are the same, the whole
circle is drawn. For the second point, only the
smaller in magnitude of its two coordinates is sig-
nificant; the other is used only to find the quad-
rant of the end of the arc. In any event only
points within the screen limits are plotted.

dot-line (7); at least 6 parameter bytes


The first 4 parameter bytes are taken as a coordi-
nate-pair representing the origin of a dot-line.
The next byte is taken as a signed x-increment. The

- 2 -
VT (IV) 2/11/73 VT (IV)

next byte is an unsigned word-count, with "0" mean-


ing "256". The indicated number of words is picked
up. For each bit in each word a point is plotted
which is visible if the bit is "1", invisible if
not. High-order bits are plotted first. Each suc-
cessive point (or non-point) is offset rightward by
the given x-increment.

speak(8); several parameter bytes


The following bytes up to a null byte are taken to
represent phonemes which are fed to the voice syn-
thesizer. vsp(VII) gives the encoding.

The 3 low-order console switches of the 11/20 modify the


operation of the display as follows.

Bit 2 (octal 04) is examined at the time the display file


is opened (more precisely, when the first byte is written
after an open); as indicated, when o
_n_ it selects charac-
ter mode, otherwise graphic mode.

Bit 1 (octal 02) determines whether TTY labels are to be


interpreted. Unless this bit is o_n
_, labels are ignored.
(except to terminate skip mode, see below).

Bit 0 (octal 01) determines whether the display will


pause before erasing the screen; if o
_f_f
_ there will be no
pause. If bit 0 is o_n
_, the erase will occur and display-
ing will resume only when one of the 16 pushbuttons is
depressed.

There is a box with 16 pushbuttons connected to the


11/20. Their state is at all times available in the
11/45 by executing the c
_s_w
_ system call (II). They are
used by the 11/20 when it is pausing before an erase. 14
of the buttons merely serve to allow the display to con-
tinue. If, however, button 7 is pushed, the display will
ignore commands up to the next erase command, then ring
the TTY console’s bell, thereby skipping an entire pic-
ture.

If button 8 is depressed, the display will ignore com-


mands up to the next TTY label (whether or not its typing
is suppressed) before resuming the displays. Thus a se-
quence of frames may be skipped.

FILES /dev/vt0

SEE ALSO csw(II), vsp(VII)

BUGS Two users using vt0 simultaneously can interfere


with each other, e.g. plot phonemes or speak dis-
play coordinates.

- 3 -
[Link] (V) 3/15/72 [Link] (V)

NAME [Link] -- assembler and link editor output

DESCRIPTION
_.
a _o
_u_t
_ is the output file of the assembler a _s
_ and the link
editor l _d
_. In both cases, a_.
_o_u
_t_ may be executed provided
there were no errors and no unresolved external refer-
ences.

This file has four sections: a header, the program and


data text, a symbol table, and relocation bits (in that
order). The last two may be empty if the program was
loaded with the "-s" option of l
_d_ or if the symbols and
relocation have been removed by s_t
_r_i
_p_.

The header always contains 8 words:

1 A magic number (407(8))


2 The size of the program text segment
3 The size of the initialized data segment
4 The size of the uninitialized (bss) segment
5 The size of the symbol table
6 The entry location (always 0 at present)
7 The stack size required (0 at present)
8 A flag indicating relocation bits have been sup-
pressed

The sizes of each segment are in bytes but are even. The
size of the header is not included in any of the other
sizes.

When a file produced by the assembler or loader is loaded


into core for execution, three segments are set up: the
text segment, the data segment, and the bss (uninitial-
ized data) segment, in that order. The text segment be-
gins at the lowest location in the core image; the header
is not loaded. The data segment begins immediately after
the text segment, and the bss segment immediately after
the data segment. The bss segment is initialized by 0’s.
In the future the text segment will be write-protected
and shared.

The start of the text segment in the file is 20(8); the


start of the data segment is 20+S9t8 (the size of the
text) the start of the relocation information is
20+S9t8+S9d8; the start of the symbol table is
20+2(S9t8+S9d8) if the relocation information is present,
20+S9t8+S9d8 if not.

The symbol table consists of 6-word entries. The first


four contain the ASCII name of the symbol, null-padded.
The next word is a flag indicating the type of symbol.
The following values are possible:

00 undefined symbol

- 1 -
[Link] (V) 3/15/72 [Link] (V)

01 absolute symbol
02 text segment symbol
03 data segment symbol
04 bss segment symbol
40 undefined external (.globl) symbol
41 absolute external symbol
42 text segment external symbol
43 data segment external symbol
44 bss segment external symbol

Values other than those given above may occur if the user
has defined some of his own instructions.

The last word of a symbol table entry contains the value


of the symbol.

If the symbol’s type is undefined external, and the value


field is non-zero, the symbol is interpreted by the load-
er l
_d_ as the name of a common region whose size is indi-
cated by the value of the symbol.

The value of a word in the text or data portions which is


not a reference to an undefined external symbol is exact-
ly that value which will appear in core when the file is
executed. If a word in the text or data portion involves
a reference to an undefined external symbol, as indicated
by the relocation bits for that word, then the value of
the word as stored in the file is an offset from the as-
sociated external symbol. When the file is processed by
the link editor and the external symbol becomes defined,
the value of the symbol will be added into the word in
the file.

If relocation information is present, it amounts to one


word per word of program text or initialized data. There
is no relocation information if the "suppress relocation"
flag in the header is on.

Bits 3-1 of a relocation word indicate the segment re-


ferred to by the text or data word associated with the
relocation word:

00 indicates the reference is absolute


02 indicates the reference is to the text segment
04 indicates the reference is to the data segment
06 indicates the reference is to the bss segment
10 indicates the reference is to an undefined external
symbol.

Bit 0 of the relocation word indicates if o


_n_ that the
reference is relative to the pc (e.g. "clr x"); if o_f
_f_,
the reference is to the actual symbol (e.g., "clr *$x").

The remainder of the relocation word (bits 15-4) contains

- 2 -
[Link] (V) 3/15/72 [Link] (V)

a symbol number in the case of external references, and


is unused otherwise. The first symbol is numbered 0, the
second 1, etc.

SEE ALSO _s
a _, _
l_d_
, _
s_t_
r_i_
p_, _
n_m_
, _
u_n_
(_I_
)

- 3 -
ARCHIVE (V) 3/15/72 ARCHIVE (V)

NAME archive (library) file format

DESCRIPTION The archive command a


_r_ is used to combine several
files into one. Archives are used mainly as li-
braries to be searched by the link-editor l_d
_.

A file produced by a
_r_ has a "magic number" at the
start, followed by the constituent files, each
preceded by a file header. The magic number is
177555(8) (it was chosen to be unlikely to occur
anywhere else). The header of each file is 16
bytes long:

0-7
file name, null padded on the right

8-11
Modification time of the file

12
User ID of file owner

13
file mode

14-15
file size

If the file is an odd number of bytes long, it is


padded with a null byte, but the size in the
header is correct.

Notice there is no provision for empty areas in


an archive file.

SEE ALSO _r
a _, l
_d_

- 1 -
CORE (V) 2/7/73 CORE (V)

NAME format of core image

DESCRIPTION UNIX writes out a core image of a terminated


process when any of various errors occur. See
_a
w _i
_t_(II) for the list of reasons; the most common
are memory violations, illegal instructions, bus
errors, and user-generated quit signals.

The core image is called "core" and is written in


the process’s working directory (provided it can
be; normal access controls apply).

The size and structure of the core image file de-


pend to some extent on which system is involved.
In general there is a 512-byte area at the end
which contains the system’s per-process data for
that process. (64 bytes in older systems). The
remainder represents the actual contents of the
user’s core area when the core image was written.
In the current system, this area is variable in
size in that only the locations from user 0 to
the program break, plus the stack, are dumped.

When any fatal trap occurs, all the useful regis-


ters are stored on the stack. In the current
system, which has relocation and protection hard-
ware, the stack used is the system stack, which
is kept in the per-process area; in older sys-
tems, there is only one stack, and it is located
in the user’s core area.

The actual format of the information is compli-


cated because it depends on what hardware is
present (EAE, floating-point option), whether
single- or double-precision floating mode is in
effect, and also involves relocating addresses in
the system’s address space. A guru will have to
be consulted if enlightenment is required.

In general the debugger db(I) should be used to


deal with core images.

SEE ALSO db(I), wait(II)

- 1 -
DIRECTORY (V) 3/15/72 DIRECTORY (V)

NAME format of directories

DESCRIPTION A directory behaves exactly like an ordinary


file, save that no user may write into a directo-
ry. The fact that a file is a directory is indi-
cated by a bit in the flag word of its i-node en-
try.

Directory entries are 10 bytes long. The first


word is the i-number of the file represented by
the entry, if non-zero; if zero, the entry is
empty.

Bytes 2-9 represent the (8-character) file name,


null padded on the right. These bytes are not
cleared for empty slots.

By convention, the first two entries in each di-


rectory are for "." and "..". The first is an
entry for the directory itself. The second is
for the parent directory. The meaning of ".." is
modified for the root directory of the master
file system and for the root directories of re-
movable file systems. In the first case, there
is no parent, and in the second, the system does
not permit off-device references. Therefore in
both cases ".." has the same meaning as ".".

SEE ALSO file system (V)

- 1 -
FILE SYSTEM (V) 3/15/72 FILE SYSTEM (V)

NAME format of file system

DESCRIPTION
Every file system storage volume (e.g. RF disk, RK disk,
DECtape reel) has a common format for certain vital in-
formation.

Every such volume is divided into a certain number of 256


word (512 byte) blocks. Blocks 0 and 1 are collectively
known as the s
_u_p
_e_r
_-b_l
_o_c
_k_ for the device; they define its
extent and contain an i-node map and a free-storage map.
The first word contains the number of bytes in the free-
storage map; it is always even. It is followed by the
map. There is one bit for each block on the device; the
bit is "1" if the block is free. Thus if the number of
free-map bytes is n _, the blocks on the device are num-
bered 0 through 8n _-1. The free-map count is followed by
the free map itself. The bit for block k _ of the device
is in byte k
_/8 of the map; it is offset k _(mod 8) bits
from the right. Notice that bits exist for the su-
perblock and the i-list, even though they are never allo-
cated or freed.

After the free map is a word containing the byte count


for the i-node map. It too is always even. I-numbers
below 41(10) are reserved for special files, and are nev-
er allocated; the first bit in the i-node free map refers
to i-number 41. Therefore the byte number in the i-node
map for i-node i
_ is (i
_-41)/8. It is offset (i_-41) (mod
8) bits from the right; unlike the free map, a "0" bit
indicates an available i-node.

I-numbers begin at 1, and the storage for i-nodes begins


at block 2. Also, i-nodes are 32 bytes long, so 16 of
them fit into a block. Therefore, i-node i_ is located in
block (i
_+31)/16 of the file system, and begins
32.((i
_+31)(mod 16)) bytes from its start.

There is always one file system which is always mounted;


in standard UNIX it resides on the RF disk. This device
is also used for swapping. On the primary file system
device, there are several pieces of information following
that previously discussed. There are two words with the
calendar time (measured since 00:00 Jan 1, 1972); two
words with the time spent executing in the system; two
words with the time spent waiting for I/O on the RF and
RK disks; two words with the time spent executing in a
user’s core; one byte with the count of errors on the RF
disk; and one byte with the count of errors on the RK
disk. All the times are measured in sixtieths of a sec-
ond.

I-node 41(10) is reserved for the root directory of the


file system. No i-numbers other than this one and those

- 1 -
FILE SYSTEM (V) 3/15/72 FILE SYSTEM (V)

from 1 to 40 (which represent special files) have a


built-in meaning. Each i-node represents one file. The
format of an i-node is as follows, where the left column
represents the offset from the beginning of the i-node:

0-1 flags (see below)


2 number of links
3 user ID of owner
4-5 size in bytes
6-7 first indirect block or contents block
20-21 eighth indirect block or contents block
22-25 creation time
26-29 modification time
30-31 unused

The flags are as follows:

100000 i-node is allocated


040000 directory
020000 file has been modified (always on)
010000 large file
000040 set user ID on execution
000020 executable
000010 read, owner
000004 write, owner
000002 read, non-owner
000001 write, non-owner

The allocated bit (flag 100000) is believed even if the


i-node map says the i-node is free; thus corruption of
the map may cause i-nodes to become unallocatable, but
will not cause active nodes to be reused.

Byte number n
_ of a file is accessed as follows: n_ is di-
vided by 512 to find its logical block number (say b_) in
the file. If the file is small (flag 010000 is 0), then
_ must be less than 8, and the physical block number cor-
b
responding to b_ is the b
_th entry in the address portion
of the i-node.

Even if the file is large, b


_ will be less than 128
(128*512 = 2^16). The first number in the i-node address
portion gives the physical block number of the indirect
block. b_ is doubled to give a byte offset in the indi-
rect block and the word there found is the physical ad-
dress of the block corresponding to b
_.

For block b
_ in a file to exist, it is not necessary that
all blocks less than b
_ exist. A zero block number either
in the address words of the i-node or in an indirect
block indicates that the corresponding block has never
been allocated. Such a missing block reads as if it con-
tained all zero words.

- 2 -
FILE SYSTEM (V) 3/15/72 FILE SYSTEM (V)

BUGS Two blocks are not enough to handle the i- and


free-storage maps for an RP02 disk pack, which
contains around 10 million words.

- 3 -
PASSWD (V) 12/11/72 PASSWD (V)

NAME passwd -- password file

DESCRIPTION pa
_ _s
_s_w
_d_ contains for each user the following in-
formation:

name (login name, contains no upper case)


encrypted password
numerical user ID
GCOS job number and box number
initial working directory
program to use as Shell

This is an ASCII file. Each field within each


user’s entry is separated from the next by a
colon. The job and box numbers are separated by
a comma. Each user is separated from the next by
a new-line. If the password field is null, no
password is demanded; if the Shell field is null,
the Shell itself is used.

This file resides in directory /etc. Because of


the encrypted passwords, it can and does have
general read permission and can be used, for ex-
ample, to map numerical user ID’s to names.

SEE ALSO login(I), crypt(III), passwd(I)

- 1 -
TAP (V) 6/12/72 TAP (V)

NAME tap -- DEC/mag tape formats

DESCRIPTION The DECtape command t_a


_p_ and the magtape command
_t
m _ dump and extract files to and from their re-
spective tape media. The formats of these tapes
are the same except that magtapes have larger di-
rectories.

Block zero of the tape is not used. It is avail-


able to contain a boot program to be used in a
stand-alone environment. This has proved valu-
able for DEC diagnostic programs.

Blocks 1 through 24 for DECtape (1 through 146


for magtape) contain a directory of the tape.
There are 192 (resp. 1168) entries in the direc-
tory; 8 entries per block; 64 bytes per entry.
Each entry has the following format:

path name 32 bytes


mode 1 byte
uid 1 byte
size 2 bytes
time modified 4 bytes
tape address 2 bytes
unused 20 bytes
check sum 2 bytes

The path name entry is the path name of the file


when put on the tape. If the pathname starts
with a zero word, the entry is empty. It is at
most 32 bytes long and ends in a null byte.
Mode, uid, size and time modified are the same as
described under i-nodes (see file system (V)) The
tape address is the tape block number of the
start of the contents of the file. Every file
starts on a block boundary. The file occupies
(size+511)/512 blocks of continuous tape. The
checksum entry has a value such that the sum of
the 32 words of the directory entry is zero.

Blocks 25 (resp. 147) on are available for file


storage.

A fake entry (see mt(I), tap(I)) has a size of


zero.

SEE ALSO filesystem(V), mt(I), tap(I)

- 1 -
UTMP (V) 3/15/72 UTMP (V)

NAME /tmp/utmp -- user information

DESCRIPTION This file allows one to discover information


about who is currently using UNIX. The file is
binary; each entry is 16(10) bytes long. The
first eight bytes contain a user’s login name or
are null if the table slot is unused. The low
order byte of the next word contains the last
character of a typewriter name. The next two
words contain the user’s login time. The last
word is unused.

This file resides in directory /tmp.

SEE ALSO /etc/init, which maintains the file;


who(I), which interprets it.

- 1 -
WTMP (V) 3/15/72 WTMP (V)

NAME /tmp/wtmp -- user login history

DESCRIPTION This file records all logins and logouts. Its


format is exactly like utmp(V) except that a null
user name indicates a logout on the associated
typewriter, and the typewriter name ’x’ indicates
that UNIX was rebooted at that point.

Wtmp is maintained by login(I) and init(VII).


Neither of these programs creates the file, so if
it is removed record-keeping is turned off.

This file resides in directory /tmp.

SEE ALSO init(VII), login(I), acct(VIII), swtmp(VIII)

- 1 -
BC (VI) 6/12/72 BC (VI)

NAME bc -- B interpreter

SYNOPSIS _c
b _ [ -
_c_ ] sfile1.
_b_ ... ofile1 ...

DESCRIPTION bc
_ _ is the UNIX B interpreter. It accepts three
types of arguments:

Arguments whose names end with ".b" are assumed


to be B source programs; they are compiled, and
the object program is left on the file sfile1.o
(i.e. the file whose name is that of the source
with ".o" substituted for ".b").

Other arguments (except for "-c") are assumed to


be either loader flag arguments, or B-compatible
object programs, typically produced by an earlier
_c
b _ run, or perhaps libraries of B-compatible rou-
tines. These programs, together with the results
of any compilations specified, are loaded (in the
order given) to produce an executable program
with name a_.
_o_u
_t_.

The "-c" argument suppresses the loading phase,


as does any syntax error in any of the routines
being compiled.

The language itself is described in [1].

The future of B is uncertain. The language has


been totally eclipsed by the newer, more power-
ful, more compact, and faster language C.

FILES file.b input file


[Link] loaded output
b.tmp1 temporary (deleted)
b.tmp2 temporary (deleted)
/usr/lang/bdir/b[ca] translator
/usr/lang/bdir/brt[12] runtime initialization
/usr/lib/libb.a builtin functions, etc.
/usr/lang/bdir/bilib.a interpreter library

SEE ALSO [1] K. Thompson; MM-72-1271-1; Users’ Reference


to B.
cc(I)

DIAGNOSTICS see [1].

BUGS Certain external initializations are illegal.


(In particular: strings and addresses of exter-
nals.)

- 1 -
BJ (VI) 3/15/72 BJ (VI)

NAME bj -- the game of black jack

SYNOPSIS /usr/games/bj

DESCRIPTION
_j
b _ is a serious attempt at simulating the dealer in the
game of black jack (or twenty-one) as might be found in
Reno. The following rules apply:

The bet is $2 every hand.

A player ’natural’ (black jack) pays $3. A dealer


natural loses $2. Both dealer and player naturals is
a ’push’ (no money exchange).

If the dealer has an ace up, the player is allowed to


make an ’insurance’ bet against the chance of a dealer
natural. If this bet is not taken, play resumes as
normal. If the bet is taken, it is a side bet where
the player wins $2 if the dealer has a natural and
loses $1 if the dealer does not.

If the player is dealt two cards of the same value, he


is allowed to ’double’. He is allowed to play two
hands, each with one of these cards. (The bet is dou-
bled also; $2 on each hand.)

If a dealt hand has a total of ten or eleven, the


player may ’double down’. He may double the bet ($2
to $4) and receive exactly one more card on that hand.

Under normal play, the player may ’hit’ (draw a card)


as long as his total is not over twenty-one. If the
player ’busts’ (goes over twenty-one), the dealer wins
the bet.

When the player ’stands’ (decides not to hit), the


dealer hits until he attains a total of seventeen or
more. If the dealer busts, the player wins the bet.

If both player and dealer stand, the one with the


largest total wins. A tie is a push.

The machine deals and keeps score. The following ques-


tions will be asked at appropriate times. Each question
is answered by y
_ followed by a new line for ’yes’, or
just new line for ’no’.

? (means, "do you want a hit?")


Insurance?
Double down?

Every time the deck is shuffled, the dealer so states and


the ’action’ (total bet) and ’standing’ (total won or

- 1 -
BJ (VI) 3/15/72 BJ (VI)

loss) is printed. To exit, hit the interrupt key (DEL)


and the action and standing will be printed.

- 2 -
PTX (VI) 3/15/72 PTX (VI)

NAME ptx -- permuted index

SYNOPSIS _t
p _x
_ input output

DESCRIPTION pt
_ _x
_ generates a permuted index from file i_n
_p_u
_t_ on
file o_u
_t_p
_u_t
_. It has three phases: the first does
the permutation, generating one line for each
keyword in an input line. The keyword is rotated
to the front. The permuted file is then sorted.
Finally the sorted lines are rotated so the key-
word comes at the middle of the page.

in
_ _p
_u_t
_ should be edited to remove useless lines.
The following words are suppressed: "a", "and",
"as", "is", "for", "of", "on", "or", "the", "to",
"up".

The index for this manual was generated using


_t
p _x
_.

FILES --

SEE ALSO sort(I)

DIAGNOSTICS some

BUGS --

- 1 -
YACC (VI) 1/20/73 YACC (VI)

NAME yacc -- yet another compiler compiler

SYNOPSIS /_
_ c_
r_p_
/_s_
c_j_
/_y_
a_c_
c [ <grammar ]

DESCRIPTION Yacc converts a context-free grammar into a set


of tables for a simple automaton which executes
an LR(1) parsing algorithm. The tables are pro-
vided in readable form on the standard output and
in b-compiler format on file actn.b; the program
/crp/scj/bpar.b will parse strings using the
actn.b file.

If your grammar is too big for yacc, you may try


/crp/scj/bigyacc, some of whose size limits are
larger, and others smaller.

FILES actn.b output tables


[Link] temporary storage
Note that these files are created in the invok-
er’s directory. The file [Link] is only creat-
ed by /crp/scj/bigyacc (see above).

SEE ALSO Yacc manual, by scj (available from ek); "LR


Parsing", by A. V. Aho and S. C. Johnson, to be
published.

DIAGNOSTICS There are various diagnostics, but only one can


be obtained in each run.

BUGS The maximum number of terminal and non-terminal


symbols is 50 each, and this is not checked.
There are undoubtedly other bugs too.

- 1 -
ASCII (VII) 6/12/72 ASCII (VII)

NAME ascii -- map of ASCII character set

SYNOPSIS _a
c _t
_ /
_u_s
_r_/
_p_u
_b_/
_a_s
_c_i
_i_

DESCRIPTION as
_ _c
_i_i
_ is a map of the ASCII character set, to be
printed as needed. It contains:

|000 nul|001 soh|002 stx|003 etx|004 eot|005 enq|006 ack|007 bel|


|010 bs |011 ht |012 nl |013 vt |014 np |015 cr |016 so |017 si |
|020 dle|021 dc1|022 dc2|023 dc3|024 dc4|025 nak|026 syn|027 etb|
|030 can|031 em |032 sub|033 esc|034 fs |035 gs |036 rs |037 us |
|040 sp |041 ! |042 " |043 # |044 $ |045 % |046 & |047 ’ |
|050 ( |051 ) |052 * |053 + |054 , |055 - |056 . |057 / |
|060 0 |061 1 |062 2 |063 3 |064 4 |065 5 |066 6 |067 7 |
|070 8 |071 9 |072 : |073 ; |074 < |075 = |076 > |077 ? |
|100 @ |101 A |102 B |103 C |104 D |105 E |106 F |107 G |
|110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O |
|120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W |
|130 X |131 Y |132 Z |133 [ |134 \ |135 ] |136 ^ |137 _ |
|140 ‘ |141 a |142 b |143 c |144 d |145 e |146 f |147 g |
|150 h |151 i |152 j |153 k |154 l |155 m |156 n |157 o |
|160 p |161 q |162 r |163 s |164 t |165 u |166 v |167 w |
|170 x |171 y |172 z |173 { |174 | |175 } |176 ˜ |177 del|

FILES found in /usr/pub

- 1 -
DPD (VII) 3/15/72 DPD (VII)

NAME dpd -- spawn data phone daemon

SYNOPSIS _e
/ _t
_c_/
_d_p
_d_

DESCRIPTION dp
_ _d
_ is the 201 data phone daemon. It is designed
to submit jobs to the Honeywell 6070 computer via
the gerts interface.

dp
_ _d
_ uses the directory /
_u_s
_r_/
_d_p
_d_. The file l _o
_c_k
_
in that directory is used to prevent two daemons
from becoming active. After the daemon has suc-
cessfully set the lock, it forks and the main
path exits, thus spawning the daemon. / _u
_s_r
_/_d
_p_d
_
is scanned for any file beginning with d _f
_. Each
such file is submitted as a job. Each line of a
job file must begin with a key character to spec-
ify what to do with the remainder of the line

S directs dpd to generate a unique snumb card.


_
This card is generated by incrementing the
first word of the file /
_u_s
_r_/
_d_p
_d_/
_s_n
_u_m
_b_ and con-
verting that to decimal concatenated with the
station ID.

L specifies that the remainder of the line is


_
to be sent as a literal.

B specifies that the rest of the line is a


_
file name. That file is to be sent as binary
cards.

F is the same as B
_ _ except a form feed is
prepended to the file.

U specifies that the rest of the line is a


_
file name. After the job has been transmit-
ted, the file is unlinked.

Any error encountered will cause the daemon to


drop the call, wait up to 20 minutes and start
over. This means that an improperly constructed
_f
d _ file may cause the same job to be submitted
every 20 minutes.

While waiting, the daemon checks to see that the


_o
l _c
_k_ file still exists. If the l
_o_c
_k_ is gone, the
daemon will exit.

FILES /dev/dn0, /dev/dp0, /usr/dpd/*

SEE ALSO opr(I)

DIAGNOSTICS --

- 1 -
DPD (VII) 3/15/72 DPD (VII)

BUGS --

- 2 -
12/11/72 GETTY (VII)

NAME getty -- set typewriter mode and get user’s name

SYNOPSIS /etc/getty

DESCRIPTION
_e
g _t
_t_y
_ is invoked by init (VII) immediately after a type-
writer is opened following a dial-in. The user’s login
name is read and the login(I) command is called with this
name as an argument. While reading this name g _e
_t_t
_y_ at-
tempts to adapt the system to the speed and type of ter-
minal being used.

ge
_ _t
_t_y
_ initially sets the speed of the interface to 150
baud, specifies that raw mode is to be used (break on ev-
ery character), that echo is to be suppressed, and either
parity allowed. It types the "login:" message (which in-
cludes the characters which put the 37 Teletype terminal
into full-duplex and unlock its keyboard). Then the us-
er’s name is read, a character at a time. If a null
character is received, it is assumed to be the result of
the user pushing the "break" ("interrupt") key. The
speed is then changed to 300 baud and the "login:" is
typed again, this time with the appropriate sequence
which puts a GE TermiNet 300 into full-duplex. This se-
quence is acceptable to other 300 baud terminals also.
If a subsequent null character is received, the speed is
changed again. The general approach is to cycle through
a set of speeds in response to null characters caused by
breaks. The sequence at this installation is 150, 300,
and 134.5 baud.

Detection of IBM 2741s is accomplished while the speed is


set to 150 baud. The user sends a 2741 style "eot" char-
acter by pushing the attention key or by typing return;
at 150 baud, this character looks like the ascii "˜"
(174988). Upon receipt of the "eot", the system is set
to operate 2741s and a "login: " message is typed.

The user’s name is terminated by a new-line or carriage-


return character. The latter results in the system being
set to to treat carriage returns appropriately (see
stty(II)).

The user’s name is scanned to see if it contains any low-


er-case alphabetic characters; if not, and if the name is
nonempty, the system is told to map any future upper-case
characters into the corresponding lower-case characters.
Thus UNIX is usable from upper-case-only terminals.

Finally, login is called with the user’s name as argu-


ment.

FILES --

- 1 -
12/11/72 GETTY (VII)

SEE ALSO init(VII), login(I), stty(II)

- 2 -
GLOB (VII) 6/15/72 GLOB (VII)

NAME glob -- generate command arguments

SYNOPSIS /etc/glob

DESCRIPTION gl
_ _o
_b_ is used to expand arguments to the shell
containing "*", ’[’, or "?". It is passed the
argument list containing the metacharacters; g _l
_o_b
_
expands the list and calls the command itself.
The actions of g _l
_o_b
_ are detailed in the Shell
writeup.

FILES found in /etc/glob

SEE ALSO sh(I)

DIAGNOSTICS "No match", "No command", "No directory"

BUGS If any of original command line, even the quoted


metacharacters are expanded.

gl
_ _o
_b_ gives the "No match" diagnostic only if no
arguments at all result. This is never the case
if there is any argument without a metacharacter.

- 1 -
GREEK (VII) 10/31/72 GREEK (VII)

NAME greek -- graphics for extended ascii type box

SYNOPSIS _a
c _t
_ /
_u_s
_r_/
_p_u
_b_/
_g_r
_e_e
_k_

DESCRIPTION gr
_ _e
_e_k
_ gives the mapping from ascii to the "shift
out" graphics in effect between SO and SI on mod-
el 37 teletypes with a 128-character type box.
It contains:

alpha A A | beta B B | gamma \ \


GAMMA G G | delta D D | DELTA W W
epsilon S S | zeta Q Q | eta N N
theta T T | THETA O O | lambda L L
LAMBDA E E | mu M M | nu @ @
xi X X | pi J J | PI P P
rho K K | sigma Y Y | SIGMA R R
tau I I | phi U U | PHI F F
psi V V | PSI H H | omega C C
OMEGA Z Z | nabla [ [ | not _ _
partial ] ] | integral ^ ^ |

FILES --

SEE ALSO ascii (VII)

DIAGNOSTICS --

BUGS --

- 1 -
INIT (VII) 6/15/72 INIT (VII)

NAME init -- process control initialization

SYNOPSIS /etc/init

DESCRIPTION
_n
i _i
_t_ is invoked inside UNIX as the last step in the boot
procedure. Generally its role is to create a process for
each typewriter on which a user may log in.

First, i_n
_i_t
_ checks to see if the console switches contain
173030. (This number is likely to vary between systems.)
If so, the console typewriter t _t
_y_ is opened for reading
and writing and the shell is invoked immediately. This
feature is used to bring up a test system, or one which
does not contain DC-11 communications interfaces. When
the system is brought up in this way, the g _e
_t_t
_y_ and l
_o_g
_i_n
_
routines mentioned below and described elsewhere are not
needed.

Otherwise, i _n
_i_t
_ does some housekeeping: the mode of each
DECtape file is changed to 17 (in case the system crashed
during a t_a
_p_ command); directory /usr is mounted on the
RK0 disk; directory /sys is mounted on the RK1 disk. Al-
so a data-phone daemon is spawned to restart any jobs be-
ing sent.

Then i
_n_i
_t_ forks several times to create a process for
each typewriter mentioned in an internal table. Each of
these processes opens the appropriate typewriter for
reading and writing. These channels thus receive file
descriptors 0 and 1, the standard input and output.
Opening the typewriter will usually involve a delay,
since the o _p
_e_n
_ is not completed until someone is dialled
in (and carrier established) on the channel. Then the
process executes the program /e _t
_c_/g
_e_t
_t_y
_ (q.v.). g _e
_t_t
_y_
will read the user’s name and invoke l _o
_g_i
_n_ (q.v.) to log
in the user and execute the shell.

Ultimately the shell will terminate because of an end-of-


file either typed explicitly or generated as a result of
hanging up. The main path of i _n_i
_t_, which has been wait-
ing for such an event, wakes up and removes the appropri-
ate entry from the file u_t
_m_p
_, which records current
users, and makes an entry in w _t
_m_p
_, which maintains a his-
tory of logins and logouts. Then the appropriate type-
writer is reopened and g
_e_t
_t_y
_ reinvoked.

FILES /dev/tap?, /dev/tty, /dev/tty?, /tmp/utmp,


/tmp/wtmp

SEE ALSO login(I), login(VII), getty(VII), sh(I), dpd(VII)

DIAGNOSTICS none possible

- 1 -
INIT (VII) 6/15/72 INIT (VII)

BUGS none possible

- 2 -
MSH (VII) 6/15/72 MSH (VII)

NAME msh -- mini-shell

SYNOPSIS /etc/msh

DESCRIPTION ms
_ _h
_ is a heavily simplified version of the Shell.
It reads one line from the standard input file,
interprets it as a command, and calls the com-
mand.

The mini-shell supports few of the advanced fea-


tures of the Shell; none of the following charac-
ters is special:

> < $ \ ; &

However, "*", "[", and "?" are recognized and


_l
g _o
_b_ is called. The main use of m
_s_h
_ is to pro-
vide a command-executing facility for various in-
teractive sub-systems.

FILES --

SEE ALSO sh(I), glob(VII)

DIAGNOSTICS "?"

BUGS --

- 1 -
TABS (VII) 6/15/72 TABS (VII)

NAME tabs -- set tab stops

SYNOPSIS cat /usr/pub/tabs

DESCRIPTION When printed on a suitable terminal, this file


will set tab stops every 8 columns. Suitable
terminals include the Teletype model 37 and the
GE TermiNet 300.

These tab stop settings are desirable because


UNIX assumes them in calculating delays.

FILES --

SEE ALSO --

DIAGNOSTICS --

BUGS --

- 1 -
VSP (VII) 2/2/73 VSP (VII)

NAME vsp -- voice synthesizer code

SYNOPSIS cat /usr/pub/vsp

DESCRIPTION vs
_ _p
_ contains a list of phonemes understood by the
voice synthesizer on device v_t
_. Phonemes are
usually written in the form

comma inflection phoneme

The inflection and the phoneme codes are or-ed


together. The phoneme codes are as follows (num-
bers in octal).

0 = 300 strong inflection p = 32 penny p


_ _ound
1 = 200 a0 = 33 co_ntact ca _r
2 = 100 a1 = 52 co_nnect
3 = 000 weak inflection ai = 37 na_me ca _me
aj = 71 na_mely
aw = 02 aw
_ _ful la _w
_ s = 40 _even s
s _ix
ie = 03 ze_r
_o d = 41 _o d
d _iet
e0 = 04 _nter me
e _t f = 42 _our f
f _ive
e1 = 76 se_ven g = 43 _et g
g _rand
e2 = 77 seve _n h = 44 _ello h
h _ow
er = 05 weathe _r
_ j = 45 _udge edg
j _e
th = 06 _h
t _ree t _h_ick k = 46 _ame lock
c _
dh = 07 _h
t _is t _h
_en l = 47 hel_l_o l_ight
yu = 27 _se you
u _ oo = 50 lo_o
_k bo _o_k
iu = 10 _nite
u ou = 51 go_o
_d sho _u
_d
ju = 11 ne_w yo _u ng = 53 rin_g_ an_g_le
o0 = 31 _nly no
o _ z = 55 _ero haz
z _y
o1 = 12 hello _ sh = 56 _h
s _ow s_h_ip
o2 = 13 no_tice ch = 57 _h
c _air c _h_ime
u0 = 14 bu_t mu _st v = 60 sev_en ev _en
u1 = 15 _ncle
u b = 61 _all b
b _ed
u2 = 16 stirru _p n = 62 _in
n _e seven _
u3 = 34 app_le ab_le m = 63 _ile m
m _en
ae = 21 ca_t sa _t iy = 66 li_e
_
ea = 20 _ntenna
a zh = 70 az_ure pleas _ure
w = 22 _on w
w _ish ih = 72 stati _o
_n conditi _o
_n
ee = 23 thre _e
_ ay = 36 may_ lay _
r = 24 _adio r
r _adar_
t = 25 _wo t
t _ime -0 = 35 long space
ey = 26 sixty _ eighty _ -1 = 17
i0 = 30 si_x mi _x -2 = 01
i1 = 64 _nept i
i _nside -3 = 74 short delay
i2 = 65 crypti _c stati _c

SEE ALSO speak(I), vt(IV)

- 1 -
20BOOT (VIII) 1/25/73 20BOOT (VIII)

NAME 20boot -- install new 11/20 system

SYNOPSIS _0
2 _b
_o_o
_t_ [ x
_ ]

DESCRIPTION This shell command file copies the current ver-


sion of the 11/20 program used to run the VT01
display onto the /dev/vt0 file.

If no argument is given, the 11/20 program should


be executing but idle; the 11/20 program is sent
preceded by a "reboot" command. If an argument
is given, the 11/20 should have been restarted at
its ROM location 777300.

FILES /dev/vt0;
/sys/mdec/20.o (11/20 program)

SEE ALSO vt0 (IV)

DIAGNOSTICS --

- 1 -
ACCT (VIII) 1/20/73 ACCT (VIII)

NAME acct -- login accounting

SYNOPSIS _c
a _c
_t_ [ -
_w_ wtmp ] [ -
_p_ ] [ -
_d_ ] people

DESCRIPTION ac
_ _c
_t_ produces a printout giving connect time for
each user who has logged in during the life of
the current w _t_m
_p_ file. A total is also produced.
_w
- _ is used to specify an alternate wtmp file. - _p
_
prints individual totals; without this option,
only totals are printed. - _d
_ causes a printout
for each midnight to midnight period. The p _e
_o_p
_l_e
_
argument will limit the printout to only the
specified login names. If no wtmp file is given,
_u
/ _s
_r_/
_a_d
_m_/
_w_t
_m_p
_ is used.

FILES /usr/adm/wtmp

SEE ALSO init(VII), login(I), wtmp(V).

DIAGNOSTICS "Cannot open ’wtmp’" if argument is unreadable.

BUGS --

- 1 -
BOOT PROCEDURES (VIII) 2/6/73 BOOT PROCEDURES (VIII)

NAME bos, maki, vcboot, msys, e


_t_ a
_l_.

DESCRIPTION
On the RF disk, the highest 16K words are reserved for
stand-alone programs. These 16K words are allocated as
follows:

bos (1K)
Warm UNIX (7K)
Cold UNIX (8K)

The program b
_o_s
_ (Bootstrap Operating System) examines the
console switches and executes one of several internal
programs depending on the setting. The following set-
tings are currently recognized:

??? Will read Warm UNIX from the RF into core loca-
tion 0 and transfer to 600.

1 Will read Cold UNIX from the RF into core loca-


tion 0 and transfer to 600.

10 Will dump all of memory from core location 0 onto


DECtape drive 7 and then halt.

20 Will read 256 words from RK0 into core 0 and


transfer to zero. This is the procedure to boot
DOS from an RK.

40 This is the same as 10 above, but instead of


halting, UNIX warm is loaded.

0 Will load a standard UNIX binary paper tape into


core location 0 and transfer to 0.

77500 Will load the standard DEC absolute and binary


loaders and transfer to 77500.

All manual methods of booting the system involve manipu-


lation of the console switches. In order for this to be
possible, the panel must be unlocked and the machine must
be halted. Also, remember that at the time UNIX comes
up, the console switches must contain 773030 for a sin-
gle-user system; anything else gives a multi-user system.

There are four temperatures of boots. They are:

Hot boot: restart the system without refreshing its


code, that is simply by transferring to its start.
The only use for this procedure is if the system has
been patched and one doesn’t wish to redo the patch-
es. The procedure is:

600 in switches Load address

- 1 -
BOOT PROCEDURES (VIII) 2/6/73 BOOT PROCEDURES (VIII)

(773030 in switches for single-user system)


start

Warm boot: refresh system code from the RF disk, but


the "panic" routine must be in core. Best for gener-
al use if it works, since outstanding I/O is cleaned
up. Procedure:

602 in switches load address


(773030 in switches for single-user system)
start (flushes any I/O, then executes b_o
_s_)

Cool boot: RF disk is OK, but nothing in core. Pro-


cedure:

UTIL DECtape on drive 0 773030 in


switches load address (602 in switch-
es for multi-user system) start type
"boot" on console tty to load b__os
_

Cold boot: nothing in core, nothing on RF. Best to


have an expert around for this one. Procedure:

INIT DECtape on drive 0 773030 in


switches load address 1 in switches
start (machine halts. last chance to
preserve RF!) 773030 in switches
continue (reads in basic files)

UNIX is then up, but for various reasons, one should


do a warm boot (single user) right away. At this
point also, one might consider whether the INIT tape
UNIX is the latest version. If there is reason for
doubt, mount the /sys disk pack, change to directory
/sys/sys, do "msys u unix", and reboot. Then get the
/bin-/etc-/lib tape which contains the rest of of the
RF disk, and do an "mt x". Conceivably, "create er-
rors" due to lack of some directories will occur;
make the directories, then try again. Set the date
correctly; the system starts off at time 0.

At this point UNIX is in full operation and can be


rebooted for a multi-user system.

Here is what happens during a cold boot: the INIT tape


contains a program called _v_
c_b_
o_o_
t_. The ROM program reads
vcboot from the tape into core location 0 and transfers
to it. vcboot then reads 16K words from the DECtape
(blocks 1-32) and copies the data to the highest 16K
words of the RF. Thus this initializes the read-only
part of the RF. vcboot then reads in b _o
_s_ and executes
it. b_o
_s_ reads in Cold UNIX and executes that. Cold UNIX
halts for a last chance before it completely initializes
the RF file system. When continue is pressed, Cold UNIX

- 2 -
BOOT PROCEDURES (VIII) 2/6/73 BOOT PROCEDURES (VIII)

initializes the RF. It then reads the DECtape for ini-


tialization files starting from block 33. Normal opera-
tion then commences with the execution of "/etc/init".

The INIT tape is made by the program m _a_k


_i_ running under
UNIX. m_a
_k_i
_ writes v
_c_b
_o_o
_t_ on block 0 of _ /_
d_e_
v_/_
t_a_
p_7_
. It
then copies the RF 16K words (using _ /_
d_e_
v_/_
r_f_
0_) onto blocks
1 thru 32. It has internally a list of files to be
copied from block 33 on. This list follows:

/etc/init
/bin/chmod
/bin/date
/bin/login
/bin/ls
/bin/mkdir
/etc/mount
/bin/sh
/bin/tap
/bin/mt

Thus this is the set of programs available after a cold


boot. i _n
_i_t
_ and s _h
_ are mandatory. For multi-user UNIX,
_e
g _t
_t_y
_ and l_o_g
_i_n
_ are also necessary. m _k_d
_i_r
_ is necessary
due to a bug in t _a
_p_. m_t
_, t
_a_p
_ and m_o
_u_n
_t_ are useful to
bring in new files. As soon as possible, d _a
_t_e
_ should be
done. That leaves l _s
_ and c
_h_m
_o_d
_ as frosting.

The last link in this incestuous daisy chain is the pro-


gram m
_s_y
_s_.

_s
m _y
_s_ char file

will copy the file f


_i_l
_e_ onto the RF read only slot speci-
fied by the character c _h
_a_r
_. Char is taken from the fol-
lowing set:

b bos
_
_ Warm UNIX
u
_ Cold UNIX
1

FILES /dev/rf0, /dev/tap?

SEE ALSO init(VII), tap(I), sh(I), mkdir(I)

DIAGNOSTICS --

BUGS This section is very configuration dependent.

- 3 -
CHECK (VIII) 1/20/73 CHECK (VIII)

NAME check -- file system consistency check

SYNOPSIS _h
c _e
_c_k
_ [ filesystem [ blockno918 ... ] ]

DESCRIPTION ch
_ _e
_c_k
_ will examine a file system, build a bit map
of used blocks, and compare this bit map against
the bit map maintained on the file system. If
the file system is not specified, a check of all
of the normally mounted file systems is per-
formed. Output includes the number of files on
the file system, the number of these that are
’large’, the number of indirect blocks, the num-
ber of used blocks, and the number of free
blocks.

ch
_ _e
_c_k
_ works by examining the i-nodes on the file
system and is entirely independent of its direc-
tory hierarchy. The file system may be, but need
not be, mounted.

FILES /dev/rf?, /dev/rk?, /dev/rp?

SEE ALSO find(I), ds(I)

DIAGNOSTICS Diagnostics are produced for blocks missing, du-


plicated, and bad block addresses. Diagnostics
are also produced for block numbers passed as pa-
rameters. In each case, the block number, i-num-
ber, and block class (i
_ = inode, x
_ indirect, f
_
free) is printed.

BUGS The checking process is two pass in nature. If


checking is done on an active file system, extra-
neous diagnostics may occur.

- 1 -
CHK (VIII) 1/20/73 CHK (VIII)

NAME chk -- check + dcheck

SYNOPSIS chk

DESCRIPTION This command file does a c


_h_e
_c_k
_ and a d
_c_h
_e_c
_k_ of
all of the normally mounted file systems.

FILES /dev/[fkp]*

SEE ALSO check (VIII), dcheck (VIII)

DIAGNOSTICS see "SEE ALSO"

- 1 -
CLRI (VIII) 1/20/73 CLRI (VIII)

NAME clri -- clear i-node

SYNOPSIS clri i-number [ file system ]

DESCRIPTION cl
_ _r
_i_ writes zeros on the 32 bytes occupied by the
i-node numbered _ i_
-_n_
u_m_
b_e_
r_. If the _
f_i_
l_e _
s_y_
s_t_
e_m ar-
gument is given, the i-node resides on the given
device, otherwise on a default file system. The
file system argument must be a special file name
referring to a device containing a file system.

After c
_l_r
_i_, any blocks in the affected file will
show up as "missing" in a c _h
_e__
ck_ of the file sys-
tem.

Read and write permission is required on the


specified file system device. The i-node becomes
allocatable.

The primary purpose of this routine is to remove


a file which for some reason appears in no direc-
tory.

DIAGNOSTICS "error"

- 1 -
DCHECK (VIII) 1/20/73 DCHECK (VIII)

NAME dcheck -- directory consistency check

SYNOPSIS _c
d _h
_e_c
_k_ [ -
_l_ ] [ device ]

DESCRIPTION dc
_ _h
_e_c
_k_ builds an image of the directory hierarchy
of the specified device by reading all its direc-
tories (using physical I/O guided by the i-nodes
on the device). A list entry is made for each
file encountered. A second pass reads the i-
nodes and for each file compares the number of
links specified in its i-node with the number of
entries actually seen. All discrepancies are
noted.

If no device is specified, a default device is


assumed.

The argument -
_l_ causes a complete listing of the
file names on the device in i-node order.

FILES /dev/rk?

SEE ALSO check(VIII)

DIAGNOSTICS inconsistent i-numbers, unnamed files, unreach-


able files, loops in directory "hierarchy".

BUGS Unreachable files and loops are discovered only


under the "-l" option.

- 1 -
DLI (VIII) 3/15/72 DLI (VIII)

NAME dli -- load DEC binary paper tapes

SYNOPSIS dli output [input]

DESCRIPTION dl
_ _i
_ will load a DEC binary paper tape into the
output file. The binary format paper tape is
read from the input file (/dev/ppt is default.)

FILES /dev/ppt

SEE ALSO --

DIAGNOSTICS "checksum"

BUGS --

- 1 -
ISTAT (VIII) 1/20/73 ISTAT (VIII)

NAME istat -- get inode status

SYNOPSIS _s
i _t
_a_t
_ [ filesystem ] inumber1 ...

DESCRIPTION is
_ _t
_a_t
_ gives information about one or more i-nodes
on the given file system or on /dev/rk0 if no
file system is given.

The information is in exactly the same form as


that for stat(I), except that mode letter "a" is
used to indicate that the i-node is allocated,
"u" that it is unallocated.

FILES /etc/uids, /dev/rk0

SEE ALSO stat(I), ls(I) (-l option)

DIAGNOSTICS --

BUGS is
_ _t
_a_t
_ ignores any read error and pretends to give
status even if the file system is not physically
present.

- 1 -
KILL (VIII) 1/20/73 KILL (VIII)

NAME kill -- terminate process with extreme prejudice

SYNOPSIS _u
/ _s
_r_/
_a_d
_m_/
_k_i
_l_l
_ processnumber

DESCRIPTION After p
_s_ (q.v.) has given you the unique ID of a
process, you can terminate it by this command. A
core image is produced in the process’s working
directory.

Only the super-user can exercise this privilege.

FILES --

SEE ALSO ps (VIII)

DIAGNOSTICS yes

BUGS If the process has executed sys nice (II) and


there is another process which has not, but which
loops, the first process cannot be done in prop-
erly, since it has to be swapped in so as cooper-
ate in its own murder.

It would also be nice if ordinary people could


kill their own processes.

- 1 -
MOUNT (VIII) 1/20/73 MOUNT (VIII)

NAME mount -- mount file system

SYNOPSIS _e
/ _t
_c_/
_m_o
_u_n
_t_ special file

DESCRIPTION mo
_ _u
_n_t
_ announces to the system that a removable
file system is present on the device correspond-
ing to special file s _p
_e_c
_i_a
_l_ (which must refer to
a disk or possibly DECtape). The f _i
_l_e
_ must exist
already; it becomes the name of the root of the
newly mounted file system.

FILES --

SEE ALSO umount(VIII)

DIAGNOSTICS "?", if the special file is already in use, can-


not be read, or if f
_i_l
_e_ does not exist.

BUGS Should be usable only by the super-user. Mount-


ing file systems full of garbage can crash the
system.

- 1 -
PS (VIII) 1/20/73 PS (VIII)

NAME ps -- process status

SYNOPSIS /usr/adm/ps [ -
_x_l
_t_ ]

DESCRIPTION
_s
p _ prints certain facts about active processes. The in-
formation is columnar and consists of:

The (numerical) ID of the user associated with the


process;

The last character of the control typewriter of the


process or "x" if there is no control typewriter; "x"
lines are suppressed unless the "x" option is given.

The number of 512-byte disk blocks holding the core


image of the process;

The process’s unique ID (only with "l" option)

The number of hours (mod 100) and minutes of system,


disk, and user-process time accumulated by the process
and all its terminated descendants (only with "t" op-
tion)

An educated guess as to the command line which caused


the process to be created.

Some caveats:

The guess as to the command name and arguments is ob-


tained by examining the process’s stack. The process is
entitled to destroy this information. Also, only pro-
cesses whose core images are on disk have visible names.
The p
_s_ command in particular does not, nor does any other
process which happens to be in core at the same time. p _s
_
tries to overcome this limitation by spawning a subpro-
cess designed to take up the other core slot, and is usu-
ally successful. Because p _s
_ examines a dynamically
changing data structure, it can produce incorrect re-
sults, for example if a process’s core image moves be-
tween the time p_s
_ gets its disk address and reads its
stack.

Besides its utility for simple spying, p


_s_ is the only
plausible way to find the process number of someone you
are trying to kill (VIII).

FILES /dev/rf0, /sys/sys/unix (to get magic numbers).

SEE ALSO kill (VIII)

DIAGNOSTICS "Bad RF", if a bad swap address turns up; various


missing-file diagnostics.

- 1 -
PS (VIII) 1/20/73 PS (VIII)

BUGS As described.

- 2 -
SALV (VIII) 1/20/73 SALV (VIII)

NAME salv -- file system salvage

SYNOPSIS _e
/ _t
_c_/
_s_a
_l_v
_ filesystem [ -
_a_k
_f_s
_ ]

DESCRIPTION
_a
s _l
_v_ will place a given file system in a consistent state
with almost no loss of information. This is the first
step in putting things together after a bad crash. Salv
performs the following functions:

A valid free list is constructed.

The previous step is always performed; the following


steps are performed only if the "a" option is given. If
the file system’s only defect is missing blocks, "a"
should not be specified.

All bad pointers in the file system are zeroed.

All duplicate pointers to the same block are resolved


by changing one of the pointers to point at a new
block containing a copy of the data.

Inodes (not directory entries) for special files are


generated (mode 16).

Files whose size is too large for the number of blocks


they contain (after bad pointers are zeroed) have
their size revised downward.

The file system should be unmounted while it is being


salvaged. In cases of extreme need the permanently
mounted file system may be salvaged; in such a case the
system must be rebooted before it has a chance to write
out the old, bad super-block.

The "k", "f", and "s" options tell salv what magic num-
bers to use to generate the size of the free list and the
i-node map. "k" is default (RK disk); "f" is RF; "s" is
RK with swap space on it. If salv is to be used away
from the mother system its code should be cheked to veri-
fy the numbers.

After a salv, files may be safely created and removed


without causing more trouble. If the "a" option had to
be used, a dcheck (VIII) should be done to find the de-
gree of the damage to the hierarchy.

FILES /dev/rk0

SEE ALSO check(I), ds(I)

DIAGNOSTICS --

- 1 -
SALV (VIII) 1/20/73 SALV (VIII)

BUGS In only one (known) way does s


_a_l
_v_ destroy infor-
mation: if some random block appears to be an in-
direct block for a file, all "bad pointers" (for
example, ASCII text) in it will be zeroed. If
the block also appears in another file, it may be
scribbled on before it is copied.

- 2 -
SU (VIII) 1/20/73 SU (VIII)

NAME su -- become privileged user

SYNOPSIS _u
s _

DESCRIPTION su allows one to become the super-user, who has


all sorts of marvelous (and correspondingly dan-
gerous) powers. In order for su to do its magic,
the user must supply a password. If the password
is correct, su will execute the shell with the
UID set to that of the super-user. To restore
normal UID privileges, type an end-of-file to the
super-user shell.

To remind the super-user of his responsibilities,


the shell substitutes "#" for its usual prompt
"%".

FILES --

SEE ALSO sh(I)

DIAGNOSTICS "Sorry" if password is wrong

BUGS --

- 1 -
SWTMP (VIII) 2/11/73 SWTMP (VIII)

NAME swtmp -- update accounting file

SYNOPSIS _w
s _t
_m_p
_

DESCRIPTION This shell sequence concatenates /tmp/wtmp onto


/usr/adm/wtmp and truncates /tmp/wtmp. It should
be used before using acct(VIII) and every so of-
ten in any case if accounting is to be main-
tained.

FILES /tmp/wtmp, /usr/adm/wtmp

SEE ALSO acct(VIII), wtmp(V)

- 1 -
TM (VIII) 3/15/72 TM (VIII)

NAME tm -- provide time information

SYNOPSIS _m
t _

DESCRIPTION tm
_ _ is used to provide timing information. Output
like the following is given:

tim [Link] 2:00.8


ovh [Link] 17.0
swp [Link] 4.6
dsk [Link] 4.5
idl [Link] 1:33.3
usr [Link] 1.2
der 0, 54 0, 0

The first column of numbers gives totals in the


named categories since the last time the system
was cold-booted; the second column gives the
changes since the last time t _m
_ was invoked. The
top left number is badly truncated and should be
ignored. o _v
_h_ is time spent executing in the sys-
tem; s
_w_p
_ is time waiting for swap I/O; d _s
_k_ is
time spent waiting for file system disk I/O; i _d
_l_
is idle time; u _s
_r_ is user execution time; d_e
_r_ is
RF disk error count (left number) and RK disk er-
ror count (right number).

FILES /dev/rf0 (for absolute times); /tmp/ttmp for dif-


ferential timing history.

SEE ALSO time(I), file system(V)

DIAGNOSTICS --

BUGS --

- 1 -
UMOUNT (VIII) 1/20/73 UMOUNT (VIII)

NAME umount -- dismount file system

SYNOPSIS _e
/ _t
_c_/
_u_m
_o_u
_n_t
_ special

DESCRIPTION um
_ _o
_u_n
_t_ announces to the system that the removable
file system previously mounted on special file
_p
s _e
_c_i
_a_l
_ is to be removed.

The user must take care not only that all I/O ac-
tivity on the file system has ceased, but that no
one has his current directory on it.

Only the super-user may issue this command.

FILES --

SEE ALSO mount(VIII)

DIAGNOSTICS "?"

BUGS This command is not, in fact, restricted to the


super-user.

- 1 -

You might also like