690 13500 01_Altos_586_and_ACS8600_Xenix_Development_Systetem_Prog_Ref_May83 01 Altos 586 And ACS8600 Xenix Development Systetem Prog Ref May83

690-13500-01_Altos_586_and_ACS8600_Xenix_Development_Systetem_Prog_Ref_May83 690-13500-01_Altos_586_and_ACS8600_Xenix_Development_Systetem_Prog_Ref_May83

User Manual: 690-13500-01_Altos_586_and_ACS8600_Xenix_Development_Systetem_Prog_Ref_May83

Open the PDF directly: View PDF PDF.
Page Count: 494

Download690-13500-01_Altos_586_and_ACS8600_Xenix_Development_Systetem_Prog_Ref_May83 690-13500-01 Altos 586 And ACS8600 Xenix Development Systetem Prog Ref May83
Open PDF In BrowserView PDF
ALms 586 AIID ACS 868. CORPDBR

SYS~

XB1IIX DBVBLOPIIBft SYSTEM
PROGRAIIIIER' S REPERBRCB GUmB

Al tos Computer Systems
2641 Orchard Park Way
San Joser CA 95134

mE IBPORIIA'.fIOR IB mIS DOCUMBft IS SUBJBC'.f TO
CHARGE WI'.fHOUT NOTICE. NEW EDITIONS OP THIS
DOCUMBft WILL IBCORPORATB CBAlIGES AS mBY ARB
PUBLISHEl).

Copyright ©1983.

All rights reserved.

ALTOS Manual Number:

698-13588-8.1

Altos COliputer Systeas.
May 1983

ACDatLBDGBllBftS

ALTOS is a registered trademark of Altos Computer
Systems.
XENIX is a trademark of Microsoft, Incorporated and
is a l6-bit microcomputer implementation of the
UNIX operating system, version 7.
UNIX is a trademark of Bell Laboratories
UNET is a trademark of 3Com Corporation

TABLE OF CONTENTS

1.

USING THIS MANUAL
Purpose/Scope
Organization

1-2
1-2
1-2

OTHER DOCUMENTATION AVAILABLE
Altos 586 or ACS 8600 Operator's Guide
Altos Introduction to XENIX Manual
XENIX Reference Card
Altos Application Software Guide
Altos UNET User Guide
Bell Laboratories Manuals
UNIX Programmer's Manual
Commercially Available Books

1-4
1-4
1-4
1-4
1-4
1-4
1-4
1-4
1-5

2.

I>

INTRODUCTION

USING XENIX

TOPICS COVERED IN INTRODUCTION TO XENIX MANUAL

2-2

INSTALLING XENIX DEVELOPMENT SYSTEM

2-3

LEARN PROGRAM
Installing Learn
Running Learn

2-7
2-7
2-8

CREATING

2-9

3•

N~'l

MENUS

UTILITY PROGRAMS REFERENCE GUIDE

USEFUL UTILITIES

3-1

UNIX MANUAL CHANGES AND ADDITIONS

3-3

ADD .CT (1)
ADD. HD (l)
AEMAIL (1)
APROPOS ( 1)
BSH (1)
CSE ( 1)
CXREF(l)
DATE (1)
DIGEST(l)
DISABLE(C)
DUMP.HD (1)
ENABLE (C)
EDIT(l)
EX (1)
FCOPY(l)
FINGER (1)
FLEECE(l)

3-6
3-7
3-8

3-l0A
3-11
3-15
3-38A
3-38B
3-39

3-40A
3-40B

3-40C
3-41
3-45
3-49
3-49A
3-49B
i

TABLE OF

3.

UTILITY

PROGRAMS

REFERENCE

FOLD(l)
FO&\1AT( 1)
FROM (1)

FSCK (1)
FTP (1)
HEAD (1)

IUL (1)
LAST (1)
LAYOUT (1)
LEAVE(l)
LS (1)
MAIL{l)
MAKE.HD(l)
MAKEWHATIS(l)
MAP(l)
MKCONF(lM)
MODEM(l) , UNMODEM(l)
MORE (1)
MULTIUSER(l)
PAGE (1)
PRINTENV (1)
PS (1)
RANLIB(l)
RESET(l)
RESTORE.HD(l)
SDDATE(lM)
SETMODE(l)
SIZEFS(l)
TAR(l)
TRANSP(l)
UA (1)
VI (1)
LOCKING (2)
RDCHK(2)
CURSES (3)
MENU S ( 5)
TERMCAP (5)
TTYTYPE(5)

CO~ENTS

GUIDE

(Continued)
3-49C
3-50
3-50A
3-51
3-54
3-55A
3-55B
3-55C
3-56
3-57A
3-58
3-61
3-68A
3-68B
3-69
3-69A
3-69C
3-69D
3-70
3-70A
3-71
3-72
3-74A
3-75
3-75A
3-75B
3-76
3-77
3-78
3-80A
3-81
3-85
3-87
3-89
3-90
3-92
3-97
3-108

APPENDICES:

A.

NUMERIC FORMATS, C, ABD FORTRAlI 77

INTEGER FORMATS
FLOATING-POINT FORMATS
VALUES IN MEMORY
DEVELOP~

SYSTEM

~LITIBS

B.

SAMPLE LIST OF XERIX

C.

TRANSFERRIRG PILES BETWEEN ACS 86.1 AND ALTOS 586 OR OI.rBBR
COIIPOTER SYSTBKS (ASYNCHROROOS CORII1JRICATIORS)

USING CU FACILITY
TRANSFERRING FILES UNDER UUCP FACILITY
CONNECTING THE ACS 8600 AND THE 586
PREPARING THE CONFIGURATION FILES
Recommended Entries
IF YOU HAVE SPECIAL REQUIREMENTS
Assigning the System Names
Defining the Communications Line Characteristics
Supplying the Login Information
Defining the File Accessibility
DISABLING AND ENABLING THE TTY PORTS
TESTING THE UUCP NETWORK
COPYING FILES USING UUCP
USING THE UUCP COMMAND
USING MODEMS WITH ALTOS XENIX SYSTEMS
D.

al86 ASSEMBLY LARGUAGE REFERERCB MARUAL

XENIX Software Development Extract from Microsoft Manual
E.

TUTORIAL ABD REFERERCE MATERIAL
(UNIVERSITY OP CALIFORNIA, BERKBLEY MARUALS)

Introduction to the C Shell
An Introduction to Display Editing with Vi
Quick Reference for Ex,Vi
Ex Reference Manual
Edit: A Tutorial
Ex/Edit Command Summary (Version 2.0)
Mail Reference Manual
-ME Reference Manual
Screen Updating and Cursor Movement Optimization:
Package

An

v

A Library

CI1AftBR 1:
IftRODUC'.rIOR

This manual describes the Altos XENIX Development System on the
Altos 586 and ACS 8600 Computer Systems. It provides reference
information and step-by-step (tutorial) procedures, which are
primarily aimed at the programmer or the advanced system user. A
first-time computer user can use this manual also, but it is
recommended that the Introduction to XBIIIX Manual be read first.

1-1

USING THIS MAROAL
Purpose/Scope

This manual describes items that are unique to the Altos
implementation of the XENIX operating system or that are useful
for the programmer or advanced system user. It also serves as a
guide to the other documentation that is available on XENIX/UNIX.
Organization

This manual is divided into three chapters:
Chapter 1 lists other Altos documents that you receive as part of
your XENIX operating system.
It also lists commercially-available documentation.
Chapter 2 provides instructions for installing the XENIX Development System, and discusses the online tutorial, learn, and tells
you how to create new menus.
Chapter 3 lists useful utilities and describes the changes and
addi tions that exist between the Al tos implementa tion of XENIX
and the Bell Laboratories Standard Version 7 of the UNIX
operating system.
The variations and additions are documented in the standard Bell
Laboratories format. The Altos documentation can be left in this
supplement or can be inserted into the Bell Laboratories OBIX
Program.erls Manual.
The Appendices contain general reference material.
Appendix A.

Numeric Formats, C, and Fortran 77:

Reference information on the internal format used
for numerical representation in these languages.
Appendix B.

Sample List of XENIX Utilities:

A sample list of utilities fUrnished with your
system.
Appendix C.

Transferring Files Between ACS 8688 and
ALTOS 586 or Other Computer Systems
(Asynchronous Communications):

A description on how to transfer files between the
ACS 8688 and Altos 586 XENIX computer systems, or
between two Altos XENIX computer systems which
support asynchronous (serial) communications. It
discusses the ~ (call UNIX) and .I.W.&R (UNIX-to-UNIX
copy) facilities. For ACS 8608 versions 2.2d and
A1tos 586 versions 2.3 and higher, refer to a
description of the File Transfer Utility for Xenix1-2

to-Xenix (ftp), discussed in Appendix H of the
Introduction ~ Xenix manual. It also discusses how
to use modems with your Altos XENIX systems.
Appendix D.

8086 Assembly Language Reference Manual:

A description of the XENIX 8086 Assembly Language.
Appendix E. Tutorial and Reference Material
(University of California, Berkeley Manuals) :
Documentation describing UNIX modifications
developed at the University of California,
Berkeley. The material is supplied from the
Regents of the University.

1-3

omBR DOCtJIIBJr.rA'rIOR AVAILABLE

The follow ing documentation is furnished with your XENIX
operating system. The only commercially-available book that is
provided is A User Guide to the ORIX Systea.
Altos 586 or ACS 8688 Operator's Guide

This manual describes the Altos computer system and its operating
specifications. It provides step-by-step procedures on how to
unpack and set up the computer system, how to install
peripherals, how to verify proper functioning of the system, and
briefly describes how to use the Altos diagnostics software.
Altos Introduction to XBRIX Manual

This manual, describes the Altos implementation of the XENIX
operating system on the Altos 586 and ACS 8600 computer systems.
It provides background information and step-by-step procedures,
which are primarily aimed at a first-time computer user, on how
to install XENIX, how to log on/off, how to shut down the system
properly, how to save and restore files, and describes system
maintenance.
XBIIX Reference card

A concise reference card, which contains information on how to
use the Altos implementation of XENIX, describes the XENIX
commands, and lists the Business Shell (BSH) menus.
Altos Application Software Guide

(The ASS Shell is an optional package.) The Altos XBJlIX Applications Software Guide provides information on how to install the
optional ABS Menu Shell and the application programs, and how to
access the ASS menus.
Altos

ORB~

User Guide

(The communication network services is an optional package.)
This document p~ovides information on how to install the optional
communication network services and how to use them.
Bell Laboratories Manuals
OJIIX Prograaaer's Manual, Seventh Edition.
volume set.

This is a three-

Volume 1 provides general information about UNIX and
about the manual set. It contains reference information on utilities and system calls, organized into
chapters.

1-4

Volume 2A contains supplementary and tutorial
information. For example, this volume includes an index
to volume 2A and 2B, tutorials for the UNIX text
editor,
information on document preparation, and
information on Unix programming (C language).
Volume 2B contains additional reference material, and
includes advanced topics and languages. For example,
this volume includes information or supporting tools
and languages such as yacc, which is a tool for writing
compilers for other languages.
It also includes
information on system implementation and maintenance.
Commercially Available Books

There are numerous commercially available books on UNIX that
explain it and give tutorial material. Two such books are:
A User Guide to the UNIX System, by Thomas and Yates.
(This book is supplied with the XENIX operating system.)
It
explains UNIX concepts and provides tutorials for getting started
with UNIX and for the most useful commands. All the utilities
listed in the book may not be provided with your XENIX operating
system. Refer to Appendix B, Sample Listing of XENIX Development
System Utilities, for a listing of utilities provided with your
system.
Using the UNIX Systea, by Richard Gauthier.

This book is more like a textbook than the Thomas and Yates'
book. It presents a more in depth explanation of UNIX, which is
of value to the programmer and those who are already familiar
with A User's Guide to the UNIX System.
Three useful programming books related to UNIX are:
The C Programming Language, by Kernighan and Ritchie.
This book describes the C programming language, which is the
language that the UNIX operating system is written in.
It
provides tutorials as well as a reference chapter.
Software Tools, by Kernighan and Plauger.
This books is a guide to good programming techniques and a source
of proven, useful programs written in RatFor (Rational Fortan).
The C language, which is designed for UNIX, provided the model
for RatFor. Many of the tools described in this book are based
on UNIX models.
Learning to Program in C, by Thomas Plum. This book teaches
the C programming language from the ground up. With or without
previous experience, anyone acquainted with computers will find a
clear description of how the language works from this book.

1-5

CIIAftBll 2:
OS:IBG XBRIX

The Altos Introduction to XZBIX lIanual covers the XENIX Run-Time
and portions of the Development System. Topics that are unique
to the development system are described in this chapter.

2-1

'fOPICS OOVBBBD IR nr.rRODUCl'IOR 'fO XBIlIX IlARUAL

This manual covers the bas ic XENIX utili ties and how to use the
business shell menu system. Topics covered include:
Introduction to Operating System Concepts
Introduction to XENIX Operating System Concepts
Introduction to the Business Shell Menu System
Introduction to System Administration and Maintenance
Installing XENIX Run-Time System
Upgrading Older Versions of XENIX
Getting Started with XENIX
Configuring the Ports
Creating and Changing User Accounts
Starting Up XENIX (Booting from Hard Disk)
Log In, Log Off, and Quit
Setting and Changing Passwords
Using XENIX on a Regular Basis
Using the Business Shell Menu System
Basic Utilities
System Administration Utilities
Saving and Restoring Files
Random-Access Diskette Files
Checking and Cleaning Up Files
Shutting Down System
Using the ~ Text Editor
Appendices:
Hard Disk Organizatin
Floppy Disk Organization
Cartridge Tape Organizatio
Printer Information
Terminal Capabilities
File Transfer Program
For more information, refer to the Introduction to XBI1IX BaDual.

2-2

IBS~I-';

URIX DBVBLOPIlBft

SYS~

To install the XENIX Development System on your Al tos Computer
System, you should:
1.

Install the Xenix Run-Time System by following the instructions in the Altos Introduction to Xenix Manoal. Do not
shut the system down.
If you interrupt the installation procedure for some reason,
or your system was shut down by a power failure or system
crash, see the Resuming rnterrupted Installation section in
the Altos Introduction to XBRIX Manoal.

2.

Make sure you are logged in as super-user (root).

3.

Enter

# cd

/

(CR)

This command causes the system to go to the top directory
(or parent directory) of the XENIX system.
4.

Insert the diskette labeled nXENIX DEVELOPMENT SYSTEM
UTILITIES #1 of n,n where nnn is the total number of utility
diskettes.

5.

Enter

# tar xv

(CR)

This command causes the directories and files on the utility
diskette to be loaded onto the XENIX System. As files are
copied from diskette to hard disk, you will see messges of
the form:

x nFilename n , nnnnn bytes, nn tape blocks
•
•
•

x "Filename n , nnnnn bytes, nn tape blocks
ROTE
DO RO~
REIIOVE

~OUCB ANY KBYS OR ~BE KBYBOARD OR
DISKE~'lE UR~IL YOU SEE 'lBE SUPBR-USBR

PROIIP'l CBARACUR (I).

2-3

6.

When you see the super-user prompt character (#), remove the
diskette and store it in a safe place.

7.

Repeat steps 4 through 6 for each XENIX Development System
utility diskette.
ROTE:

IF AVAILABLE DISK SPACE IS A PROBLEIl OR YOUR
SYSDIl, YOU CAlI IBSIJIALL I:J()ftIORS OF 1'IIB XBJ[[X
DEVBLOPIlER~ SYS~EIl RATHER ~ ~E ER~IRE
PACKAGE. IF YOU DBSIRE, YOU CAR DISPLAY DE
COR~ER~S OF A DISKE~IJIB BY ER~BRIBG tar tv
(CR>. NO~E THE URWAR~BD FILBS YOU WART ~O
RBIIOVE AF~ER IBS~ALLIBG DISKE~~B PBR ABOVB
IBS'lRUCfiOBS.
8.

When you have loaded all of the utility diskettes, enter

# install (CR>

9.

This step is optional.
optional unlinked kernel can be installed. It contains a
new swapping algorithm, which swaps out processes that are
waiting for other processes first.
The old swapping
algorithm swapped out the largest process that wasn't
actually running. This would occur even if the process was
a large application that was just waiting for terminal
input.

An

If you wish to load the "Unlinked Kernel," you should:
Insert the diskette labeled "UNLINKED KERNEL."
Enter

# tar

"XV

(CR>

Enter

# install (CR>
Unlinked Kernel installed.

Remove the diskette and store it in a safe place.
You have just installed the Unlinked Kernel.

2-4

10.

To load the C compiler onto the XENIX system, you should:
Insert the diskette labeled "C COMPILER."
Enter

t tar xv 

F77 installed/Remove diskette and store it in a safe
place.
You have just loaded the UNIX Fortran compiler.
12.

If the prior steps were successful, your XENIX Development
System is correctly installed.
If you purchased the optional Altos communication network
services, refer to the Altos ~ User Guide for information
on how to install the communication network services.

2-5

If you purchased the ABS package or other Altos application
packages, refer to the Altos XB.IX Application Software
Guide for information on how to install the ABS Menu Shell
and application programs.
If you wish to start up XENIX, see the Getting Started with
XENIX chapter in the Altos Introduction to XBBIX Manual.
If you don't plan on using your XENIX system at this time,
you can shut the system down by entering:

# sync 
# etc/baltsys


** Normal System Shutdown **

2-6

The learn program is an automated instructional facility which
provides tutorial information about the XENIX system and some of
the programs that run under it. Learn is especially useful for
the first-time user because it is interactive and requires no
prior UNIX experience.
At present, the learn program covers the following topics:
Basic File handling commands
The UNIX ~ text editor
Advanced file handling
The ~ language for typing mathematics
The n-msn macro package for document formatting
The C programming language
For more information, refer to the UNIX Progra••er's Kanua1,
Seventh Edition, Volume 2A, chapter 7, LEARN - Computer Aided
Instruction of UNIX (Second Edition).
Insta11ing Learn
After you have installed the XENIX Development System, install
learn as follows:
1)

Log in as root.

2)

Enter:

t cd /usr/lib/leara (CR>
t .ake
(CR>
t .ake p1ay log (CR>

3)

When the prompt (t) appears, the learn program is completely
activated.

4)

To check that the required files are set up properly, enter:
i .ake check (CR>

2-7

Running Learn

Learn may be run by any user, from any directory in the system,
by entering:

(system prompt) lear.n



OR

(system prompt) lear.n Pilaaa.e 
where: Filename

= lesson

desire, such as "editor."

2-8

CREAnBG BBW IIBBUS

A menu system is defined as a collection of menus, each of which
is an ASCII text file. It is relatively easy to create a new,
customized Business Shell (BSH) menu system or to modify the
default menu system. The procedure to create a menu system is as
follows:
Create a text file containing the source menu in the following
format:
&Menuidentifier
• • • the substance of the JleDU • •
• • • not over 24 lines length
&Actions
• • • zero or .ore sequences of • • •
(-> prompt
size
• • • sequences of actions • • •
• • •
• • • for this proapt

This sequence may be repeated as often as desired. The ampersand (&) and tilde (-) must appear in the first column. &Actions
must appear, even if there are no actions.
The substances of each menu is composed of text which will be
reproduced exactly as it appears in the location where it
appears. There are five exceptions where characters have special
meanings:
denotes a valid Rprompt R string (it is the text of
the actual prompt)
"!date"

inserts the current date and time:
Fri Oct 28 16:28 1983

"luser n

inserts the current user id:

n !pwdn

inserts the current directory:

R

1 @n

Don
/user/don/2

: indicates where to leave the cursor

The n! n may appear as a suff ix, in which case the str ing will be
right-justified instead of left-justified.
The prompts must be reproduced as they are expected to be typed,
in the Actions chapter. The actions may be composed of BSH
commands or commands which are executed by the standard XENIX
shell (/bin/sh). The actions should all be indented one tab
stop. RSize R rows will be reserved at the bottom of the screen
for output. If size is omitted, a value of 5 will be used. If
size is 9, the entire screen will be used. After executing the
actions, the message

2-9

[Type return to continue]
will appear .t the bottom of the screen. If size is -1 the
entire screen is used, but no message [Type return to continue]
is issued; and BSH resumes without pause after all the actions
have been executed.
Transfer to another menu is specified by writing the name of the
destination menu in the semantics field.
Commands to be executed by the BSH interpreter must be typed oneper-line.
Commands to be executed by UNIX follow the usual conventions.
See the URZX Progra.aer·s Manual.
For example, the the menu for Electronic Mail can be created as
follows:

&Mail
!date

\ELECTRONIC-MAIL-SERVICES
-a - Receive-mail
-b - Send-mail
-c - Return-to-starting-menu

&Actions
-a

o

mail
-1

echo
read
echo
echo
mail

-n "To whom do you wish to send mail?"
x
"Now type the message."
"Terminate it by typing a control _d."
$x

Start

See the ~, digest, menus, and ~m~ utilities in the V.IX
Progra•• er's Kanual and Chapter 3, Utility Programs Reference
Guide, for more information.

2-11

CBAPrBR 3:

ftILlft PROGRAIIS RBFBRElICE GUIDE

USEFUL

UTILI~IES

Table 3-1 lists some useful utilities that are supplied with
the Altos implementation of XENIX. This list is not intended to
be complete, but merely a summary of those utilities you will
find useful in getting started with XENIX. A complete listing
and description for all utilities may be found in the UNIX
Programmer's Manual, Volume 1.
You may list the full set of utilities supplied with any
particular release of XENIX by displaying the contents of the
/bin, /usr/bin, and /etc directories.
Appendix F contains a
sample list of utilities.
The Altos implementation of XENIX provides some utilities which
differ from standard UNIX, and also some new utilities. This
chapter documents the changed and new utilities.
See Table 3-2
for a quick reference.
Note in particular: .f.su:mAt, fcopy,
multiuser, and YA, and the new version of~.
The Business
Shell, hAh, has two accompanying utilities, menus and digest.
See also Appendix I for reference and tutorial material on the
University of California, Berkeley utilities, such as the screen
editior

n.

3-1

~able

3-1.

UTILITY

A List of Useful Utilities for Getting Started
DESCRIPTION

ar

Object library manager and archiver

as

XENIX 8986relocatable assembler

cat

Display a file

cc

·C· language compiler

cd

Change directory. Changes your current posi tion
in the File System hierarchy.

chmod

Change mode. Changes file protection attributes

chown

Change file ownership

cmp

Compare two files

cp

Copy a file

ed

The standard UNIX editor

ftp

XENIX file transfer program

ld

XENIX linkage editor

Is

List. Displays the contents of the current directory

mkdir

Make a new directory

mv

Move. Renames files and directories

od

Displays an octal dump of a file

ps

Display system status

pwd

P r in two r kin g d ire c tor y •
Dis P I a y s cur r en t
position in the directory hierarchy

rm

Remove.

rmdir

Delete a directory

setmode

Sets mode for serial printer not run at 9699 baud

stty

Set terminal options, such as baud rate

tar

File system archiver.
dumps and restores

wall

Write to all users.

write

Write to other logged in users.

Deletes a file

3-2

May be used for file system

UNIX MANUAL CHARGES AND

ADDI~IONS

The material in this chapter may remain in this supplement or be
inserted in Chapters 1 through 5 of Volume 1 of the U8IX
Progra•• er's Kanoa~, as you wish. If you insert these documents
into the manual, place them in the chapters corresponding to the
number in parentheses after the utility name. (Entries within
chapters are in alphabetic order.)
Some of the utilities are enhancements or variations of existing
Bell Laboratories UNIX utilities. Others are completely new.
The origin of each utility is specified (in abbreviated form) in
column 2 of Table 3-2.
Utilities labelled "(altos)" are provided by Altos Computer
Systems.
Utilities labelled "(bell)" were developed by Bell
Laboratories after their current manual was published.
Utilities labelled "(msoft)" were developed by Microsoft, Inc.
Utilities labelled "(uofcb)" were developed at the
University of California, Berkeley. They are supplied under
license from the Regents of the University.
!fable 3-2.

List of UNXX

UTILITY

SOURCE

add.ct(l}

(altos)

Optional.

Add cartridge tape to system.

add.hd(l)

(altos)

Optional.
system.

Add additional hard disk to

aemail (1)

(altos)

Optional. Altos Electronic Mail Facility is an intelligent, screen-oriented
"user friendly" mail processing system.

bsh (1)

(altos)

Business Shell.
A menu-driven user
system with special guidance and
convenience features. It enables you to
access the more commonly used UNIX
utilities via menus.

csh

(uofcb)

A shell (command interpreter) with Clike syntax.

(altos)

Create menu systems for the Business
Shell.

(1)

digest (1)

Kan~

Changes and Additions

DESCRIPTION

3-3

'lable 3-2.

List of DlIIX lIanaal Changes and Additions (cont.)

UTILITY

SOURCE

edit (1)

(uofcb)

Text editor (variant of the ex editor
for new or casual users).

ex

(uofcb)

Text editor.

fcopy(l)

(al tos)

Copy a floppy diskette, while in XENIX.

format (1)

(altos)

Format a floppy diskette,
XENIX.

fsck (1)

(bell)

File system consistency check and interactive repair.

ftp(l)

(altos)

File transfer program.

layout (1)

(al tos)

Configure a hard disk.

ls (1)

(uofcb)

List contents of directory.

(uofcb)

Send and receive mail.
(The U.C.B.
"Mail" utility goes in front of, and
makes use of, the Bell Labs "mail" utility. The names of the two utilities are
distinguished by whether the first letter is capitalized or lower case.)

map(l)

(altos)

Create an alternate sector map for a
hard disk drive.

mul tiuser (1)

(altos)

Bring the system up multiuser.

printenv(l)

(uofcb)

Print out the environment.

ps(l)

(uofcb)

Processor status.

reset (1)

(uofcb)

Reset the terminal status bits to a
predef ined state.

setmode(l)

(altos)

Sets mode for serial printer not run at
9680 baud.

sizefs(l)

(altos)

Determine the size of a logical device
from the layout information associated
with a hard disk.

tar(l)

(bell)

Tape or floppy archiver.
restores hard disk files.

(l)

Mail

(1)

DESCIUPTION

3-4

while in

Dumps and

Table 3.2.

List of UNIX Manual Changes and Additions (Cant.)

UTILITY

SOURCE

ua(l)

(altos)

User administration. Adds and deletes
user accounts on the system.

vi (1)

(uofcb)

Screen oriented (visual) display editor.

locking (2)

(msoft)

Lock or unlock a record of a file.

rdchk (2)

(msoft)

Check if there is data to be read.

curses(3)

(uofcb)

Screen functions with "optional" cursor
motion. (Has window capability.)

menus(s)

(al tos)

Develop menus for Business Shell.

termcap(5)

(uofcb)

Data base which defines cursor-control
sequences for most commonly used CRT
terminals. It is used by most "screen
oriented n software, such as the Altos
shell and visual screen editor, ~.

ttytype(5)

(altos)

Data base for defining terminal type
associated with each serial port.

DESCRIPTION

3-5

ADD.~(l)

ADD.~(l)

NAME

add.ct - add a cartridge tape drive

SYNOPSIS
add.ct
DESCRIPTION
Add.ct is a shell script which assists the installer of a
cartridge tape drive under XENIX. This script requires no
interaction with the installer.
The purpose of this script is to produce a device entry for
the cartridge tape drive in the /dev directory. When this
script is invoked, a device named /dev/ct9 will be created
in /dev for the ACS 8699.

lion
Add'Gt is an option on the ACS 8688 only, it
is only provided with the cartridge tape.
~he 586 Kernel includes cartridge tape
devices na.ed /dev/ct, /dev/rct, /dev/nct,
and /dev/nrct in the /dev directory.

3-6

ADD.BD(l)

ADD.BD(l)

NAME
add.hd - add a second hard disk
SYNOPSIS
add.hd
DESCRIPTION
A~~~

is a shell script which helps the user to install a
second hard disk under XENIX.
The first thing that the
script does is prompt the user for the size of the second
drive. It asks you whether you have a 10, 20, 30, or a 40
megabyte drive.
Once you reply with a correct number it
will tell you that it is making the appropriate sized disk.
Part of the process of making the extra disk is to run the
layout(l) program, which divides the disk into two areas.
One area is reserved for spare sectors (in case of bad
spots), and the other area is ready to be made into a file
system.
The layout program is immediately followed by the
map(l) program, which checks the second drive for bad spots.
If there are any, it maps them into the spare area. When
the map(l) program is complete (10-20 minutes), a file
system is created on the second drive and checked.

As its final act the script creates the directory /usr2, and
tells you how to insert the second drive into the XENIX
directory hierarchy.
When the shell script is completed and you see the XENIX
prompt again, you should add to the file /etc/rc a line
which mounts the second drive as a subdirectory, such as:
/etc/mount /dev/hdla /usr2
This means that each time you bring the system up multiuser, files and directories created in the directory /usr2
will be physically located on the second drive.
SEE ALSO
layout(l)
BUGS

Add.hd runs significantly slower (3-4 times),
multi-user.

3-7

when running

AEMAIL{l}

XENIX Programmer's Manual

AEMAIL(l}

NAME

aemail - send and receive mail
SYNOPSIS
aemail
DESCRIPTION
The Altos Electronic Mail facility is ~n intelligent, screen
oriented, "user friendly" mail processing system. It incorporates the delivery facilities of both Mail(l) and umtp(l),
as well as letting the user specify which editor to use for
text composition.
Aemail is designed around boxes and files. Commands are
shown on the top of the screen, boxes or files are numbered.
When a command or box/file is chosen it is highlighted (if
the users terminal has reverse video). In addition to the
commands listed, AL and ftR (control-L and -R) cause the
screen to be cleared and redrawn, backspace (usually AH)
unselects the chosen comamnd, and interrupt (the RUB or DEL
key) stops the current command. The message "Status: ••• "
that appears on the bottom right part of the screen always
states what the program is currently doing.
Reading mail. Incoming mail is automaticly picked up and
put in the Inbox. It remains here until it is deleted by the
user.
Sending mail. The send command invokes the editor (see
Options below) on a file with the header lines "To:", "Subject:" and "Archive-a-copy (yin) ? nne The user must put at
least one addressee on the "To: "line. (See Addresses
below.) The "Subject:" line is optional, and the last line
tells whether or not to save a copy of this in the users
Archive Box. The user adds whatever text they desire to the
rest of the file. When the user exits from the editor,
aemail checks the addressee(s) to make sure they exist. If
it finas one" (or more') addressees that it doesn't recognize,
it asks if the user wishes to invoke the editor again to
correct this. If not, the piece of mail is undeliverable
and is left in the users Outbox. If all addresses are
recognized, it is temporarily put in the users Outbox and
then delivered.
.
Addresses And Distribution lists. There are three types of
addresses: a local name, (account name on this machine), a
UNET machine and name (of 'the form "user_name on machine" or
"user_name at machine"), or a UUCP address
("siteluser_name"). Any or all of these three types can be
used in the same distribution list or one "To:" line. The
"To:" line can also have Distribution list names mixed in,
but a Distributiori list cannot have any other distribution
3-8

/

AEMAIL (1)

AEMAIL (1)

XENIX Programmer's Manual

list names in it.

A distribution list has the form:

DistName: address {, address, address, • • • }

.

Note the colon (':') after the DistName, the commas seperating addresses and the ending period ('.'). Distribution
list can extend over several lines. A file in the users
Distribution List Box can contain several Distribution
lists.
Archiye ~ Sayed Mail~. When the user archives a piece
of mail, a copy of it is put in this box.
Recipient ~~. This box contains two lists, of all the
addresses the aemail systems knows about. One is a list of
the users on this machine, the other is a list of all the
other machines this machine has UNET connections to.
Options. The user can set four options, either by editing
them once the user is running the aemail program, or by setting the appropriate environment variables. They are: Editor (environment variable "EDITOR"), a program that takes
one argument, the name of a file to edit, Maildrops ("MAILDROP"), filename(s) of where incoming mail is to be picked
up, Printer ("PRINTPROG"), program that takes one argument,
the name of the file to be printed; and Shell, ("SHELL").
(See below for defaults.)
FILES

-/.aemail_dir/Inbox/*
-/.aemail_dir/Outbox/*
-/.aemail_dir/SavedMail/*
-/.aemail_dir/DistLists/*
/etc/passwd
/etc/UNET/UNET.routes
/usr/bin/vi (8600/586)
/usr/ucb/vi (68000)
/usr/bin/lpr
/bin/csh
Mail
mail
/etc/UNET/umtp (8600/586)
/usr/UNET/umtp (68000)
/usr/bin/aedeliver
/usr/bin/aepickup

users incoming mail
outgoing mail and undeliverable
mail
mail that is "archived"
distribution lists
to identify recipients
to identify UNET machine connections
default editor
default editor
default print program
default shell
to deliver local or UUCP mail
used by Mail to send things
to deliver UNET mail
"
"
"
"
figures out whether to call Mail
or umtp
transfers mail from "maildrops"
to -/.aemail_dir/Inbox

SEE ALSO
vi, Mail(l)
3-9

AEMAIL(I)

BUGS

XENIX Programmer's Manual

AEMAIL(I}

Addresses can not be a mixture of UNET, UUCP and distribution list names.
Distribution list entries should be able to contain other
distribution names.
The locking mechanism has Mail (I) 's imperfections.
The users PATH environment variable must have the proper
path for Mail, vi and lpr.
Due to a curses bug the screen must be redrawn after highlighting.

3-11

APROPOS (I)

APROPOS (1)

NAME
apropos - locate commands by keyword looKup
SYNOPSIS
apropos keyword .••
DESCRIPTION
Apropos shows which manual sections contain instances of any
of the given keywords in their title. Each word is considered separately and case of letters is ignored.
Words
which are part of other words are considered, thus looking
for compile will hit all instances of 'compiler' also. Try
apropos password
and
apropos editor
If the line starts 'name(section)
you can do 'man
section name l to get the documentation for it. Try 'apropos
format l and then 'man 3s printf l to get the manual on the
subroutine printf.
AprQ~

is actually just the -k option to the m.an(l) com-

mand.
FILES
/usr/lib/whatis
SEE ALSO
makewhatis(l)

I

data base
man(l), catrnan(8)

3-1SA

BSB(1)

BSB(1)

NAME

bsh -- Altos Computer Systems Business Shell

SYNOPSIS
hah [

-fh£a ] [ menu system ]

DESCRIPTION
~ is a menu-driven command language interpreter.
It may
be installed as the "login shell" in the password file, or
it may be invoked directly by the user.
The command is implemented using the termcap and curses
facilities from UC Berkeley. It must be run from a terminal
which is defined within /etc/termcap.
This command should only be run interactively. A user's
terminal may be left in a very strange state if han is run
in the background.
In the options described below, either "line feed" or
"return" performs the newline function.
Options

-L

Start hah in "fast" mode. In this mode, a prompt whose
first letter is a lower-case alphabetic or numeric
character is executed immediately when the first letter
is typed. The system does not wait for a terminating
newline.
Prompts whose first letter is upper-case
alphabetic wait for a terminating newline before executing the requested actions. Fast mode is the default
initial mode, if not over-ridden by the command line or
the BSHINIT variable (see below). The current mode may
be changed during execution through use of the "?mode"
command (described below).

-h

displays a short help message describing how to invoke
hall.

-g

displays a one-line descriptive summary of the syntax
used to invoke bah.

-~

Start ~ in "slow" mode. In this mode, all prompts
must be terminated by newline before execution occurs.
The current mode may be changed during execution
through use of the "?mode" command (described below).

A menu system may be specified if desired. In this case,
utilizes the designated menu system instead of the
default one (/etc/menusys.bin). Prior to use by hall a menu
system must be "digested" using the digest(l) utility. If
the specified menu system does not exist or if it is not
read-accessible, bah issues an error message and terminates.

~

3-11

8SB(1)

BSB(1)

How to create a new menu system and how to update or modify
an existing menu system is described in menus(S).
Commands
prompts
Typing any of the prompts on the current menu screen
immediately causes the actions associated with the
prompt to be executed. It is the responsibility of the
menu designer to ensure that reasonable actions exist
for each prompt. Selecting a prompt with no associated
action causes an error message to be displayed.
An action may be anyone of the following:

> Go to a specified menu
> Execute a shell script

> Execute a bsh internal command
(e.g., chdir(l)}

menuname
Typing the name of a menu
become the current menu.
spelled, or if it does not
system, an error message is

causes it to immediately
If the menu name is misexist in the current menu
displayed.

newline
Typing a newline causes the immediately preceding menu
to become the current one. If there is no previous
menu, an error message is displayed. ~ does not distinguish between "line feed" and "return" -- both
generate a newline.
?

Typing a question mark (?) causes the "help" menu
associated with the current menu to be displayed. Help
menus are no different from normal menus (except,
perhaps, in the type of information they contain).
When the current menu is named "xyz", typing a question
mark is entirely equivalent to typing "xyz?"

??

Typing a pair of question marks {??} causes the ~
system help informa tion to be displayed. It contains
much the same information as is presented here.

menuname?
Typing the name of a menu followed by question mark
causes the designated help menu to become the cur rent
one.
manualpage??
Typing the name of an entry in the Unix manual followed
by two question marks causes the designated manual page
to be displayed. Thus, to see the entry for hs.h one

3-12

BSB(I)

BSB(I)

may type "bsh??"
typing "lman bsh."

This

is precisely equivalent

to

1command
The exclamation point (1) allows the user to "escape"
to the standard shell (sh(l». The command must follow
the usual rules as described in the shell documentation. In particular, the command may consist of a
sequence of shell commands separated by semicolons -thus several actions may be invoked.
If the command is
absent, sh(l) is invoked as a sub-shell with no arguments.
In this case, ~ will be resumed as soon as
the sub-shell terminates. (Usually, this is accomplished by sending the sub-shell an end-of-file. Endof-file is Control-d on most terminals.)
You may
escape to the Berkeley C shell (csh(l»
by typing
"lcsh."
?index
This special command causes hah to display its internal
"index" for the current menu system.
The index
contains the names of every accessible menu.
?mode
This special command allows the user to change from
"slow" mode to "fast" mode and vice versa.
The us~r is
asked if he wishes to change to the alternate mode. If
your response begins with "yn or "y", the change is
made, otherwise the current mode remains in effect.
interrupt
~

will immediately return to the top-level command
interpreter upon receipt of ,an interrupt signal.
Such
a signal is usually generated via the DEL, RUBOUT or
BREAJ< key.

backspace
~

understands the Backspace function (as obtained
from /etc/termcap).

CANcel
llahinterprets the CANcel key to mean "restart input."
The CANcel key is Control-x on many of the more popular
terminals.
ESCape
Typing an ESCape has the same effect as does typing
CANcel.
DC2

If the screen becomes "dirty" for some reason, you can
force ~~h to clear it and redisplay the current
contents by transmitting an ASCII "DC2."
This is
Control-r on most of the currently popular terminals.

q

Typing a "q", "Q" or "Quit" all have the same effect:
3-13

BSB(1)

8SH(1)

.b..:Ul is terminated. If l:uih is your login shell, "quit"
also results in your being logged out.

Enyironment
BSHINIT
The BSHlNIT environment variable contains the initial
val ue of the defaul t mode ("fast" or "slow"). If this
variable does not exist in the environment, hah assumes
"fast" mode. BSHINIT should be set by inserting the
line BSHINIT="fast" or BSHINIT="slow" into your
.prof ile file.
Note that even if .b..:Ul is designated as the "login
shell" in /etc/passwd, your .profile file will be
interpreted correctly. (See login(l) and sh(l).) In
particular, any overriding definitions you may have for
the kill and erase characters will be correctly interpreted by hah.
FILES

-/.profile
/etc/menusys.bin
/etc/passwd
/etc/termcap
/usr/lib/bsh.messages

contains commands to be executed
during login(l)
default menu system used by bsh
used to define a user1s login name,
password, home directory, shell,
etc.
contains terminal attribute descriptions
system warning and error messages

SEE ALSO
digest(lM), login(l), menus(S), sh(l), termcap(S)
DIAGNOSTICS
The diagnostics produced by .b..:Ul are intended to be selfexplanatory.
BUGS

probably should never allow itself to be run in the
background.

~

should detect the fact that the current terminal is not
defined in /etc/termcap and abort gracefully.

~

3-14

CSH(l}

NAME

XENIX Programmer's Manual

CSH(l}

csh - a shell (command interpreter) with C-like syntax

SYNOPSIS
csh [ -cefinstvVxX ] [ arg •••

]

DESCRIPTION
~ is a command language interpreter.
It begins by executing commands from the file '.cshrc' in the ~ directory of
the invoker. If this is a login shell then it also executes
commands from the file '.login' there. In the normal case,
the shell will then begin reading commands from the terminal~ prompting with '% '.
Processing of arguments and the
use of the shell to process files containing command scripts
will be described later.
The shell then repeatedly performs the following actions: a
line of command input is read and broken into words. This
sequence of words is placed on the command history list and
then parsed. Finally each command in the current line is
executed.
When a login shell terminates it executes commands from the
file '.logout' in the users home directory.
Lexical structure
The shell splits input lines into words at blanks and tabs
with the following exceptions. The characters '&' 'I' ';'
' ( I ' ) ' '(I
' ) ' form separate words.
If doubled in '&&',
'I I', '«' or '»' these pairs form single words. These
parser metacharacters may be made part of other words, or
prevented their special meaning, by preceding them with '\'.
A newline preceded by a '\' is equivalent to a blank.
In addition strings enclosed in matched pairs of quotations,
'I "
"~I or 'R', form parts of a word; metacharacters in
these strings, including blanks and tabs, do not form
separate words. These quotations have semantics to be
described subsequently. Within pairs of " or 'ft, characters a newline preceded by a '\' gives a true newline character.
When the shell's input is not a terminal, the character 'Ii
introduces a comment which continues to the end of the input
line. It is prevented this s~ecial meaning when preceded by
'\' and in quotations using' ., ' I " and 'ft'.
Commands
A simple command is a sequence of words, the first of which
specifies the command to be executed. A simple command or a

3-15

CSB{l)

XENIX Programmer's Manual

CSH (1)

sequence of simple commands separated by 'I' characters
forms a pipeline. The output of each command in a pipeline
is connected to the input of the next. Sequences of pipelines may be separated by 'I', and are then executed sequentially. A sequence of pipelines may be executed without
waiting for it to terminate by following it with an '&'.
Such a sequence is automatically prevented from being terminated by a hangup signal, the nohup command need not be
used.
Any of the above may be placed in '(' ')' to form a simple
command (which may be a component of a pipeline, etc.) It is
also possible to separate pipelines with 'II' or '&&' indicating, as in the C language, that the second is to be executed only if the first fails or succeeds respectively. (See
Expressions.)
Substitutions
We now describe the various transformations the shell performs on the input in the order in which they occur.
History substitutions
History substitutions can be used to reintroduce sequences
of words from previous commands, possibly performing modifications on these words. Thus history SUbstitutions provide
a generalization of a ~. function.
History substitutions begin with the character 'I' and may
begin anywhere in the input stream if a history substitution
is not already in progress. This '1' may be preceded by an
'\' to prevent its special meaning, a ' I ' is passed
unchanged when it is followed by a blank, tab, newline, '='
or ' ( I . History substitutions a1so occur when an input line
begins with 'T'. This special abbreviation will be
described later.
.
Any input line which' contains history substi.tution is echoed
on the terminal before it is executed as it could have been
typed without history substitution.
Commands input from the terminal which consist of one or
more words are saved on the history list, the size of which
is controlled by the history variable. The previous command
is always retained. Commands are numbered sequentially from
1.
For definiteness, consider the following output from the
history command:

3-16

.

XENIX Programmer's Manual

CSH(l)

9
H)

11
12

CSH (1)

write michael
ex write.c
cat oldwrite.c
diff *write.c

The commands are shown with their event numbers. It is not
usually necessary to use event numbers, but the current
event number can be made part of the prompt by placing an
'I' in the prompt string.
With the current event 13 we can refer to previous events by
event number 'Ill', relatively as in '1-2' (referring to the
same event), by a prefix of a command word as in 'ld' for
event 12 or 'lw' for event 9, or by a string contained in a
word in the command as in 'l?mic?' also referring to event
9. These forms, without further modification, simply reintroduce the words of the specified events, each separated by
a single blank. As a special case '11' refers to the previous command 1 thus '11' alone is essentially a ~. The form
'Ii' references the current command (the one being typed
in). It allows a word to be selected from further left in
the line, to avoid retyping a long name, as in 'li:l'.
To select words from an event we can follow the event
specification by a ':' and a designator for the desired
words. The words of a input line are numbered from 0, the
first (usually command) word being 0, the second word (first·
argument) being 1, etc. The basic word deSignators are:

o

n
1

$
%
x-~

-~

*
x*
X-

first (command) word
n'th argument
first argument, i.e. '1'
last argument
word matched by (immediately preceding) ?~? search
range of words
abbreviates '0-~'
abbreviates 'i-$', or nothing if only 1 word in event
abbreviates 'X-Sf
like 'X*' but omitting word '$'

The ':' separating the event specification from the word
deSignator can be omitted if the argument selector begins
with a 'i', '$', '*' '-' or '%'. After the optional word
deSignator can be placed a sequence of modifiers, each preceded by a ':'. The following modifiers are defined:
h
r

s/l1";
t
&

g

Remove a trailing pathname component, leaving the head
Remove a trailing '.xxx' component, leaving the root ru
Substitute ~ for L
Remove all leading pathname components, leaving the ta:
Repeat the previous substitution.
Apply the change globally, prefixing the above, e.g. '

3-17

eSB(l)

XENIX Programmer's Manual

p
q
x

eSB (1)

Print the new command but do not execute it.
Quote the substi tuted words, preventing further substi tl
Like q, but break into words at blanks, tabs and newlinE

Unless preceded by a ~g' the modification is applied only to
the first modifiable word. In any case it is an error for
no word to be applicable.
The left hand side of substitutions are not regular expressions in the sense of the editors, but rather strin~s. Any
character may be used as the delimiter in place of /'; a
~\' quotes the delimiter into the ~ and·~ strings.
The
character '&' in the right hand side is replaced by the text
from the left. A '\' quotes '&' also. A null ~ uses the
previous string either from a ~ or from a contextual scan
string ~ in '1?~?'. The trailing delimiter in the substitution may be omitted if a newline follows immediately as may
the trailing '?' in a contextual scan.
A history reference may be given without an event specification, e.g. '1$'. In this case the reference is to the previous command unless a previous history reference occurred
on the same line in which case this form repeats the previous reference. Thus 'l?foo?1 1$' gives the first and last
arguments from the command matching '?foo?l.
A special abbreviation of a history reference occurs when
the first non-blank character of an input line is a 'T'.
This is equivalent to 'l:s1 1 providing a convenient shorthand for substitutions on the text of the previous line.
Thus 'TlbTlib' fixes the spelling of 'lib' in the previous
command. Finally, a history substitution may be surrounded
with '{I and '}I if necessary to insulate it from the characters which follow. Thus, after 'Is -ld "'paul l we might do
'l{l}a' to do 'Is -ld "'paula l , while ~11al would look for a
command starting 'la'.
Quotations with

I

and •

The· quotation "of strings by .. I I and '" I can be used to
prevent all or some of the remainin9substitutions. Strings
enclosed in 'II are prevented any further interpretation.
Strings enclosed in 'ftl are yet variable and command
expanded as described below.
In both cases the resulting text becomes·· (all or part of) a
single word; only in one special case (see Gommand Substiti.tJ.sm below) does a '"I quoted string yield parts of more
than one word; ' I quoted strings never do.
Alias sUbstitution

3-18

eSH (1)

XENIX Programmer's Manual

eSH(l)

The shell maintains a list of aliases which can be established, displayed and modified by the alias and unalias
commands. After a command line is scanned, it is parsed
into distinct commands and the first word of each command,
left-to-right, is checked to see if it has an alias. If it
does, then the text which is the alias for that command is
reread with the history mechanism available as though that
command were the previous input line. The resulting words
replace the command and argument list. If no reference is
made to the history list, then the argument list is left
unchanged.
Thus if the alias for 'Is' is 'Is -1' the command 'Is /usr'
would map to 'Is -1 /usr', the argument list here being
undisturbed. Similarly if the alias for 'lookup' was 'grep
!T /etc/passwd' then 'lookup bill' would map to 'grep bill
/etc/passwd' •
If an alias is found, the word transformation of the input
text is performed and the aliasing process begins again on
the reformed input line. Looping is prevented if the first
word of the new text is the same as the old by flagging it
to prevent further aliasing. Other loops are detected and
cause an error.
Note that the mechanism allows aliases to introduce parser
metasyntax. Thus we can 'alias print 'pr \1* I lpr" to
make a command which ~'~ its arguments to the line printer.
Variable substitution
The shell maintains a set of variables, each of which has as
value a list of zero or more words. Some of these variables
are set by the shell or referred to by it. For instance,
the ~ variable is an image of the shell's argument list,
and words of this variable's value are referred to in special ways.
The values of variables may be displayed and changed by
using the ~ and unset commands. Of the variables referred
to by the shell a number are togglesl the shell does not
care what their value is, only whether they are set or not.
For instance, the verbose variable is a toggle which causes
command input to be echoed. The setting of this variable
results from the -v command line option.
Other operations treat variables numerically. The '@' command permits numeric calculations to be performed and the
result assigned to a variable. Variable values are, however, always represented as (zero or more) strings. For the
purposes of numeric operations, the null string is considered to be zero, and the second and subsequent words of

3-19

csa (1)

XENIX Programmer's Manual

CSH(l)

multiword values are ignored.
After the input line is aliased and parsed, and before each
command is executed, variable substitution is performed
keyed by '$' characters. This expansion can be prevented by
preceding the "'$' with a .. \' except within ''''s where it
always occurs, and within ""s where it never occurs.
Strings quoted by ..... ' are interpreted later (see Commang
subst;j,tution below) so "'$' substitution does not occur there
until later, if at all. A '$' is passed unchanged if followed by a blank, tab, or end-of-line.
Input/output redirections are recognized before variable
expansion, and are variable expanded separately. Otherwise,
the command name and entire argument list are expanded
together. It is thus possible for the first (command) word
to this point to generate more than one word, the first of
which becomes the command name, and the rest of which become
arguments.
Unless enclosed in . . ". or given the ':q' modifier the
results of variable substitution may eventually be command
and filename substituted. Within ..... , a variable whose value
consists of multiple words expands to a (portion of) a single word, with the words of the variables value separated by
blanks. When the ":q' modifier is applied to a sUbstitution
the variable will expand to multiple words with each word
separated by a blank and quoted to prevent later command or
filename substitution.
The following meta sequences are provided for introducing
variable values into the shell input. Except as noted, it
is an error to reference a variable which is not set.
$name
${name}
Are replaced by the words of the value of variable
.na.m.e., each separated by a blank. Braces insulate .ruun.e.
from following characters which would otherwise be part
of it. Shell variables have names consisting of up to
29 letters, digits, and underscores.
If name is not a shell variable, but is set in the environment, then that value is returned (but : modifiers and the
other forms given below are not available in this case).
$name[selector]
${name[selector]}
May be used to select only some of the words from the
value of ~. The selector is subjected to '$' substitution and may consist of a single number or two
numbers separated by a "'-'. The first word of a

3-28

:SB (1)

CSB (1)

XENIX Programmer's Manual

variables value is numbered '1'. If the first number
of a range is omitted it defaults to 'I'. If the last
member of a range is omitted it defaults to '$#name'.
The selector '*' selects all words. It is not an error
for a range to be empty if the second argument is omitted or in range.
$#name
${#name}
Gives the number of words in the variable.
useful for later use in a '[selector] '.
$0

This is

Substitutes the name of the file from which command
input is being read. An error occurs if the name is
not known.

$number
${number}
Equivalent to '$argv[number] '.
$*

Equivalent to '$argv[*] '.

The modifiers ':h', ':t', ':r', ':q' and ':x' may be applied
to the substitutions above as may ':gh', ':gt' and ':gr'.
If braces '{' '}' appear in the command form then the modifiers must appear within the braces. The current implementation allows only one ':' modifier on each '$' expansion.
The following substitutions may not be modified with ,
modifiers.

.. ,

$?name
${?name}
Substitutes the string 'I' if name is set, '0' if it is
not.
$?0

Substitutes "I' if the current input filename is know,
'0' if it is not.

$$

Substitute the (decimal) process number of the (parent)
shell.
Command and filename substitution
The remaining substitutions, command and filename substitution, are applied selectively to the arguments of builtin
commands. This means that portions of expressions which are
not evaluated are not subjected to these expansions. For

3-21

CSH{I}

XENIX Programmer's Manual

eSB(I)

commands which are not internal to the shell, the command
name is substituted separately from the argument list. This
occurs very late, after input-output redirection is performed, and in a child of the main shell.
Command substitution
Command substitution is indicated by a command enclosed in
"~I.
The output from such a command is normally broken into
separate words at blanks, tabs and newlines, with null words
being discarded, this text then replacing the original
string. Within 'n,s, only newlines force new words; blanks
and tabs are preserved.
In any case, the single final newline does not force a new
word. Note that it is thus possible for a command substitution to yield only part of a word, even if the command outputs a complete line.
Filename substi tution
If a word contains any of the character s '*', '1', '[' or
'{I or begins with the character '-', then that word is a
candidate for filename substitution, also known as 'globbing'. This word is then regarded as a pattern, and
replaced with an alphabetically sorted list of file names
which match the pattern. In a list of words specifying
filename substitution it is an error for no pattern to match
an existing file name, but it is not required for each pattern to match. Only the metacharacters '*', '?' and ' [ I
imply pattern matching, the characters '-I and ' { I being
more akin to abbreviations.
In matching filenames, the character '.' at the beginning of
a filename or immediately following a 'II, as well as the
character '/' must be matched explicitly. The character '*'
matches any string of characters, including the null string.
The character '1' matches any Single character. The
sequence '[ •• el' matches anyone of the character s enclosed.
Within '[ ••• ] " a pair of characters separated by '_I
matches any character lexically between the two.
The character '-I at the beginning of a filename is used to
refer to home directories. Standing alone, i.e. '-I it
expands to the invokers home directory as reflected in the
value of the variable ~. When followed by a name consisting of letters, digits and '_I characters the shell searches
for a user with that name and substitutes their home directory; thus '-ken' might expand to '/usr/ken' and
'-ken/chmach' to '/usr/ken/chmach'. If the character '-I is
followed by a character other than a letter or '/' or
appears not at the beginning ofa word, it is left

3-22

:SB (1)

XENIX Programmer's Manual

CSB (1)

undisturbed.
The metanotation 'a{b,c,d}e' is a shorthand .for 'abe ace
adele Left to right order is preserved, with results of
matches being sorted separately at a low level to preserve
this order. This construct may be nested. Thus
'-source/sl/{oldls,ls}.c' expands to '/usr/source/sl/oldls.c
/usr/source/sl/ls.c' whether or not these files exist
without any chance of error if the home directory for
'source' is '/usr/source'. Similarly ' •• /{memo,*box}, might
expand to ' •• /memo •• /box •• /mbox'. (Note that 'memo' was
not sorted with the results of matching '*box-'.) As a special case '{I, 'I' and '{I' are passed undisturbed.
Input/output
The standard input and standard output of a command may be
redirected with the following syntax:

< name

Open file ~ (which is first variable, command and
filename expanded) as the standard input.

« word

Read the shell input up to a line which is identical to
~ is not subjected to variable, filename or
command substitution, and each input line is compared
to E.I.S1 before any substitutions are done on this input
line. Unless a quoting '\', '.', '" or " I appears in
~ variable and command substitution is performed on
the intervening lines, allowing '\1 to quote '$1, '\1
and " I . Commands which are substituted have all
blanks, tabs, and newlines preserved, except for the
final newline which is dropped. The resultant text is
placed in an anonymous temporary file which is given to
the command as standard input.
~.

> name

>1 name
>& name
>&1 name
The file ~ is used as standard output. If the file
does not exist then it is created, if the file exists,
its is truncated, its previous contents being lost.

If the variable nOQlobber is set, then the file must
not exist or be a character special file (e.g. a terminal or '/dev/null') or an error results. This helps
prevent accidental destruction of files. In this case
the ' I ' forms can be used and suppress this check.
The forms involving '&' route the diagnostic output

3-23

CSB (1)

XENIX Programmer's Manual

CSB(l)

into the specified file as well as the standard output.
is expanded in the same way as '' but places
output at the end of the file. If the variable
noclobber is set, then it is an error for the file not
to exist unless one of the ' ! ' forms is given. Otherwise similar to '>'.

If a command is run detached (followed by '&') then the
default standard input for the command is the empty file
'/dev/null'. Otherwise the command receives the environment
in which the shell was invoked as modified by the inputoutput parameters and the presence of the command in a pipeline. Thus, unlike some previous shells, commands run from
a file of shell commands have no access to the text of the
commands by default; rather they receive the original standard input of the shell. The '«' mechanism should be used
to present inline data. This permits shell command scripts
to function as components of pipelines and allows the shell
to block read its input.
Diagnostic output may be directed through a pipe with the
standard output. Simply use the form '/&' rather than just
,/'

.

Expressions
A number of the builtin commands (to be described subsequently) take expressions, in which the operators are similar to those of C, with the same precedence. These expressions appear in the @, ~, if, and while commands. The
following operators are available:
/

%

"

&&

1

(

/

)

T & ==

1= <= >= < > «

»

+

*

Here the precedence increases to the right, '==' and '1=',
, <=' '> = '<' and '>', , <<, and'" >> " . . +' and '-', , *' . . / '
and '%' being, in groups, at the same level. The '==' and
'1=' operatoI:'s compare their arguments as strings, all others operate on numbers. Strings which begin with '9' are
considered octal numbers. Null or missing arguments are
considered '9'. The result of all expressions are strings,
which represent decimal numbers. It is important to note
that no two components of an expression can appear in the
same word; except when adjacent to components of expressions
I

3-24

XENIX Programmer's Manual

:SH (1)

CSH (1)

which are syntactically significant to the parser ('&' 'I'
'IT (1)

XElnx Programmer I s Manual

EDIT(I)

~ME

edit - text editor (variant of the ex editor for new or
casual user s)
{NOPSIS
edit [ -r ] name

...

ESCRIPTION
~ is a variant of the text editor ~ recommended for new
or casual users who wish to use a command oriented editor.
The following brief introduction should help you get started
with ~. A more complete basic introduction is provided by
~: A tutorial • A ~/~ command summary (yersion z.a)
is also very useful. See ~(l) for other useful documents;
in particular, if you are using a CRT terminal you will want
to learn about the display editor ~.
,RIEF INTRODUCTION
To edit the contents of an existing file you begin with the
command "edit name' I to the shell. ~ makes a copy of
the file which you can then edit, and tells you how many
lines and characters are in the file. To create a new file,
just make up a name for the file and try to run ~ on it;
you will cause an error diagnostic, but don't worry.
prompts for commands with the character ':1, which you
should see after starting the editor. If you are editing an
existing file, then you will have some lines in ~I~
buffer (its name for the copy of the file you are editing).
Most commands to ~ use its "current line l I if you donlt
tell them which line to use. Thus if you say print (which
can be abbreviated p) and hit carriage return (as you should
after all ~ commands) this current line will be printed.
If you delete (d) the current line, ~ will print the new
current line. When you start editing, ~ makes the last
line of the file the current line. If you delete this last
line, then the new last line becomes the current one. In
general, after a delete, the next line in the file becomes
the current line. (Deleting the last line is a special
case. )

~

If you start with an empty file, or wish to add some new
lines, then the append Ca) command can be used. After you
give this command (typing a carriage return after the word
append) ~ will read lines from your terminal until you
give a line consisting of just a ".11, placing these lines
after the current line. The last line you type then becomes
the current line. The command insert Ci) is like append but
places the lines you give before, rather than after, the
current line.

3-41

EDIT(l)

XENIX Programmer's Manual

~

and

again to get it back.
cannot be undone.

EDIT (1)

Note that commands such as write

~

To look at the next line in the buffer you can just hit carriage return. To look at a number of lines hit AD (control
key and, while it is held down D key, then let up both)
rather than carriage return. This will show you a half
screen of lines on a CRT or 12 lines on a hardcopy terminal.
You can look at the text around where you are by giving the
command "z.". The current line will then be the last line
printed; you can get back to the line where you were before
the "z." command by saying "" ". The z command can also
be given other following characters "z-" prints a screen
of text (or 24 lines) ending where you are; "z+" prints
the next screenful. If you want less than a screenful of
lines do, e.g., '·z.12" to get 12 lines total. This method
of giving counts works in general; thus you can delete 5
lines starting with the current line with the command
"delete 5".
To find things in the file you can use line numbers if you
happen to know them; since the line numbers change when you
insert and delete lines this is somewhat unreliable. You
can search backwards and forwards in the file for strings by
giving commands of the form /text/ to search forward for
l l l l or ?text? to search backward for ~. If a search
reaches the end of the file without finding the text it
wraps, end around, and continues to search back to the line
where you are. A useful feature here is a search of the
form /A text / which searches for ~ at the beginning of a
line. Similarly /text$/ searches for ~ at the end of a
line. You can leave off the trailing / or ? in these commanas.
The current line has a symbolic name " . " ; this is most
useful in a range of lines as in ".,$print" which prints
the rest of the lines in the file. To get to the last line
in the file you· can refer to it by its symbolic name' '$" •
Thus the command "$ delete" or "$d" deletes the last
line in the file, no matter which line was the current line
before. Arithmetic with line references is also possible.
Thus the line "$-5" is the fifth before the last, and
".+20" is 20 lines after the present.
You can find out which line you are at by doing ".=' '.
This is useful if you wish to move or copy a section of text
within a file or between files. Find out the first and last
line numbers you wish to copy or move (say 10 to 20). For a
move you can then say "10,20move "al' which deletes these
lines from the file and places them in a buffer named A •
.E.di.t has 26 such buffers named A through z.. You can later
get these lines back by doing ""a move ." to put the
3-42

E:DIT(l)

XENIX Programmerls Manual

EDIT (1)

!dit numbers the lines in the buffer, with the first line

having number 1. If you give the command "1 11 then ~
wi~l type this first line.
If you then give the command
delete ~ will delete the first line, and line 2 will
become line 1, and ~ will print the current line (the new
line 1) so you can see where you are. In general, the
current line will always be the last line affected by a commanCl.

You can make a change to some text within the current line
by using the substitute (s) command. You say "S/~/~II
where ~ is replaced by the old characters you want to get
rid of and ~ is the new characters you want to replace it
with.
The command file (f) will tell you how many lines there are
in the buffer you are editing and will say "[Modified] II if
you have changed it. After modifying a file you can put the
buffer text back to replace the file by giving a write (w)
command. You can then leave the editor by issuing a quit
(q) command. If you run ~ on a file, but don't change
it, it is not necessary (but does no harm) to write the file
back. If you try to quit from .e.sti.t. after modifying the
buffer without writing it out, you will be warned that there
has been "No write since last change" and edit will await
another command. If you wish not to write the buffer out
then you can issue another quit command. The buffer is then
irretrievably discarded, and you return to the shell.
By using the delete and append commands, and giving line
numbers to see lines in the file you can make any changes
you desire. You should learn at least a few more things,
however, if you are to use ~ more than a few times.
The change (c) command will change the current line to a
sequence of lines you supply (as in append you give lines up
to a line consisting of only a ".11). You can tell change
to change more than one line by giving the line numbers of
the lines you want to change, i.e. "3,5change ll • You can
print lines this way too. Thus "1,23p l' prints the first
23 lines of the file.
The undo Cu) command will reverse the effect of the last
command you gave which changed the buffer. Thus if give a
SUbstitute command which doesn't do what you want, you can
say undo and the old contents of the line will be restored.
You can also undo an undo command so that you can continue
to change your mind. ~ will give you a warning message
when commands you do affect more than one line of the
buffer. If the amount of change seems unreasonable, you
should consider doing an ~ and looking to see what happened. If you decide that the change is ok, then you can
3-43

EDIT (1)

XENIX Programmer's Manual

EDIT(l)

contents of buffer A after the current line. If you want to
move or copy these lines between files you can give an edit
(e) command after copying the lines, following it with the
name of the other file you wish to edit, i.e. "·edit
chapter2 11 • By changing ~ to ~ above you can get a
pattern for copying lines. If the text you wish to move or
copy is all within one file then you can just say
"lS,2Smove $" for example. It is not necessary to use
named buffers in this case (but you can if you wish).
SEE

ALSO

ex (1), vi (1), 'Edit: A tutorial', by Ricki Blau and James
Joyce

AUTHOR
William Joy
BUGS

See .0.(1) •

3-44

~X

(1)

XENIX Programmer's Manual

EX(l)

~AME

ex - text editor
SYNOPSIS
ex [ -] [-v] [ -t tag ] [ -r ] [ +lineno ] name •••
DESCRIPTION
~ is the root of a family of editors: ~, ~ and ~. ~
is a superset of ~, with the most notable extension being a
display editing facility. Display based editing is the
focus of ~.
If you have not used~, or are a casual user, you will find
that the editor ~ is convenient for you. It avoids some
of the complexities of ~ used mostly by systems programmers
and persons very familiar with ~.
If you have a CRT terminal, you may wish to use a display
based editor: in this case see ~(l), which is a command
which focuses on the display editing portion of ~.
DOCUMENTATION
For ~ and ~ see the !x/~ command summary - version
~.a. The document ~: A tutorial provides a comprehensive
introduction to ~ assuming no previous knowledge of computers or the UNIX system.
The Ex Reference Manual - version ~.a is a comprehensive and
complete manual for the command m~de features of ~, but you
cannot learn to use the editor by reading it. For an introduction to more advanced forms of editing using the command
mode of ~ see the editing documents written by Brian Kernighan for the editor ~: the material in the introductory
and advanced documents works also with ~.
~ Display Editing lli.t.h .vi introduces the
display editor ~ and provides reference material on ~. The
.vi Quick Reference card summarizes the commands of ~ in a
usetul, functional way, and is useful with the Introduction.

An Introduction

FOR ED USERS
If you have used ~ you will find that ~ has a number of
new features useful on CRT terminals. Intelligent terminals
and high speed terminals are very pleasant to use with ~.
Generally, the editor uses far more of the capabilities of
terminals than ~ does, and uses the terminal capability
data base termcap(l) and the type of the terminal you are
using from the variable TERM in the environment to determine
how to drive your terminal efficiently. The editor makes
use of features such as insert and delete character and line
in its visual command (which can be abbreviated vi) and
which is the central mode of editing when using ~(l).
3-45

EX(l)

EX (1)

XENIX Programmer's Manual

There is also an interline editing open
works on all terminals.

(0)

command which

EX contains a number of new features for easily viewing the
text of the file. The z command gives easy access to windows of text. Hitting AD causes the editor to scroll a
half-window of text and is more useful for quickly stepping
through a file than just hitting return. Of course, the
screen oriented visual mode gives constant access to editing
context.
.
EX gives you more help when you make mistakes. The undo (u)
command allows you to reverse any single change which goes
astray. IX gives you a lot of feedback, normally printing
changed lines, and indicates when more than a few lines are
affected by a command so that it is easy to detect when a
command has affected more lines than it should have.
The editor also normally prevents overwriting existing files
unless you edited them so that you don't accidentally
clobber with a write a file other than the one you are editing. If the system (or editor) crashes, or you accidentally
hang up the phone, you can use the editor recover command to
retrieve your work. This will get you back to within a few
lines of where you left off.
EX has several features for dealing with more than one file
at a time. You can give it a list of files on the command
line and use the next (n) command to deal with each in turn.
The next command can also be given a list of file names, or
a pattern as used by the shell to specify a new set of files
to be dealt with. In general, filenames in the editor ma~
be formed with full shell metasyntax. The metacharacter %'
is also available in forming filenames and is replaced by
the name of the current file. For editing large groups of
related files you can use ~'a tag command to quickly locate
functions and other important points in any of the files.
This is useful when working on a large program when you want
to quickly fin4the definition of a particular function.
The command ctags(l) builds a .tas.a. file or a group of C programs.
For moving text between files and within a file the editor
has a group of buffers, named 4 through ~. You can place
text in these named buffers and carry it over when you edit
another file.
.
There is a command & in ~ which repeats the last substitute
command. In addition there is a confirmed substitute command. You give a range of SUbstitutions to be done and the
editor interactively asks whether each substitution is
desired.
3-46

~X

XENIX Programmer's Manual

(1)

EX(l)

You can use the sUbstitute command in ~ to systematically
convert the case of letters between upper and lower case.
It is possible to ignore case of letters in searches and
substitutions. ~ also allows regular expressidns which
match words to be constructed. This is convenient, for
example, in searching for the word "edit" if your document
also contains the word "editor."
~ has a set of options which you can set to tailor it to
your liking. One option which is very useful is the autoin~ option which allows the editor to automatically supply
leading white space to align text. You can then use the AD
key as a backtab and space and tab forward to align new code
easily.

Miscellaneous new useful features include an intelligent
join (j) command which supplies white space between joined
lines automatically, commands < and> which shift groups of
lines, and the ability to filter portions of the buffer
through commands such as ~.
FILES

/usr/lib/ex2.Bstrings
/usr/lib/ex2.Brecover
/usr/lib/ex2.Bpreserve
/etc/termcap
N/. exrc
/tmp/Exnnnnn
/tmp/Rxnnnnn
/usr/preserve

error messages
recover command
preserve command
describes capabilities of terminals
editor startup file
editor temporary
named buffer temporary
preservation directory

SEE ALSO

awk(l), edell, grep(l), sed(l}, edit(l), grepCl),
termcap(l), viCl)
AUTHOR
William JOy
BUGS

The..\1D.S:lQ command causes all marks to be lost on lines
changed and then restored if the marked lines were changed.
llndQ never clears the buffer modified condition.

The £ command prints a number of logical rather than physical lines. More than a screen full of output may result if
long lines are present.
File input/output errors don't print a name if the command
line '_I option is used.

3-47

EX(l)

EX (1)

XENIX Programmer's Manual

There is no easy way to do a single scan ignoring case.
Because of the implementation of the arguments to
512 bytes of argument list are allowed there.

~,

only

The format of /~termcap and the large number of capabilities of terminals used by the editor cause terminal type
setup to be rather slow.
The editor does not warn if text is placed in named buffers
and not used before exiting the editor.
Null characters are discarded in input files, and cannot
appear in resultant files.

3-48

PmPY(l)

PCOn(l)

NAME

fcopy - copy a floppy diskette

SYNOPSIS
fcopy
DESCRIPTION
Fcopy is used to make duplicate copies of either a single
(ACS 8600 only) or double density floppy diskette. FCoPY is
menu dr iven and will ask whether you wish to copy a single
or double density disk or quit. After one copy has been
made, it will ask if you desire to make more copies of the
same diskette •. All disks must have been previously
formatted. See Format to prepare diskettes (Format) before
making copies. Also check to verify there is enough disk
space available by entering the ~ command.
586 OUTPUT
1440
1440

records in
records out

ACS 8690 OUTPUT
for double density disks:
13+0
records in
13+0
records out
900+0
records in
909+9
records out
for single density disks:
500+0
records in
500+0
records out
BUGS

FILES

Since the routine was written for a single floppy disk
system, it reads the entire disk off and then back on,
requiring 1440 blocks of space on the hard disk (for the 586
system) and either 913 or 500 blocks of space on the hard
disk (for the ACS 8600 system).
./junk.?????? Temporary working file, created and subsequently removed by fcopy.

3-49

POBIIH{l)

NAME

POBIIH{l)

format - format a floppy disk while running XENIX

SYNOPSIS
format
DESCRIPTION
Format is a menu-driven program for formatting floppy disks.
For the Altos 586 computer systems, diskettes are formatted
in Altos 5-1/4 inch, double-density, double-sided format.
For the ACS 8600 computer systems, diskettes can be
formatted in either 8-inch standard IBM single-density
format, Altos standard double-density format for XENIX and
for diagnostics, or finally double-sided double-density
format, if that drive is available.
To use the format utility, enter:
format

(CR>

You are then prompted by the menu to select the desired
format and to insert a diskette.
All double-density diskettes are a combina tion of two
formats for the ACS 8600.
See Appendix B in the
Introduction to XBBIX Kanual. The first two cylinders are
single-density, and the rest of the floppy diskette is in
double-density.

3-58

PCOPY(l)

FCOPY {I}

NAME

fcopy - copy a floppy diskette
SYNOPSIS

fcopy
DESCRIPTION

Fcopy is used to make duplicate copies of a floppy diskette.
Fcopy is menu driven and will ask whether you wish to copy a
diskette or quit. After one copy has been made, it will ask
if you desire to make more copies of the same diskette. All
diskettes must have been previously formatted. See ~~
mat(l) to prepare diskettes (format) before making copies.
Also check to verify there is enough disk space available by
entering the df command.
586 OUTPUT
I 44fl+fl
144fl+0

records in
records out

BUGS
Since the routine was written for a single floppy disk
system, it copies the entire diskette to the hard disk and
then copies it from the hard disk to the new diskette requiring 144fl blocks of space on the hard disk (for the 586
system) .
FILES

./junk.?????? Temporary working file, created and subsequently removed by fcopy.

3-4.9

FINGER(l)

FINGER(l)

NAME
finger - user information lookup program
SYNOPSIS
finger [ options ] name

.. .

DESCRIPTION
By default finger lists the login name, full name, terminal
name and write status (as a '*' before the terminal name if
write permission is denied), idle time, login time, and
office-location and phone number (if they are known) for
each current UNIX user. (Idle time is minutes if it is a
single integer, hours and minutes if a ':' is present, or
days and hours if a 'd' is present.)
A longer format also exists and is used by finger whenever a
list of people's names is given. (Account names as well as
first and last names of users are accepted.) This format is
multi-line, and includes all the information described above
as well as the user's home directory and login shell, any
plan which the person has placed- in the file .plan in their
home directory, and the project on which they are working
from the file .project also in the home directory. .
.
Finger options include:
-m

Match arguments only on user name.

-1

Force long output format.

-p

Suppress printing of the

-s

Force short output format.

.~

files

FILES
/etc/utmp
/etc/passwd
/usr/adm/lastlog
-/ • plan
-/ .project

who file
for users names, offices, •••
last login times
plans projects

SEE ALSO
who (1)
BUGS
Only the first line of the .project file is printed.
The encoding of the gcos field is UCB dependent - it knows
that an office '197MC' is '197M Cory Hall', and that '529BE'
is '529B Evans Hall'.

FLEECE(l)

FLEECE (1)

NAME
fleece - look for files in home directories
SYNOPSIS
fleece name
DESCRIPTION
Flee~ looks for the named file in every home directory on
the system and makes a list on standard output of those
which exist.

FILES
/etc/passwd

to find home directories

3-49B

FOLD(l)

FOLD{l)

NAME

fold - fold long lines for finite width output device
SYNOPSIS

fold [ -width ] [ file ••.
DESCRIPTION

.

is a filter which will fold the contents of the
specified files, or the standard input if no files are
specified, breaking the lines to have maximum width width.
The default for width is 80. Width should be a multiple of
8 if tabs are present, or the tabs should be expanded using
expand(l) before coming to fQld.

~~~a

BUGS

If underlining is present it may be messed up by folding.

FOR.'!AT (1)

FOR.:"!AT ( 1)

NAME
format - format a floppy diskette while running XENIX
SYNOPSIS

format
DESCRIPTION

fQLmAt is a menu-driven program for formatting floppy
diskettes.
For the Altos 586 computer systems, diskettes are formatted
in Altos 5-1/4 inch, double-density, double-sided format.
To use the format utility, enter:
format



You are then prompted by the menu to format (and to insert a
diskette) or to quit.

3-5~

FROM(l)

FROM(l}

NAME

from - who is my mail from?
SYNOPSIS
from
DESCRIPTION
.£..r...Q.m pr in tsout the mail header lines in your mailbox file
to show you who your mail is from
FILES

/usr/spool/mail/*
SEE ALSO
mail (1), Mail (1), aemai1 (1)

PSCX(1)

PSCIC(1)

NAME

fsck - file system consistency check and interactive repair

SYNOPSIS
fsck [option] ••• [filesystemJ • • •
DESCRIPTION
Fsck audits and interactively repairs inconsistent conditions for the named file systems.
If a file system is
consistent, then the number of files, number of blocks used,
and number of blocks free are reported. If the file system
is inconsistent, the operator is prompted for concurrence
before each correction is attempted. Most corrections lose
data: all losses are reported. The default action for each
correction is to wait for the operator to respond 'yes' or
"no". Without write permission ~ defaults to -n action.
These options are recognized:
-y

Assume a yes response to all questions

-n

Assume a no response to all questions

-sX

Ignore the actual free list and (unconditionally)
construct a new one by rewriting the super-block of the
file system. The file system should be unmounted while
this is done, or extreme care should be taken that the
system is quiescent and that it is rebooted immediately
afterwards. This precaution is necessary so that the
old, bad, in-core copy of the superblock will not
continue to be used, or written on the file system.
The free list is created with optimal interleaving
according to the specification X:
space free blocks ~ blocks apart in
cylinders of & blocks each.

-S&:~

If X is not given, the values used when the filesystem
was created are used.
If these values were not
specified, then & = 4fiHJ, ~ = 9 is assumed.
-SA

Condi tionally reconstruct the free list. This option
is like -sx except that the free list is rebuilt only
if there were no discrepancies discovered in the file
system.
It is useful for forcing free list
reorganization on uncontaminated file systems.
-S
forces -n.

3-51

PSCK(l)

PSCK(l)

-t

If ~ cannot obtain enough memory to keep its tables,
it uses a scratch file. If the -t is specified, the
file named in the next argument is used as the scratch
file. Without the -t option, ~ prompts if it needs
a scratch file. The file should not be on the file
system being checked, and if it is not a special file
or did not already exist, it is removed when fsck
completes.

If no file systems are given to ~, then a default list of
file systems is read from the file jetc/checklist.
Inconsistencies checked are as follows:
1.

Blocks claimed by more than one i-node or the free
list.

2.

Blocks claimed by an i-node or the free list outside
the range of the file system.

3.

Incorrect link counts.

4.

Size checks:
Incorrect number of blocks in file.
Directory size not a multiple of 16 bytes.

5.

Bad i-node format.

6.

Blocks not accounted for anywhere.

7.

Directory checks:
File pointing to unallocated i-node.
I-node number out of range.

8.

Super Block checks:
More than 65536 i-nodes.
More blocks for i-nodes than there are in the file
system.

9.
10.

Bad free block list format.
Total free block andjor free i-node

c~unt

incorrect.

Orphaned files and directories (allocated but unreferenced)
are, with the operator's concurrence, reconnected by placing
them in the "lost+found" directory. The name assigned is
the i-node number. The only restriction is that the
directory "lost+found" must preexist in the root of the
filesystem being checked and must have empty slots in which
entr ies can be made.
This is accomplished by making
"lost+found", copying a number of files to the directory,
and then removing them (before ~ is executed).
3-52

PSCK(l)

PSCK(l)

Checking the raw device is almost always faster.
FILES
/etc/checklist contains default list of file systems to
check.
SEE ALSO
dcheck(l), icheck(l), checklist(S), fs(S), crash(8)
BUGS
I-node numbers for • and •• in each directory should be
checked for validity.
The -b option of icheckll) should be available.

3-53

PU(l)

NAME

Pft(l)

ftp - transfer files between machines

SYNOPSIS
ftp [ -f device ] [ -s speed ] [ name ]
DESCRIPTION
~ allows file transfer between two Altos Computer Systems
via an asynchronous serial channel. On the sending side,
lUlm~ is a file or list of files to be sent.
If lUl~ is If_A,
standard input is sent. On the receiving side, lUl~ is an
existing directory into which the files are received. If
name is omitted, files are received into the current directory. If nam~ is " __ ", received files are written to standard output.
The following options are interpreted by

~:

-.f

The special file device is used to transfer files
between the machines. The ports associated with the
devices on each machine should be connected via a null
modem cable. The default device is /dev/tty6, which
uses port 6.

-a

The transmission rate is set to speed. Currently supported speeds are 1299, 24gB, 4899, and 96BB bits per
second. The default transmission rate is 9699 baud.

is compatible with the ~ program available for Altos
CP/M and MP/M systems, so files can be transferred betwen
CP/M-MP/M systems and Xenix systems. See the CP/M-MP/M
documentation for details of the CP/M-MP/M ~.

~

must be run on both the sending and receiving computer.
The port that .ftR is running on must have login disabled
(see disableCl». Either side may be started first, but
both sides must be started within about 1 minute of each
other. The sending side will output's' every £ew seconds
until communication is established with the other side;
likewise,' the receiving side will output 'w' every few
seconds. During file transfer, .f...tJ2 will output a '.' every
time a 128 byte block is successfully transmitted, and a '1'
every time a block is retransmitted to overcome a transmission error.

~

BUGS

Since MP/M and CP/M pad files with control-Z's (octal 32),
control-Z's are deleted from the end of files sent to Xenix
systems.
Files sent to MR/M and CP/M systems must have filenames
which are legal on those systems. Files sent from MP/M and
CP/M sys~ems to Xenix systems may end up with filenames

P'fP(1)

r.rP(1)

containing and sometimes ending with spaces; the Xenix
shells can deal wi th these filenames if the enti re name is
enclosed in double quotes.
If the cable gets disconnected during transmission, you must
wait for.f..t.ll to die (which might take up to a minute) before
you can restart on the same port, otherwise the first ~
will interfere with the second.

3-55

LAYom(l)

NAME

LAY~(l)

layout - configure a hard disk

SYNOPSIS
layout layout-device 586
DESCRIPTION

creates a table defining a number of "logical
devices" associated with each physical disk in the XENIX
system. Layout records this table on cylinder zer-o of each
disk. Each entry in the table is in the following format:

Lg~~~~

struct layout {
daddr_t l_blkoff; /*Block offset to area */
daddr_t l_nblocks; /*Number of blocks in area */
};
Layout defines ten "logical devices" on the hard disk:
9

The whole disk, with the alternate sector
mechanism disabled.

1

The swap area.

2

The root file system.

3-8

Unused.

9

Alternate sector area into which bad disk sectors
are automatically mapped by the XENIX kernel.

The logical device numbers above correspond to device
numbers in the hard disk driver.
Other device numbers are pre-defined in the XENIX kernel as
follows:
19

Future expansion.

11

All of track9.

12

Boot program area.

13

Portion of cylinder zero used for
file.

14

Layout information created by this utility.

15

Alternate sector map (see map(l».

~

temporary

The options to layout are used to create some very common
layouts.

3-56

FTP(l}

?'TP{l}

containing and sometimes ending with spaces; the Xenix
shells can deal with these filenames if the entire name is
enclosed in double quotes.
If the cable gets disconnected during transmission, you must
wait for ~ to die (which might take up to a minute) before
you can restart on the same port, otherwise the first ~
will interfere with the second.

3-55

BEAD{l}

BEAD (1)

NAME
head - give first few lines
SYNOPSIS
head [ -count]

[ file .••

DESCRIPTION
This filter gives the first coun~ lines of each of the
specified files, or of the standard input.
If count is
omitted it defaults to 10.
SEE ALSO
tail(l)

IllL(l)

IUL(I}

NAME
iul - do underlining
SYNOPSIS

iul [ -i ] [ -t terminal J [ n..a.m.e ••• ]
DESCRIPTION

reads the named files (or standard input if none are
given) and translates occurrences of underscores to the
sequence which indicates underlining for the terminal in
uses, as specified by the environment variable TERM. The-t
option overrides the terminal kind specified in the environment. The file /~termcap is read to determine the appropriate sequences for underlining. If the terminal is incapable of underlining, but it capable of a standout mode
then that is used instead. If the terminal can overstrike,
or handles underlining automatically, ~ degenerates to
~(l).
If the terminal cannot underline, underlining is
ignored.
~

The -i option causes ~ to indicate underlining onto 5
separate line containing appropriate dashes I-'i this is
useful when you want to look at the underlining which is
present in an nrQff output stream on a crt-terminal.
SEE ALSO

man(l), nroff(l)
BUGS

Nroff usually outputs a series of backspaces and underlines
intermixed with the text to indicate underlining.
No
attempt is made to optimize the backward motion.

3-55B

L..~T(l)

LAST(l)

NAME
last - indicate last logins of users and teletypes
SYNOPSIS
last [ -N ] [ name ••• ] [ tty •••

]

DESCRIPTION
Last will look back in the li~m~ file which records all
logins and logouts for information about a user, a teletype
or any group of users and teletypes.
Arguments specify
names of users or teletypes of interest. Names of teletypes
may be given fully or abbreviated. For example 'last 0' is
the same as 'last tty0'. If multiple arguments are given,
the information which applies to any of the arguments is
printed. For example 'last root console' would list all of
"root's" sessions as well as all sessions on the console
terminal. L~ will print the sessions of the specified
users and teletypes, most recent first, indicating the times
at which the session began, the duration of the session, and
the teletype which the session took place on. If the session is still continuing or was cut short by a reboot, ~
so indicates.
The pseudo-user reboot logs in at reboots of the system;
thus
last reboot
will give an indication of mean time between reboot.
Last with no arguments prints a record of all logins and
logouts, in reverse order. The -N option limits the report
to N lines.
If ~ is interrupted, it indicates how far the search has
progressed in ~~m~.
If interrupted with a quit signal
(generated by a control-l) ~ indicates how far the search
has progressed so far, and the search continues.
FILES
/ u s r / a dm/ wtmp
/usr/adm/shutdownlog
SEE ALSO
wtmp(S), ac(8),

login data base
which records shutdowns and reasons
for same

LAYOO'r(1)

LAYOO'.r (1)

USAGE
layout /dev/hd0.1ayout 586
SEE ALSO
map (I) , sizefs(l}

3-57

LS(!)

LS(!)

NAME

Is - List contents of directory

SYNOPSIS
Is [-ltasdrucifgmnICqbxFRA] [Filenames]
DESCRIPTION
For each directory argument, ~ lists the contents of the
directory; for each file argument, ~ repeats its name and
The output is sorted
any other information requested.
alphabetically by defalt. When no argument is given, the
current directory is listed. When several arguments are
given, the arguments are first sorted appropriately, but
file arguments appear before director ies and their contents.
There are three major listing formats. The format chosen
depends on whether the output is going to a teletype, and
may also be controlled by option flags. The default format
for a teletype is to list the contents of directories in
multi-column format, with the entries sorted down the
columns. (Files which are not the contents of a directory
being interpreted are always sorted across the
page
rather than down the page in columns.
This is because
the individual file names may be arbitrarily long.) If the
standard output is not a teletype, the default format is to
list one entry per line. Finally, there is a stream
output format in which files are listed across the page,
separated by"." characters.
The -m flag enables this
;ormat; when invoked as ~ this format is also used.
The following options are available:
-1

List in long format, giving mode, number of links,
owner, size in bytes, and time of last modification for
each file.
(See below.)
If the file is a special
file, the size field contain instead the major and
minor device numbers.

-t

Sort by time modified (latest first) instead of by
name; as is normal.

-a

List all entr ies;
pressed.

-s

Give size in blocks, including indirect blocks, for
each entry and total blocks.

-d

If argument isa directory, list only its name, not its
contents (mostly used with -1 to get status on
directory) •

-r

Reverse the order of sort to get reverse alphabetic or
oldest first as appropriate.

usually '.' and ' •• ' are not sup-

3-58

LEAVE (I)

LEAVE (1)

NAME

leave - remind you when you have to leave
SYNOPSIS

leave

hhmm ]

DESCRIPTION

Leaye waits until the specified time, then reminds you that
you have to leave. You are reminded 5 minutes and 1 minute
before the actual time, at the time, and every minute
thereafter. When you log off, leave exits just before it
would have printed the next message.
The time of day is in the form hhmm where hh is a time in
hours (on a 12 or 24 hour clock). All times are converted
to a 12 hour clock, and assumed to be in the next 12 hours.
If no argument is given, leave prompts with "When do you
have to leave?". A reply of newline causes .l.e.a...v.a to exit,
othe rw is e the repl y is as sumed to be a time. Th is form is
suitable for inclusion in a .login or .profile.
Leave ignores interrupts, quits, and terminates. To get rid of
it you should either log off or use "kill -9" giving its process
id.
SEE ALSO

calendar(l)

3-571\

LS(l)

LS(l)

NAME
Is - List contents of directory
SYNOPSIS
Is [-ltasdrucifgmnlCqbxFRA] [Filenames]
DESCRIPTION
For each directory argument, ~ lists the contents of the
directory; for each file argument, .l.a repeats its name and
any other information requested.
The output is sorted
alphabetically by default. When no argument is given, the
current directory is listed. When several arguments are
given, the arguments are first sorted appropriately, but
file arguments appear before directories and their contents.
There are three major listing formats. The format chosen
depends on whether the output is going to a teletype, and
may also be controlled by option flags.
The default format
for a teletype is to list the contents of directories in
multi-column format, with the entries sorted down the
columns. (Files which are not the contents of a directory
being interpreted are always sorted across the
page
rather than down the page in columns.
This is because
the individual file names may be arbitrarily long.) If the
standard output is not a teletype, the default format is to
list one entry per line.
Finally, there is a stream
output format in which files are listed across the page,
separated by ".n characters.
The -m flag enables this
formatj when invoked as ~ this format is also used.
The following options are available:
-1

List in long format, giving mode, number of links,
owner, size in bytes, and time of last modification for
each file.
(See below.)
If the file is a special
file, the size field contain instead the major and
minor device numbers.

-t

Sort by time modified (latest first)
name, as is normal.

-a

Lis t all en t r i e s ;
. pressed.

us uall y

I. '

instead of by

and ' •• I are no t

s u p-

-s

Give size in blocks, including indirect blocks, for
each entry and total blocks.

-d

If argument is a directory, list only its name, not its
contents .(mostly used with -1 to get status on
directory) •

-r

Reverse the order of sort to get reverse alphabetic or
oldest first as appropriate.

LS(l)

LS(l)

-u

Use time of last access instead of last modification
for sorting (-t) or printing (-1).

-c

Use time of file creation for sorting or printing.

-i

Print i-number in first column of the report for each
file listed.

-f

Force each argument to be interpreted as a directory
and list the name found in each slot.
This option
turns off -1, -t, -s, and -r, and turns on -a; the
order is the order in which entries appear in the
directory.

-g

Give group ID instead of owner ID in long listing.

-m

Force stream output format.

-n

List in long format (similary to 1 option), except that
it lists user number rather than file owner.

-1

Force one entry per line output format,
teletype.

-C

Force multi-column output, e.g., to a file or a pipe.

-q

Force printing of non-graphic characters in file names
as the character '1'; this normally happens only if the
output device is a teletype.

-b

Force printing of non-graphic characters to be in the
'ddd notation in octal.

-x

Force columnar printing to be sorted across rather than
down the page; this is the default if the last
character of the name the program is invoked with is an

e.g.,

to a

,x ' •

-F

Cause directories to be marked with a trailing II' and
executable files to be marked with a trailing '*'; this
is the default if the last character of the name the
program is invoked with is a 'fl.

-R

Recursively list subdirectories encountered.

-A

List all entries; usually'.' and ' •• ' are suppressed.

The mode printed under the -1 option contains 11 characters
which are interpreted as follows:
the first character is
d
b
c

if the entry is a directory;
if the entry is a block-type special file;
if the entry is a character-type special file;

3-59

LS(l)

LS(l)
m

if the entry is a multiplexor-type character special
file:
if the entry is a plain file.

The next nine characters are interpreted as three sets of
three bits each. The first set refers to owner permissions:
the next to permissions to others in the same user-group:
and the last to all others.
Within each set the three
characters indicate permission respectively to read, to
write, or to execute the file as a program.
For a
directory, "execute" permission is interpreted to mean
permission to search the directory for a specified file.
The permissions are indicated as follows:
r
w
x

if
if
if
if

the
the
the
the

file is readable;
file is writable;
file is executable:
indicated permission is not granted.

The group-execute permission character is given as ~ if the
file has set-group-ID mode; likewise, the user-execute
permission character is given as ~ if the file has set-userID mode.
The last character of the mode (normally 'x' or '-') is "t"
if the 1000 bit of the mode is on. See .c..hm.Q.d(l) for the
meaning of this mode and instructions on changing the file
mode.
When the sizes of the files in a directory are listed, a
total count of blocks, including indirect blocks is printed.
FILES

/etc/passwd to get user ID's for 'Is -1'
/etc/group to get group ID's for 'ls -g'

BUGS

Newline and tab are considered printing characters in file
names.
The output device is assumed to be 80 columns wide.
The option setting based on whether the output is a teletype
is undesirable as "ls -s" is much different than "Is s/lpr". On the other hand, not using this setting would make
old shell scripts which used .la. ineffective.

3-68

IAIL (1)

mail

XENIX Programmer's Manual

MAIL (1)

send and receive mail

SYNOPSIS
mail [ -f [ name 1. 1 [ people •••

]

IN'!'RODUCT ION
Bail is a intelligent mail processing system, which has a
command syntax reminiscent of ~ with lines replaced by messages.
Sending mail. To send a message to one or more other people, mail can be invoked with arguments which are the names
of people to send to. You are then expected to type in your
message, followed by an EOT (control-D) at the beginning of
a line. The section below, labeled Replying ~ ~ originating mail, describes some features of mail available to help
you compose your letter.
Reading mail. In normal usage, mail is given no arguments
and checks your mail out of the post office, then printing
out a one line header of each message there. The current
message is initially the first message (numbered 1) and can
be printed using the print command (which can be abbreviated
pl. You can move among the messages much as you move
between lines in ~, with the commands '+' and '-' moving
backwards and forwards, and simple numbers typing the
addressed message.
Disposing .Qf. u.i.l. After examining a message you can delete
Cd) the message or reply (r) to it. Deletion causes the
mail program to forget about the message. This is not
irreversible, the message can be undeleted (u) by giving its
number, or the mail session can be aborted by giving the
exit (x) command. Deleted messages will, however, usually
disappear never to be seen again.
Specifying meseages. Commands such as print and delete
often can be given a list of message numbers as argument to
apply to a number of messages at once. Thus "delete 1 2"
deletes messages 1 and 2, while "delete 1-5" deletes messages 1 through 5. The special name ,'*', addresses all
messages, and "$" addresses the last message1 thus the
command top which ~rints the first few lines of a message
could be used in ' top *1' to print the first few lines of
all messages.
Replying tQ ~ originating mail. You can use the reply command to set up a response to a message, sending it back to
the person who it was from. Text you then ty~e in, up to an
end-of-file (or a line consisting only of a ' .1') defines
the contents of the message. While you are composing a
3-61

MAIL (I)

XENIX Programmer's Manual

MAIL (I)

message, .mail treats lines beginning wi ththe character'-'
specially. For instance, typing "-m" (alone on a line)
will place a copy of the current message into the response
right shifting it by a tabstop. Other escapes will set up
subject fields, add and delete recipients to the message and
allow you to escape to an editor to revise the message or to
a shell to run some commands. (These options will be given
in the summary below.)
Ending ~ mail srocessing session. You can end a mail session with the quit (q) command. Messages which have been
examined go to your mbQx file unless they have been deleted
in which case they are discarded. Unexamined messages go
back to the post office. The -f option causes mail to read
in the contents of your mbQx (or the specified file) for
processing; when you quit mail writes undeleted messages
back to this file.
Personal and systemwide distribution lists. It is also possible to create a personal distribution lists so that, for
instance, you can send mail to "cohorts" and have it go to
a group of people. Such lists can be defined by placing a
line like
alias cohorts bill ozalp sklower jkf mark cory:kridle
in the file .mailrc in your home directory. The current
list of such aliases can be displayed by the alias (a) command in mail. System wide distribution lists can be created
by editing /usr/lib/aliases, see aliases(S} and deliyermail(8); these are kept in a slightly different syntax. In
mail you send, personal aliases will be expanded in mail
sent to others so that they will be able to reply to the
recipients. System wide aliases are not expanded when the
mail is sent, but any reply returned to the machine will
have the system wide alias expanded as all mail goes through
deliyermail. If you edit /usr/lib/aliases, you must run the
program newalia§es(l).
Network .mail (AReA, ~, Berknet) Mail to sites on the
ARPA network and sites within Bell laboratories can be sent
using "name@si te' 'for ARPA-net sites or "machine luser' ,
for Bell labs sites, provided appropriate gateways are known
to the system. (Be sure to escape the ! in Bell si tes when
giving it on a ~ command line by preceding it with an \.
Machines on an instance of the Berkeley network are
addressed as "machine:user", e.g. "csvax:bill". When
addressed from the arpa-net, "csvax:bill " is known as
"csvax.bill@berkeley".

Mail has a number of options which can be set in the .mailrc
file to alter its behavior; thus "set askcc" enables the
3-62

mIL (1)

... aSkcc"

XENIX Programmer's Manual

feature.

MAIL (1)

(These options are summarized below.)

SUMMARY

(Adapted from the "Mail Reference Manual') Each command is
typed on a line by itself, and may take arguments following
the command word. The command need not be typed in its
entirety - the first command which matches the typed prefix
is used. For the commands which take message lists as arguments, if no message list is given, then the next message
forward which satisfies the command's requirements is used.
If there are no messages forward of the current message, the
search proceeds backwards, and if there are no good messages
at all, mail types '''No applicable messages" and aborts the
command.
Goes to the previous message and prints it out.
If given a numeric argument n , goes to the n ~
previous message and prints it.
?

Prints a brief summary of commands.

!

Executes the UNIX shell command which follows.

alias

(a) With no arguments, prints out all
currently-defined aliases. With one argument,
prints out that alias. With more than one argument, adds the users named in the second and
later arguments to the alias named in the first
argument.

chdir

(c) Changes the user's working directory to that
specified, if given. If no directory is given,
then changes to the user's login directory.

delete

(d) Takes a list of messages as argument and
marks them all as deleted. Deleted messages
will not be saved in mb2x , nor will they be
av.ailable for most other commands.

dp

(also dt) Deletes the current message and prints
the next message. If there is no next message,
mail says .... at EOF."

edit

(e) Takes a list of messages and pOints the text
editor at each one in turn. On return from the
editor, the message is read back in.

exit

(ex or x) Effects an immediate return to the
Shell without modifying the user's system mailbox, his mb2x file, or his edit file in -f •

from

(f) Takes a list of messages and prints their
3-63

MAIL (1)

XENIX Programmer's Manual

MAIL (1)

message headers.
headers

(h) Lists the current range of headers, which is
an 18 message group. If a "+" argument is
given, then the next 18 message group is
printed, and if a "-" argument is given, the
previous 18 message group is printed.

help

A synonym for ?

hold

(ho, also preserve) Takes a message list and
marks each message therein to be saved in the
user's system mailbox instead of in mbQA. Does
not override the delete command.

mail

(m) Takes as argument login names and distribution group names and sends mail to those people.

next

(n like + or CR) Goes to the next message in
sequence and types it. with an argument list,
types the next matching message.

preserve

A synonym for hold.

print

(p) Takes a message list and types out each message on the user's terminal.

quit

(q) Termina tes the session, saving all
undeleted, unsaved messages in the user's mbQx
file in his login directory, preserving all messages marked with hold or preserve or never
referenced in his system mailbox, and removing
all other messages from his system mailbox. If
new mail has arrived during the session, the
message "You have new mail" is given. If
given while editing a mailbox file with the -f
flag, then the edit file is rewritten. A return
to the Shell is effected, unless the rewrite of
edit file fails, in which case the user can
escape with the exit command.

reply

(r) Takes a message list and sends mail to each
message author just like the mail command. The
default message must not be deleted.

respond

A synonym for reply •

save

(s) Takes a message list and a filename and
appends each message in turn to the end of the
file. The filename in quotes, followed by the
line count and character count is echoed on the
user's terminal.
3-64

AIL (1)

XENIX Programmer's Manual

MAIL (I)

set

(se) With no arguments, prints all variable
values. Otherwise, sets option. Arguments are
of the form "option=value" or '''option.''

shell

(sh) Invokes an interactive version of the
shell.

size

Takes a message list and prints out the size in
characters of each message.

top

Takes a message list and prints the top few
lines of each. The number of lines printed is
controlled by the variable toplines and defaults
to five.

type

(t) A synonym for print •

unalias

Takes a list of names defined by alias commands
and discards the remembered groups of users.
The group names no longer have any significance.

undelete

(u) Takes a message list and marks each one as

nQt being deleted.

unset

Takes a list of option names and discards their
remembered values; the inverse of set •

visual

(v) Takes a message list and invokes the display
editor on each message.

write

(w) A synonym for save •

xit

(x) A synonym for exit.

Here is a summary of the tilde escapes, which are used when
composing messages to perform special functions. Tilde
escapes are only recognized at the beginning of lines. The
name "t11de escape" is somewhat of a misnomer since the
actual escape character can be set by the option escape.
-1 command

Execute the indicated shell command, then return
to the message.

-c name ••• Add the given names to the list of carbon copy
recipients.
Read the file "dead.letter"
directory into the message.

from your home

Invoke the text editor on the message collected
so far. After the editing session is finished,
you may continue appending text to the message.
3-65

MAIL (1)

XENIX Programmer's Manual

MAIL (1)

Edit the message header fields by typing each
one in turn and allowing the user to append text
to the end or modify the field by using the
current terminal erase and kill characters.
-m messages Read the named messages into the message being
sent, shifted right one tab. If no messages are
specified, read the current message.
Print. out the message collected so far, prefaced
by the message header fields.
Abort the message being sent, copying the message to "dead.letter" in your home directory
if save is set.
-r filename Read the named file into the message.
Cause the named string to become the current
subject field.
-t name ••• Add the given names to the direct recipient
list.
Invoke an alternate editor (defined by the
VISUAL option) on the message collected so far.
Usually, the alternate editor will be a screen
editor. After you quit the editor, you may
resume appending text to the end of your message.
-w filename write the message onto the named file.
-Icommand

Pipe the message through the command as a
filter. If the command gives no output or terminates abnormally, retain the original text of
the message. The command fmt(l) is often used
as .command to rejustify the message.
Insert the string of text in the message prefaced by a single -. If you have changed the
escape character, then you should double that
character in order to send it.

Options are controlled via the set and unset commands.
Options may be either binary, in which case it is only significant to see whether they are set or not, or string, in
which case the actual value is of interest. The binary
opt~ons include the following:
append

Causes messages saved in mQQx to be appended
to the end rather than prepended. (This is
3-66

AIL (I)

XENIX Programmer's Manual

MAIL (I)

set in /usr/lib/Mail.rc on version 7 systems.)
ask

Causes mail to prompt you for the subject of
each message you send. If you respond with
simply a newline, no subject field will be
sent.

askcc

Causes you to be prompted for additional carbon copy recipients at the end of each message. Responding with a newline indicates
your satisfaction with the current list.

autoprint

Causes the delete command to behave like dp thus, after deleting a message, the next one
will be typed automatically.

ignore

Causes interrupt signals from your terminal
to be ignored and echoed as @'s.

metoo

Usually, when a group is expanded that contains the sender, the sender is removed from
the expansion. Setting this option causes
the sender to be included in the group.

quiet

Suppresses the printing of the version when
first invoked.

save

Causes the message collected prior to a
interrupt to be saved on the file
"dead.letter" in your home directory on
receipt of two interrupts (or after a -q.)

The following options have string values:
EDITOR

Pathname of the text editor to use in the
edit command and -e escape. If not defined,
then a default editor is used.

SHELL

Pathname of the shell to use in the ! command
and the -1 escape. A default shell is used
if this option is not defined.

VISUAL

Pathname of the text editor to use in the
visual command and -v escape.

escape

If defined, the first character of this
option gives the character to use in the
place of - to denote escapes.

record

If defined, gives the pathname of the file
used to record all outgoing mail. If not
3-67

MAIL (1)

XENIX Programmer's Manual

MAIL (1)

defined, then outgoing mail is not so saved.
toplines

FILES

If defined, gives the number of lines of a
message to be printed out with the top command; normally, the first five lines are
printed.

/usr/spool/mail/*
-/mbox
-/.mailrc
/tmp/R#
/usr/lib/Mail.help*
/usr/lib/Mail.rc
/bin/mail
/etc/delivermail

post office
your old mail
file giving initial mail commands
temporary for editor escape
help files
system initialization file
to do actual mailing
postman

SEE ALSO

binmail(l), fmt(l), newaliases(l), aliases(S), delivermail (8)
'The Mail Reference Manual'
AUTHOR

Kurt Shoens
BUGS

3-68

MAKE.HD(l)

MAKE.BD(l)

NAME
make.hd - initialize a hard disk
SYNOPSIS
make.hd [ swapblocks [inodes] ]
DESCRIPTION
The make.hd command initializes the hard disk for use with
Xenix. The operator is prompted for the size of the hard
disk (l~, 2~, 3~, or 4~ megabytes), and then make.hd creates
the layout table, builds the bad sector map, makes the
special files, and then asks the operator to re-boot the
system. The load.bd command can then be used to copy the
rest of the utilities to the hard disk.
The swapblocks option specifies the number of blocks in the
swap area; if not specified, the default value of swapblocks
depends on the size of the hard disk as shown below.
Likewise, the inodes option specifies the number of i-nodes
and if it is not specified, the default value of ioodes
depends on the size of the hard disk as shown below:
hard disk size
l~ megabytes
2~ megabytes
3~ megabytes
4~ megabytes
SEE ALSO
1 a you t ( 1)
EXAMPLE
make.hd

1

default
swap blocks
332~
332~
5l2~
5l2~

rna P ( I), s i z e f s ( I )

3~~~

default
i-nodes

5~00

3-68A

6~~~
6~~~

.

l~~~~

l~~~~

MAKEWBA~IS(l)

NAME
makewhatis - descr ibe what a command is

SYNOPSIS
makewhatis command

...

DESCRIPTION
Makewhatis makes a data base that whatis uses. Makewhatis looks
up a given command and gives the header line from the manual
section. You can then run the man(1) command to get more information.
If the line starts 'name(section ••• ' you can do 'man
section name' to get the documentation for it. Try 'whatis ed'
and then you should do 'man 1 ed' to get the manual.
Whatis is actually just the -f option to the

FILES
/usr/lib/whatis

SEE ALSO
man (1)

Data base

man(1)

command.

RAP (1)

M&P(1)

NAME

map - create an alternate sector map for a hard disk drive

SYNOPSIS
map layout mapfile drive
DESCRIPTION
Map creates a bad sector map, on mapfile, using the layout
information, in layout, created by layout(l).
The last
argument is the logical device name which references the
whole drive.
The standard invocation is:
map /dev/hdS.layout

/dev/hdS.secmap

/dev/hdS

The structure used for the bad sector to alternate sector
mapping is as follows:
struct mapsec {
int
bad_cyl;
char bad_hed;
char bad_sec;
int
ba~good;

};

/* Cylinder number of bad sector */
/* Head number of bad sector */
/* Sector number of bad sector */
/* Offset into alternate sector
area */

This structure provides a way for the XENIX hard disk driver
to recover from bad sectors it encounters when reading the
hard disk. If a bad sector is read, a search of a table of
the above structures is made.
If an exact match of
cylinder, head and sector is found, the corresponding offset
is used as an index into the area reserved on the disk for
alternate sectors.
SEE ALSO
layout(l), sizefs(l)

3-69

MUL~IUSER(l)

JIOL~IUSBR(l)

NAME

multiuser - bring the system up multiuser
SYNOPSIS
multiuser
DESCRIPTION
Multiuser prompts the user to set the current system date
and time, and then brings the system up multiuser.
First, multiuser displays the current system date and time
and asks the user to confirm or change the date and then the
time. Confirmation is done by entering Return. The format
for entering the date i~ "yymmdd." Time is entered as a 24hour clock in the form "hhmm."
SEE

ALSO
date(l)

3-7.

KULTIUSER(l}

NAME

multiuser - bring the system up multiuser
SYNOPSIS

multiuser
DESCRIPTION

Multiuser prompts the user to set the current system date
and time, and then brings the system up in multiuser mode.
Fi rst, multiuser displays the cur rent system da te and time
and asks the user to confirm or change the date and then the
time. Confirmation is done by entering Return. The format
for entering the date is "yymmdd." Time is entered as a 24hour clock in the form "hhmm."
SEE ALSO

da te (1)

3-79

PAGE(l)

PAGE{l)

NAME
page - file perusal filter for crt viewing
SYNOPSIS
~

[-cdflsu]

[-n] [+linenumber]

[+/pattern] [name •.. ]

page more options
DESCRIPTION
Page is a filter which allows examination of a continuous
text one screenful at a time on a soft-copy terminal. It
normally pauses after each screenful, pr inting --More-- at
the bottom of the screen. If the user then types a carriage
return, one more line is displayed.
If the user hits a
space, another screenful is displayed. Other possibilities
are enumerated later.
The command line options are:
-n

An integer which is the size (in lines) of the window
which more will use instead of the default.

-c

~

-d

~

-f

This causes page to count logical, rather than screen
lines.
That is, long lines arc not folded.
This
options is recommended if nroff output is being piped
through .u.l, since the latter may generate escape
sequences.
These escape sequences contain characters
which would ordinarily occupy screen positions, but
which do not print when they are sent to the terminal
as part of an escape sequence.
Thus page may think
that lines are longer than they actually are, and fold
1 ines erroneously.

-1

Do not treat . . L (form feed) specially. If this option
is not given, ~~ will pause after any line that
contains a . . L, as if the end of a screenful had been
reached. _~lso, if a file begins with a form feed, the
screen will be cleared before the file is printed.

will draw each page by beginning at the top of the
screen and erasing each line just before it draws on
it. This avoids scrolling the screen, making it easier
to read while more is writing.
This option will be
ignored if the terminal does not have the ability to
clear to the end of a line.
will prompt the user with the message "Hi t space
to continue, Rubout to abort" at the end of each
screenful. This is useful if page is being used as a
filter in some setting, such as a class, where many
users may be unsophisticated.

PAGE (I)

-s

Squeeze multiple blank lines from the output, producing
only one blank line. Especially helpful when viewing
nroff output, this option maximizes the useful informa~
tion present on the screen.

-u

Normally, ~ will handle underlining such as produced
by nroff in a manner appropriate to the particular
terminal:
if the terminal can perform underlining or
.has a stand-out mode, page will output appropriate
escape sequences to enable underlining or stand-out
mode for underlined information in the source file.
The -u option suppresses this processing.

+linenumber
Start up at linenumber.
+/pattern
Start up two lines before the line containing the
regular expression pattern.
The screen is cleared before each screenful is printed (but
only if a full screenful is being printed), and k - 1 rather
than k - 2 lines are printed in each screenful, where k is
the number of lines the terminal can display.
~

looks in the file /etc/termcap to determine terminal
character istics, and to detez:mine the defaul t window siz eQ
On a terminal capable of displaying 24 lines, the defaul
window size is 22 lines.

looks in the environment variable MORE to pre-set any
flags desired. For example, if you prefer to view files
using the -c mode of operation, the csh command setenv MORE
-c or the sh command sequence MORE= l-C I i expor t MORE woul:
cause all invocations of pag~, including invocations by
programs such as man and IDASa, to use this mode. Normally,
the user will place the command sequence which sets up "
MORE environment variable in the .cshrc or .profile filee

~

If page is
percentage
This gives
lines) that

reading from a file, rather than a pipe, then
is displayed along with the --More-- prompt.
the fraction of the file (in characters, not
has been read so far.

Other sequences which may be typed when page pauses, and
their effects, are as follows (i is an optional integer
argument, defaulting to 1):
i
display i more lines,
argument is given)
... D

(or another screenful

display 11 more lines (a "scroll").
then the scroll size is set to i.

3-7~B

If i

is

if no
gillen~

PAGE(l)

PAGE (1)
~D

d

same as

iz

same as typing a space except that i,
becomes the new window size.

is

skip i lines and print a screenful of lines

if

skip i screenfuls and print a screenful of lines

q or Q
Exit from

(control-D)
if pr esent,

~.

=

Display the current line number.

v

Start up the editor Yi at the current line.

h

Help command;
commands.

give a description of all the more

i/expr
search for the i-th occurrence of the regular expression expr.
If there are less than i occurrences of
expr, and the input is a file (rather than a pipe),
then the position in the file remains unchanged.
Other~ise, a screenful is displayed, starting two lines
bef or e the place wher e the expr es s ion W(1S found. The
user's erase and kill characters may be used to edit
the regular expression. Erasing back past the first
column cancels the search command.
in

search for the i-th occurrence of the last regular
expression entered.
(single quote)
Go to the point from which the last
search started. If no search has been performed in the
current file, this command goes back to the beginning
of the file.

!corrunand
invoke a shell with command. The characters 1%1 and
'I' in "command" are replaced with the current file
name and the previous shell command respectively.
If
there is no current file name, '%1 is not expanded.
The sequences "\%" and "\1" are replaced by "%" and "!"
respectively.
i:n

skip to the i-th next file given in the command line
(skips to last file if n doesn't make sense)

i:p

skip to the i-th previous file given in the command
line. If this command is given in the middle of printing out a file, then ~ goes back to the beginning of

PAGE(l}

PAGE(l)

the file. If i doesn't make sense, page skips back to
the first file.
If page is not reading from a file,
the bell is rung and nothing else happens.
:f

display the current file name and line number.

: q or : Q
exit from

~

(same as q or

Q) •

(dot) repeat the previous command.
The com man d s take e f f e c tim me d i a tel y, i. e. , i t is no t
necessary to type a carriage return. Up to the time when
the command character itself is given, the user may hit the
line kill character to cancel the numerical argument being
formed. In addi tion, the user may hi t the erase character
to redisplay the --More--(xx%) message.
At any time when output is being sent to the terminal, the
us e rca n hit t he qui t key ( no r mally con t r 01- \) . P age will
stop sending output, and will display the usual --More-prompt. The user may then enter one of the above commands
in the normal manner. Unfortunately, some output is lost
when this is done, due to the fact that any characters
wai ting 'in the terminal's output queue are flushed when the
quit signal occurs.
The terminal is set to noecho mode by this program so that
the output can be continuous. What you type will thus not
show on your terminal, except for the / and ! commands.
If the standard output is not a teletype, then ~~ acts
just like ~, except that a header is printed before each
file (if there is more than one) •
A sample usage of page in previewing nroff output would be
nroff -ms +2 doc.nlpage -s
FILES

/etc/termcap
/usr/lib/more.help

Terminal data base
Help file

SEE ALSO

csh(l) f man(l),
environ(7)

more(l),

msgs(l)

1

script(l)

f

sh(l),

I4.AP(1)

MAP(l)

NAME
map - create an alternate sector map for a hard disk drive
SYNOPSIS
map layout mapfile drive
DESCRIPTION
M.~ creates a bad sector map, on mapf ile, using the layout
information, in layout, created by layout(l}.
The last
argument is the logical device name which references the
whole dr i vee
The standard invocation is:
map

/dev/hd~.layout

/dev/hd~.secmap

/dev/hd3

The structure used for the bad sector to alternate sector
mapping is as follows:
struct mapsec {
int
bad_cyl;
char badJledi
char bad_sec;
int
bad_good;

.

}. ,

/* Cylinder number of bad sector */
/* Head number of bad sector */
/* Sector number of bad sector .*/
/* Offset into alternate sector
area */

This structure provides a way for the XENIX hard disk driver
to recover from bad sectors it encounters when reading the
hard disk. If a bad sector is read, a search of a table of
the above structures is made.
If an exact match of
cylinder,. head and sector is found, the corresponding offset
is used as an index into the area reserved on the disk for
alternate sectors.
SEE ALSO
layout(l), sizefs(l)

3-69

DCOD (ll4)

GCOD ( IX)

NAME
mkconf - generate configuration tables
. SYNOPSIS
mkconf
DESCRIPTION
Mkconf examines a machine configuration table on its standard input.
Its output is a f ile s:..~, which contains a
vectored interrupt switch, block and character device switch
tables and declarations for system variables.
Input to mkconf is a sequence of lines.
describe devices on the machine:
c8
lp
cf
cd
mf
mw
wp
sa

The following

(Central Data 8 line serial interface)
(Line printer)
(Central Data floppy controller)
(Central Data cartridge disk controller)
(Codata mini-floppy controller)
(Codata mini-winchester controller)
(IMI disk interface)
(SA lBBB disk ,controller)

The Codata console is automatically included. Also included
automatically are several pseudo device drivers.
The following lines are also accepted.
root

~

minor
The specified block device (e.g., hp) is used for the
root.
.minor is a decimal number giving the minor
device. This line must appear exactly once.

swap

~

minor
The specified block device is used for swapping.
not given the root is used.

If

pipe .d..e.2 minor
The specified block device is used to store pipes.
not given the root is used.

If

swplo number
nswap numbez;
Sets the origi~ (block number) and size of the area
used for swapplng. By default, the not very useful
numbers 4000 and 872.
tim e z..o..ru; .ds..t.
Change the default timezone to be zone. Zone may be
the name of any timezone in the continental u.S. or the

MXCOfiF ( IH)

MKCONF(l.M)

number of minutes westward of Greenwich. ~ should be
1 if the daylight savings time conversion should be
done.
nbufs ru;un
The number of sys tern buf fe r s is se t to .n..um.
The
default value is taken from the parameter DNBUF in
param.h.
FILES
c.c

output file

SEE ALSO
Device driver descriptions in section 4.
Setting up XENIX, in Volume 2B.

3-69B

MODEI4(l)

MOD EX (1)

N.r..ME

modem - set up tty port to be used with a modem
unmodem - unset modem port
SYNOPSIS
/etc/modem /dev/ttyn
/etc/unmodem /dev/ttyn
DESCRIPTION
The m~m command is used to set up /~ttyn to be used
with a compatible modem.
The modem command should be executed for every port that has a modem attached, every time
the system is booted.
The modem command ensures that a dial-up tty will be logged
out if the user simply hangs up while logged onto the systern.
The XENIX tty device ignores the state of the RTS signal
(Pin 4) by default. This works well with terminals, which
may become momentarily disconnected. However, modems must
be made aware of tbe RTS signal to maintain system security.
The use of the modem command ensures that a particular tty
will be logged out if the RTS signal goes inactive.
The Ynmodem command does the opposite of the modern command,
Le., it tells the kernel to ignore the state of the RTS
signal.
SEE ALSO
disable(l) , tty(4)
DIAGNOSTICS
The modem(l) command will hang if run on a port that has
already been declared a modem port. Do not run modem(l)
tw ice for the same por t.
EXAMPLE
/etc/modem /dev/tty3
fete/modem tty3
These commands are equivalent and tell the system that a
modern is being used on serial port 3.

3-·59C

MORE (I)

MORE (1)

NA11E
more - file perusal filter for crt viewing
SYNOPSIS
more [-cdf1su]

[-n] [+linenumber] [+/pattern]

[name .•• ]

page more options
DESCRIPTION
is a filter which allows examination of a continuous
text one screenfu1 at a time on a soft-copy terminal. It
normally pauses after each screenful, pr in ting --Mor e-- at
the bottom of the screen. If the user then types a carriage
return, one more line is displayed.
If the user hits a
space, another screenful is displayed.
Other possibi1i ties
are enumerated later.

~

The command line options are:
-n

An integer which is the size (in lines) of the window
which m~ will use instead of the default.

-c

M.~ will draw each page by beginning at the top of the
screen and erasing each line just before it draws on
it. This avoids scrolling the screen, making it easier
to read while ID~ is writing.
This option will be
ignored if the terminal does not have the ability to
clear to the end of a line.

-d

M0 r e will pro mp t the use r wit h the me s sag e n Hit spa c e
to continue, Rubout to abort" at the end of each
screenful. This is useful if ID~~ is being used as a
filter in some setting, such as a class, where many
users may be unsophisticated.

-f

This causes ID.Q..l:...a to count logical, rather than screen
lines.
That is, long lines are not folded.
This
options is recommended if nroft output is being piped
through .u.l., since the latter may generate escape
sequences.
These escape sequences contain characters
which would ordinarily occupy screen positions, but
which do not print when they are sent to the terminal
as part of an escape sequence. Thus m~ may think
that lines are longer than they actually are, and fold
lines er roneously.

-1

Do not treat . . . L (form feed) specially. If this option
is not given, more will pause after any line that
contains a . . . L, as if the end of a screenful had been
reached. Also, if a file begins with a form feed, the
screen will be cleared before the file is printed.

3-690

MOR.E(l)

MORE(l)

-s

Squeeze multiple blank lines from the output, producing
only one blank line. Especially helpful when view ing
nroff output, this option maximizes the useful- information present on the screen.

-u

Normally, m~ will handle underlining such as produced
by Droff in a manner appropriate to the particular
terminal:
if the terminal can perform underlining or
has a stand-out mode, m~ will output appropriate
escape sequences to enable underlining or stand-out
mode for underlined information in the source file.
The -u option suppresses this processing.

+linenumber
Start up at linenumber.
+/pattern
Start up two lines before the line containing the
regular expression pattern.
If the program is invoked as page, then the screen is
cleared before each screenful is printed (but only if a full
screenful is being printed), and k - 1 rather than k - 2
lines are printed in each screenful, where k is the number
of lines the terminal can display.
M..Q.U looks in the file /etc/termcap.·to determine terminal

characteristics, and to determine the default window size.
On a terminal capable of displaying 24 lines, the default
window size is 22 lines.
looks in the environment variable MORE to pre-set any
flags desired. For example, if you prefer to view files
using the -c mode of operation, the csh command setenv MORE
-c or the sh command sequence MORE='-C'i export MORE would
cause all invocations of more, including invocations by
programs such as man and msgs, to use this mode. Normally,
the user will place the command sequence which sets up the
MORE environment variable in the .cshrc or .profile file.

~

If m~ is
percentage
This gives
lines) that

reading from a file, rather than a pipe, then a
is displayed along with the --More-- prompt.
the fraction of the file (in characters, not
has been read so far.

Other sequences which may be typed when m~ pauses, and
their effects, are as follows (i is an optional integer
argument, defaulting to 1) :
i
display i more lines,
argument is given)
... D

(or another screenful if no

display 11 more lines (a " s c r 011
then the scroll size is set to i.

11 )

•

If i i sg i v en,

MORE (1)
d

same as AD (control-D)

iz

same as typing a space except tha t
becomes the new window size.

is

skip i lines and print a screenful of lines

if

skip i screenfuls and print a screenful of lines

q or Q
Exit from

i,

if pr esent 1

.Ill.Q...t..a.

=

Display the current line number.

v

Start up the editor Yi at the current line.

h

Help command;
commands.

give a

description

of all

the more

i/expr
search for the i-th occurrence of the regular expression expr.
If there are less than i occurrences of
expr, and the input is a file (rather than a pipe),
then the position in the file remains unchanged.
Otherwise, a screenful is displayed, starting two lines
before the place where the expression was found. The
user's erase and kill characters may be used to edit
the regular expression. Erasing back past the first
column cancels the search command.
in

search for the i-th occurrence of the last regular
expr es si on enter ed.
(single quote)
Go to the point from which the last
search started. If no search has been performed in the
current file, this command goes back to the beginning
of the file.

!cornmand
invoke a shell with command. The characters '%' and
'II in "command" are replaced with the current file
name and the previous shell command respectively.
If
there is no current file name, '%' is not expanded.
The sequences "\%" and "\1" are replaced by 1'%" and "1"
respectively.
i:n

skip to the i-th next file given in the command line
(skips to last file if n doesn't make sense)

i:p

skip to the i-th previous file given in the command
line. If this command is given in the middle of print~
ing out a file, then more goes back to the beginning of

3-69F

MORE (1)

MORE (1)

the file. If i doesn't make sense, ID.Q...I.:..e.. skips back to
the first file.
If m~ is not reading from a file,
the bell is rung and nothing else happens.
:f

display the current file name and line number.

: q or : Q
exit from

~

(same as q or

Q) •

(dot) repeat the previous command •

.

The com mands tak e ef fect immedia tely, i.e., it is not
necessary to type a carriage return. Up to the time when
the command character itself is given, the user may hit the
line kill character to cancel the numerical argument being
formed. In addition, the user may hit the erase character
to redisplay the --More--(xx%) message.
At any time when output is being sent to the terminal, the
use rca n hit the qui t key ( nor mall y con t r 01- \) • M.Q.L..e. will
stop sending output, and will display the usual --More-prompt. The user may then enter one of the above commands
in the normal manner. Unfortunately, some output is lost
when this is done, due to the fact that any characters
waiting in the terminal's'output queue are flushed when the
quit signal occurs.
The terminal is set to noecho mode by this program so that
the output can be continuous. What you type will thus not
show on your terminal, except for the / and ! commands.
If the standard output is not a teletype, then m~ acts
just like ~, except that a header is printed before eacl)
file (if there is more than one) •
A sample usage of more in previewing nroff output would be
nroff -ms +2 doc.nlmore -s
FILES
/etc/termcap
/usr/lib/more.help

Terminal data base
Help file

SEE ALSO
csh(l), man(l), msgs (1), script(l), sh(l), environ(7)

3-69G

PRINTENV(l)

NAME

XENIX Programmer's Manual

PRINTENV(l)

printenv - print out the environment

SYNOPSIS
printenv [ name ]
DESCRIPTION
Printenv prints out the values of the variables in the
environment. If a ~ is specified, only its value is
printed.
If a ~ is specified and it is not defined in the environment, printeny returns exit status 1, else it returns status
~.

SEE ALSO
shell, environ (5) , csh(l)
BUGS

3-71

PS(I)

NAME

XENIX Programmer's Manual

PS(I)

ps - process status

SYNOPSIS
ps [ acgklrstuvwxi [ corefile ] [ swapfile ] [ system ] ]
DESCRIPTION
~ prints certain indicia about active processes.
To get a
complete printout on the console or lpr, use "ps axlgw"
For a quick snapshot of system activity, "ps au" is recommended. A minus may precede options with no effect. The
following options may be specified.
a

aSks for information about all processes with terminals
(ordinarily only one's own processes are displayed).

c

causes only the ~ field to be displayed instead of
the arguments. (The comm field is the tail of the path
name of the file the process last exec'ed.) This option
speeds up ~ somewhat and reduces the amount of output.
It is also more reliable since the process can't scribble on top of it.

g

Asks for all processes. Without this option, 1lli only
prints "interesting" processes. Processes are deemed
to be uninteresting if they are process group leaders,
or if their arguments begin with a '_I. This normally
eliminates shells and getty processes.

k

causes the file /~~/~ is used in place of
and /~~. This is used for postmortem
system debugging.

/~kmem

I

asks for a long listing. The short listing contains
the user name, process ID, tty, the cumulative execution time of the process and an approximation to the
command line.

r

asks for "raw output". A non-human readable sequence
of structures is output on the standard output. There
is one structure for each process, the format is
defined by 

s

Print the size of the kernel stack of each process.
This may only be used with the short listing, and is
for use by system developers.

tttyname
restricts output to processes whose controlling tty is
the·specifiedttyname (which should be specified as
printed by~, e.g. ~ for tty3, tconsole for console,tttydQ.for ttydQ, .t.? for processes with no tty,
3-72

XENIX Programmer's Manual

?S (1)

etc).

PS (1)

This option must be the last one given.

u

A user oriented output is produced. This includes the
name of the owner of the process, process id, nice
value, size, resident set size, tty, cpu time used, and
the command.

w

tells ~ you are on a wide terminal (132 columns). ~
normally assumes you are on an 80 column terminal.
This information is used to decide how much of long
commands to print. The w option may be repeated, e.g.
ww, and the entire command, up to 128 characters, will
be printed without regard to terminal width.

x

aSKS even about processes with no terminal.

#

A process number may be given, (indicated here by i),
in which case the output is restricted to that process.
This option must also be last.

A second argument tells ~ where to "look for ~ if the k
option is given, instead of /vrncore. A third argument is
the name of a swap file to use instead of the default
/dev/drum. If a fourth argument is given, it is taken to be
the file containing the system's namelist • Otherwise,
"/vrnunix" is used.
The output is sorted by tty, then by process ID.
The long listing is columnar and contains
F

Flags associated with the process. These are defined
by idefine lines in /usr/include/sys/proc.h.

S

The state of the process. 0: nonexistent; s: sleeping;
W: waiting; R: running; I: intermediate; Z: terminated;
T: stopped.

UID

The user id of the process owner.

PID

The process ID of the process; as in certain cults it
is possible to kill a process if you know its true
name.

PPID The process ID of the parent process.
CPU

Processor utilization for scheduling.

PRI

The priority of the process; high numbers mean low
priority.

NICE Used in priority computation.
3-73

XENIX Programmer's Manual

PS{l)

PS (1)

ADDR The memory address of the process if resident, otherwise the disk address.
SZ

The size in blocks of the memory image of the process.

WCHAN
The event for which the process is waiting or sleeping;
if blank, the process is running.
TTY

The controlling tty for the process.

TIME The cumulative execution time for the process.
COMMAND
The command and its arguments.
A process that has exited and has a parent, but has not yet
been waited for by the parent is marked 
To restore the files under /usr/john, check that there is a
directory entry for /usr/john. Use the mkdir command to
create one, if necessary.
Load the first diskette, and enter
cd./uar/jobn (CR>
tar xv (OR>
For more information, see the tutorials in the Introduction.
to XERIX Manual.

3-8'

TRANSP(l)

'l"RAllSP ( 1)

NAME
transp - set up transparent printer
SYNOPSIS
/etc/transp /dev/ttyn /dev/lpm
DESCRIPTION
The trans12 command is used to set up the proper device files
for serial printers hooked to the back of an Altos II terminal.
The /~~ argument specifies which tty device (n)
has the daisy-chained printer attached to its auxiliary
port.
This terminal must be an Altos II terminal.
The
/~1Dm argument specifies the name of the printer device
(e.g., /dev/lp2).
If the specified printer is /dev/lp, then
this will be the default printer in the system.
The transp command creates a link between a tty port and a
printer port.
Once this link is established, it is not
necessary to perform this command again unless the printer
is moved. Output destined for a printer hooked to the back
of an Altos II switches the terminal into transparent mode,
and the terminal becomes inoperative while the printer is
working. When printing stops (i.e., the user program closes
the print device), the terminal becomes active again.
SEE

ALSO
mkn od ( I), tty ( 4 )

EXAMPLE

transp /dev/tty6 /dev/lp
This command sets up serial port 6, which has an Altos II
terminal attached, to also be the default printer port in
the system.
transp /dev/tty5 /dev/lp2
transp tty5 Ip2
transp 5 2
All these commands are equivalent. They set up serial port
5 to also be line printer 2 in the system.

OA(lK)

NAME

OA(II1)

ua -- user administration

SYNOPSIS

.ua [ -h ]

DESCRIPTION
ua is used for the addition, deletion and modification of
users and groups.
It provides an effective means for
maintaining the system password (/etc/passwd) and system
group (/etc/group) files.
The command is implemented using the ~m~ and curses
facilities from UC Berkeley.
It must be run interactively
from a terminal which is defined within /etc/termcap.
This command should only be run by Super User -- improper
results may occur if it is run by a normal user.
The following option is interpreted by .ua:

-h

Displays the program's current version and copyright
notice as well as a short description of the program's
functions.

ua

displays its legal commands at the top of the screen.
The "Command?" prompt at the bottom of the screen indicates
that .ua is awaiting input. The command language syntax is:
[ addldeletelshowlchange ] [ user  I group  ]
show [ Users I Groups ]
[ help I ?
!

[

 ]

quit
The system responds as soon as the first letter of a command
is typed. Full command words are not acceptable as input.
The case of each word is significant: "group" is not the
same as "Group."
Typing an interrupt (usually RUBOUT or DEL) will cause YA to
immediately return to the top-level command interpreter.
allows the addition of a new user or group. After
user/group is specified and a new name provided, the system
immediately enters the change command so as to allow
modification of the new entry. At the conclusion of the
change command the addition is made. If a directory already
exists for a new user, it is not removed. All files under

~

3-81

OA(lJl)

OA(lJl)

/etc/newuser are copied to the new directory during the user
installation process.
Typically /etc/newuser will contain
the standard versions of the following files:
.cshrc,
.login, .logout, .profile. The initial value given to a new
user ID is one more than the maximum user ID currently in
use. The same is true for a new group ID.
Delete allows the deletion of 'an existing user or group.
Deleting a user optionally also deletes his directory and
all files contained within it. Deleting a user will not
cause .s.l.l files throughout the system owned by the user to
be deleted -- only those beneath his directory. Thus, some
files may have an "unknown" owner after a user is deleted.
And, if a user is later added with the same user ID as the
deleted user, these files will suddenly belong to the new
user. The same problem may arise with the deletion and
later addition of a group •
.s..h211 will show an individual user or group or all users or
groups. The word nshown may be omitted if desired.
Change allows the modification of any existing user or
group. A special display mode is entered with a menu of
fields for selection of the item to be modified. Typing
RETURN or LINE FEED in response to a field change request
will empty the field. Changes to a user or group change the
corresponding entries in the /etc/passwd and /etc/group
files. Changing a user's directory entry will ~ cause a
renaming of the actua~ directory.
It is the user's responsibility to ensure that the /etc/passwd and /etc/group
files remain consistent.
Help displays a short informative text on the screen. "?"
is equivalent to help. The message is the same one as obtained by invoking Ya with the "-h" option.
! escapes to the shell (see sh(l».
If no arguments are
given, a shell is invoked which will continue until it
receives an end-of-file. Then ya resumes. If arguments are
present, a shell is invoked with the "-c" option and the arguments are passed along. lla resumes immediately thereafter. If csh(l) is desired rather than sh(l), the command
lcsh should be used.

Qyit immediately terminates

~

and returns to the system.

Any command which is not understood by ~A causes an
appropriate message to be displayed. As a side-effect, the
working portion of the screen is cleared.

Us does not distinguish between RETURN and LINE FEED.
may be used interchangably.

They

If the screen becomes "dirty· for some reason, you can force
to clear it and redisplay the current contents by

~A

3-82

OA(a)

UA(a)

transmitting an ASCII "OC2." This is Control-r on most of
the currently popular terminals.

UA understands the Backspace function (as obtained from

/etc/termcap). In addition, any time a word is partially
formed, the ESCape key will cause the partial word to be
discarded and input restarted.
interprets the CANcel key to mean "terminate the current
operation." The CANcel key is Control-x on many of the more
popular terminals. The CANcel key is more powerful than
ESCape, but not so powerful as "interrupt."

llg

US will immediately return to the top-level command interpreter upon receipt of an interrupt signal. Such a signal
is usually generated via the DEL, RUBOUT or BREAK key.

ua

creates a special user named "standard" in /etc/passwd if
one is not already present.
This entry is used as the
template for installing new users. Thus, if it is desired
to have all new users defaulted to the standard UNIX shell
(/bin/sh) for the Shell field, it is only necessary to
update the Shell field in the "standard" user.

Before adding a new user with a new group, the new group
should be added.
Otherwise, YA has no way to properly
create the new entry in /etc/passwd since it contains group
numbers rather than group names.
During program initialization YA copies /etc/passwd and
/etc/group to /etc/opasswd and /etc/ogroup, respectively.
Thus, if a mistake or disaster occurs during the use of this
program, the user may recover the prior state of either or
both files.
FILES

/etc/passwd
/etc/group
/etc/opasswd
/etc/ogroup
/etc/newuser
/etc/termcap
/tmp/passwd
/tmp/group
/etc/ua.lock

used for login name to user IO conversions
used for group name to group ID conversions
this file is a copy of /etc/passwd before any
modifications are made
this file is a copy of /etc/group before any
modifications are made
directory containing files which will be installed in a new user's account
contains terminal attribute descriptions
temporary file
temporary file
lock file

SEE ALSO
group(5), passwd(5)

3-83

UA(lll)

UA(lll)

DIAGNOSTICS
The diagnostics produced by YA are intended to be selfexplanatory.
BUGS

ua

should allow specification of alternate passwd and group
files.

Complete consistency checking between the /etc/passwd and
/etc/group files is not done. In particular, it is possible
to install a use r with an unknown group in the passwd file
and it is possible to install a group with an unknown user
in the group file.
The shells and directories specified in
the / etc/passwd file are not checked for existence or
accessibility.

us does not check for duplicated user IDs or duplicated
group IDs.

Impossible user IDs and group IDs are permitted.
Impossible or non-existent names may be specified for a
user's Directory and Shell fields.
The System 3 commands pwck(IM) and grpck(lm) should be incorporated into ya.
ltO:rB:

DO NOT USB JlA If'O SBIJI A USBR'S PASSWORD. The
password would be incorrectly encrypted r and
the user would NOT be able to log in successfully. Passwords may only be set with the
passyd command, explained in PASSWD(l). The
password field displayed by ~ is the
encrypted version contained in /etc/passwd.

3-84

XENIX Programmer's Manual

rI (1)

VI(l)

~AME

vi - screen oriented (visual) display editor based on ex
;YNOPSIS
vi [ -t tag]

-r] [ +lineno ] name •••

DESCRIPTION
Yl (vlsual) is a display oriented text editor based on
~(l).
~ and ~ run the same code; it is possible to get
to the command mode of ~ from within ~ and vice-versa.
The Yi Ouick Reference card and the Introduction ~ Display
Editing ~ Yi provide full details on using 21.
FILES
See

..ez.(l).

SEE ALSO
ex (1), vi (1); "Vi Quick Reference'
tion to Display Editing with Vi' '.

I

card, "An Introduc-

BUGS

Scans with / and? begin on the next line, skipping the
remainder of the current line.
Software tabs using AT work only immediately after the
autoindent.
Left and right shifts on intelligent terminals don't make
use of insert and delete character operations in the terminal.
The wrapmargin option can be fooled since it looks at output
columns when blanks are typed. If a long word passes
through the margin and onto the next line without a break,
then the line won't be broken.
Insert/delete within a line can be slow if tabs are present
on intelligent terminals, since the terminals need help in
dOing this correctly.
Occasionally inverse video scrolls up into the file from a
diagnostic on the last line.
Saving text on deletes in the named buffers is somewhat
inefficient.
The source command does not work when executed as :source;
there is no way to use the :append, :change, and :insert
commands, since it is not possible to give more than one
line of input to a : escape. To use these on a :global you
must Q to ~ command mode, execute them, and then reenter
3-85

VI(l)

XENIX Programmer's Manual

the screen editor with

~

or

~.

3-86

VI(l}

LOCKDG(2)

LOCKIBG(2)

NAME

locking - lock or unlock a record of a file

SYNOPSIS
locking(fildes, ltype, nbytes), int fildes, ltype, nbytes,
DESCRIPTION
locking performs a locking action Itype on a record of the
open file specified by fildes. The record starts at the
current file position and has a length of nbytes. If the
value of nbytes is a, the entire file is locked. Nbytes may
extend beyond the end of the file, in which case only the
process issuing the lock call may access or add information
to the file within the boundary defined by nbytes. Thus,
lock defines a range in the file controlled by the locking
process, and this control may extend to records that have
yet to be added to the end of the file.
The available
values for Itype are:
UNLOCK

a

Unlock the record.

LOCK

1

Lock the given record, the calling process
will sleep if any part of the record has been
locked by a different process.

NBLOCK

2

Lock the given record, if any part of the
record is already locked by a different
process, return the error EACCESS.

RLOCK

3

Same as LOCK except that reading is allowed
by other processes.

NBRLOCK 4

Same as NBLOCK except that reading of the
record is allowed by other processes.

Any process that attempts a read or write on a locked record
will sleep until the record is unlocked. If the record is
locked with an RLOCK then reading is permissible. When a
process terminates, all locked records are unlocked.
SEE ALSO
read (2), write (2), open (2)
DIAGNOSTICS
If an error occurs, -1 is returned. The error code EACCESS
is returned if any portion of the record has been locked by
another process for the LOCK & RLOCK actions. The error
code EDEADLOCK is returned if locking the record would cause
a deadlock. This error code is also returned if there are
no more free internal locks.

3-87

LOCIIM:(2)

LOCUBG(2)

FILES

/usr/include/user.h contains definitions for EACCESS and
EDEADLOCK.
/usr/include/sys/locking.h contains definitions for UNLOCK,
LOCK, NBLOCK, RLOCK, NBRLOCK.

3-88

RDCB(2)

NAME

BDCIIK(2)

rdchk - check if there is data to be read

SYNOPSIS
rdchk(fdes),
int fdes,
DESCRIPTION
Rdchk checks to see if a process will block if it attempts
to read the file designated by fdes. Rdchk returns 1 if
there is data to be read or if it is the end of the file
(EOF) •. In this context, the proper sequence of calls using
rdchk is:
if (rdchk(fildes) > I) read(fildes, buffer, nbytes),
SEE ALSO
read(2)
DIAGNOSTICS
Rdchk returns -1 if an error occurs (e.g., EBADF), S if the
process will block if it issues a read and 1 if it is okay
to read.
EBADF is returned if a rdchk is done on a
semaphore file or if the fil.e specified doesn't exist.

3-89

CURSES (3)

NAME

curses - screen functions with "optimal"

SYNOPSIS
~

CURSES (3)

XENIX Programmer's Manual

cursor motion

[ flags 1 files -lcurses -ltermlib [ libraries ]

DESCRIPTION
These routines give the user a method of updating screens
with reasonable optimization. They keep an image of the
current screen, and the user sets up an image of a new one.
Then the refresh () tells the routines to make the current
screen look like the new one. In order to initialize the
routines, the routine initscr () must be called befor e any of
the other routines that deal with windows and screens are
used.
SEE ALSO
Screen Updating ~ Cursor Moyement Optimizgtion: A Library
Packgge, Ken Arnold,
termcap (5), stty (2), setenv (3), setenv (3),
AUTHOR
Ken Arnold
FUNCTIONS
addch(ch)
add a character to stdscr
addstr(str)
add a string to stdscr
box{win,vert,hor)
draw a box around a window
crmode()
set cbreak mode
clear()
clear stdscr
clearok(scr,boolf)
set clear flag for ~
clrtobot()
clear to bottom on stdscr
clrtoeol()
clear to end of line on stdscr
delwin(win)
delete ~
echo ()
set echo mode
eraser)
erase stdscr
getch()
get a char through stdscr
getstr(str)
get a string through stdscr
gettmode ()
get tty modes
getyx(win,y,x)
get (y,x) co-ordinates
inch()
get char at current (y,x) co-ordinates
initscr{)
initialize screens
leaveok(win,boolf)
set leave flag for ~
longname(termbuf,name)
get long name from termbuf
move(y,x)
move to (y,x) on stdscr
mvcur(lasty,lastx,newy,newx) actually move cursor
newwin(lines,cols,begin-y,begin_x) create a new window
nl ()
set newline mapping
nocrmode()
unset cbreak mode
noecho ()
unset echo mode
nonl ()
unset newline mapping
noraw ()
unset raw mode
3-9.

:URSES (j)

XENIX Programmer's Manual

CURSES(3}

overlay (winl,win2)
overlay winl on win2
overwrite (winl,win2)
overwrite winl on top of win2
printw(fmt,argl,arg2, ••• )
printf on stdscr
raw ()
set raw mode
refresh()
make current screen look like stdscr
restty()
reset tty flags to stored value
savetty()
stored current tty flags
scanw(fmt,argl,arg2, ••• )
scanf through stdscr
scroll (win)
scroll ~ one line
scrollok(win,boolf)
set scroll flag
setterm(name)
set term variables for name
unctrl(ch)
printable version of ~
waddch(win,ch)
add char to ~
waddstr(win,str)
add string to ~
wclear(win)
clear ~
wclrtobot(win)
clear to bottom of ~
wclrtoeol(win}
clear to end of line on ~
werase{win)
erase ~
wgetch(win)
get a char through ~
wgetstr(win,str)
get a string through ~
winch (win)
get char at current (y,x) in ~
wmove(win,y,x)
set current (y,x) co-ordinates on ~
wprintw(win,fmt,argl,arg2, ••• ) printf on ~
wrefresh(win)
make screen look like ~
wscanw{win,fmt,argl,arg2, ••• ) scanf through ~

3-91

MBBUS(5)

MENUS

menus

MEJlUS(5)

format of a Business Shell menu system

DESCRIPTION
A menu system is a collection of menus which has been
processed (digested) by digest (1M). The Business Shell,
bsh(l), requires a menu system upon which to operate: it
contains all the menus which are normally displayed to
accomplish some set of functions.
As distributed, the
Business Shell includes the default menu system
(/usr/lib/menusys and /etc/menusys.bin).
A menu source file may contain one or more individual menus.
However, in the interest of maintainability, it is
recommended that each menu source file contain only a single
menu, or only very closely related menus.
It is also
recommended that the name of the menu source file and the
menuidentifier be the same.
A source menu system may be a single menu file (containing
one or more menus) or a directory structure containing menu
files and subordinate directories.
Each menu file is an ASCII file consisting of two logical
parts: the ~ and the actions. A (digested) menu system
contains an additional part, the index. The index appears
prior to the body. It specifies the byte-offset locations
of each of the body and action chapters as well as the
associated menuidentifiers.
Users should never attempt to
construct an index by hand -- that is the function of
digest(IM). Moreover, users should never attempt to edit a
digested menu system; rather, the source menu files should
be edited and then the menu system recreated using
digest(IM} •
The precise format of a menu source file is described below:
&Menuidentifier
The sUbstance of the menu represented
essentially as it is to be displayed.
Within this area there usually will be
one or more occurrences of:
-prompt strings
as well as other special commands as
described below.
&Actions
Zero or more occurrences of:
-prompt
size
The sequence of actions to be taken

3-92

IIBJIDS(5)

IIBJIUS(5)

for this prompt. These are bsh(l}
commands and/or sh(l) commands.
An example menu for Electronic Mail Services is:
&Mail
\ELECTRONIC-MAIL-SERVICES

1date

-a - Receive-mail
-b - Send-mail
-c - Return-to-starting-menu
&Actions
-a
Ii)
mail
-b

-1

echo -n "To whom do you wish to send mail?"
I
read x
I
echo "Now type the message."
I
echo "Terminate it by typing a control -d."
I
mail $x
I-c
I________________________________________________
Start
1
__

&Henuidentifier must appear beginning in column one.
Menuidentifier is any string having relevance to the
user. A short descriptive string is usually best. The
string may not contain any blanks or punctuation and it
must begin with a capital letter. If the string ends
with a ques tion mark ("?"), the menu is called a "help
menu." It will be invoked automatically when bsh is
displaying the base menu and the user types a"?"
command. Thus, the &Admin? menu is invoked when &Admin
is the current menu and "?" is typed. The remainder of
the &Menuidentifier line should be empty.
The body of each menu is composed of text which will be
reproduced on the screen exactly as it appears (with
exceptions as described below).
-~m~ may occur one or more times within the body.
This indicates a prompt for which there will be an
associated action within the &Actions portion of the
menu. Usually there will be a short phrase or sentence
describing the action just to the right of the
-prompt. A prompt may be any letter, numeral or string
of characters not containing punctuation.
Usually
shorter (1-2 character) prompts are preferred.
A
prompt must be separated from its surroundings by one

3-93

MDUS(S)

MDUS(5)

or more spaces or tabs.
If a menu name and a prompt
both have the same spelling, the prompt is given
preference in all cases.
!~ inserts the current date and time, left-justified
on the "!." The date/time format is "Wed Jul 13 17:10
1983." !date may appear more than once if desired.

!user inserts the current user id, left-justi£ied on
the "!." !user may appear more than once if desired.
!lllUl inserts the current directory, left-j ustif ied on
the "!."
The full path name is displayed, e.g.
/usr/jones/admin/currwork.
!pwd may appear more than
once if desired.
!@ indicates where the cursor is to be placed on the
screen. Usually this should be just slightly to the
right of the current prompt.
If!@ is omitted, the
cursor will be placed at the bottom left corner of the
screen. At most, one occurrence of !@ should appear in
each menu.
Wi th the exception of !@, the "!" may appear as a
suffix in which case the string will be right-justified
instead of left-justified.
The "!" is an "escape character," and may not be used
for any other purpose within a menu.
\string denotes a string which is to be "highlighted"
using the terminal's highlighting capabilities (usually
reverse video). The "\" character must be on the left
of the string. It is converted into the appropriate
highlighting information during display. The string
may be of any length up to the width of the display
screen.
'string denotes a string which is to be "underlined"
using the terminal's underlining capabilities (usually
true underline).
The "'" character must be on the left
of the string. It is converted into the appropriate
underlining information during display. The string may
be of any length up to the width of the display screen.
The backslash "\" and backquote "'" as the initial
letter of a string are "escape characters" and will
always have the interpretations given above.
In order to create a highlighted or underlined string
containing spaces, "significant spaces" may be
represented as tildes (n-,,) within a string.
Thus,
\-hi-there- will create a highlighted ten-character
string.

3-94

IIBIIOS(5)

JlBllUS(5)

The tilde "-" is an "escape character," and may not be
used for any other purpose within a menu.
Each of the special escape sequences described above
must be separated from surrounding text by one or more
spaces or tabs.
It is important to know the number of lines and columns
of the terminal(s) to be used with a menu system and to
be certain not to create menus longer or wider than
these values. Their values are specified within the
termcap(5) file for each terminal upon which the
Business Shell may be run.
Actions
&Actions must appear beginning in column one.
must appear, even if there are no actions.

&Actions

Each prompt in the actions chapter must be reproduced
exactly as it appears in the body of the menu. It is
the user's responsibility to ensure that the spelling
of prompts in the ~ and actions chapters match. The
case of characters is significant; so "A" is not the
same as "a."
Size is optional.
It specifies the length of the
window to be used during execution of the actions. If
omitted, the default value is 5, and a window 5 rows by
column columns will be reserved at the bottom of the
screen for output. CQlumn is the terminal column width
as obtained from termcap(5). A ~ of 0 will reserve
the entire screen. In this case, the screen is blanked
prior to execution of the actions; and a prompt
requesting a return or line feed is issued after
execution. A negative size will reserve the entire
screen similarly to the zerp case, but after execution,
the Business Shell is immediately resumed without
waiting for a return or line feed. It is the user's
responsibility to ensure that the action window is
large enough.
The actions may be composed of bsh(l) commands or
commands which are executed by the standard shell,
shell. The actions should all be indented one tab stop
from the left side of the file.
A bsh(l) command is the instruction to transfer
immediately to a particular menu. This is specified by
writing the name of the destination menu in the
semantics field. Bsh(l) commands must be typed oneper-line.
Shell commands follow the usual rules as described in
Volume 1 of th~ Progra••er's Reference Kanual.
3-95

KBBUS(S)

KBBOS(S)

Since a menu file may contain one or more menus or
directories containing menus, the recommended way to create
a menu system is to create a tree of directories containing
the various portions of the system. Each subtree contains
all the menus related to a given subject. Thus, a primary
menu (directory) is created for, say, system management
functions: and subsidiary menus are placed beneath (within)
the directory for each of the individual system management
functions or function areas.
Help menus may be placed
wherever appropriate in the structure.
FILES

/usr/lib/menusys
/etc/menusys.bin

source directory for /etc/menusys.bin
digested default menu system for bsh(l)

SEE ALSO
bsh(l), digest (1M), shell, termcap(5)

3-96

~ERMCAP

(5)

XENIX Programmer's Manual

TERMCAP(5)

\lAME
termcap - terminal capability data base
3YNOPSIS
/etc/termcap
DESCRIPTION
Termcap is a data base describing terminals, used, ~.S., by
~(l) and curses(3).
Terminals are described in termcap by
giving a set of capabilities which they have, and by
describing how operations are performed. Padding requirements and initialization sequences are included in termcap.
Entries in termcap consist of a number of ':' separated
fields. The first entry for each terminal gives the names
which are known for the terminal, separated by 'I' characters. The first name is always 2 characters long and is
used by older version 6 systems which store the terminal
type in a 16 bit word in a systemwide data base. The second
name given is the most common abbreviation for the terminal,
and the last name given should be a long name fully identifying the terminal. The second name should contain no
blanks; the last name may well contain blanks for readability.
CAPABILITIES
(P) indicates padding may be specified
(P*) indicates that padding may be based on no. lines affected
Name
ae
al
am
as
bc
bs
bt
bw
CC
cd
ce
ch
cl
cm
co
cr
cs
cv
da
dB
db
dC

Type
str
str
bool
str
str
bool
str
bool
str
str
str
str
str
str
num
str
str
str
bool
num
bool
num

Pad?
(P)

(P*)
(P)
(P)

(P*)
(P)
(P)

(P*)
(P)

(P*)
(P)
(P)

Description
End alternate character set
Add new blank line
Terminal has automatic margins
Start alternate character set
Backspace if not AH
Terminal can backspace with AH
Back tab
Backspace wraps from column B to last column
Command character in prototype if terminal settable
Clear to end of display
Clear to end of line
Like cm but horizontal motion only, line stays same
Clear screen
Cursor motion
Number of columns in a line
Carriage return, (default AM)
Change scrolling region (vtlBB), like cm
Like ch but vertical only.
Display may be retained above
Number of mil Ii sec of bs delay needed
Display may be retained below
Number of millisec of cr delay needed
3-97

TERMCAP(5}

dc
dF
dl
dIn

dN
do
dT
ed
ei
eo
ff
hc
hd
ho
hu
hz
ic
if
im
in
ip
is
kB-k9
kb
kd
ke
kh
kl
kn
ko
kr
ks
ku
IB-19
Ii
11
ma
mi
ml
mu
nc
nd
nl
ns
os
pc
pt
se
sf
sg
so
sr

XENIX Programmer's Manual

str
num
str
str
num
str
num
str
str
str
str
bool
str
str
str
str
str
str
bool
bool
str
str
str
str
str
str
str
str
num
str
str
str
str
str
num
str
str
bool
str
str
bool
str
str
bool
bool
str
bool
str
str
num
str
str

(P*)
(P*)

(P*)

(P)

(P*)

(P*)

(P)
(P)

TERMCAP (5)

Delete character
Number of millisec of ff delay needed
Delete line
Delete mode (enter)
Number of millisec of nl delay needed
Down 0 ne line
Number of millisec of tab delay needed
End delete mode
End insert mode; give :ei=: if ic
Can erase overstrikes with a blank
Hardcopy terminal page eject (default AL)
Hardcopy terminal
Half-line down (forward 1/2 linefeed)
Home cursor (if no cm)
Half-line up (reverse 1/2 linefeed)
Hazeltine; can't print -'s
Insert character
Name of file containing is
Insert mode (enter); give :im=: if ic
Insert mode distinguishes nulls on display
Insert pad after character inserted
Terminal initialization string
Sent by other function keys B-9
Sent by backspace key
Sent by terminal down arrow key
Out of keypad transmit mode
Sent by home key
Sent by terminal left arrow key
Number of other keys
Termcap entries for other non-function keys
Sent by terminal right arrow key
Put terminal in keypad transmit mode
Sent by terminal up arrow key
Labels on other function keys
Number of lines on screen or page
Last line, first column (if no cm)
Arrow key map, used by vi version 2 only
Safe to move while in insert mode
Memory lock on above cursor.
Memory unlock (turn off memory lock).
No correctly working carriage return (DM25BB,H2~
Non-destructive space (cursor right)
Newline character (default \n)
Terminal is a CRT but doesn't scroll.
Terminal overstrikes
Pad character (rather than null)
Has hardware tabs (may need to be set with is)
End stand out mode
Scroll forwards
Number of blank chars left by so or se
Begin standout mode
Scroll reverse (backwards)
3-98

XENIX Programmer's Manual

rERMCAP (5)

ta
tc
te
ti
uc
ue
ug
ul
up
us
vb
ve
vs
xb
xn
xr
xs
xt

str
str
str
str
str
str
num
bool
str
str
str
str
str
bool
bool
bool
bool
bool

(P)

TERMCAP (5)

Tab (other than AI or with padding)
Entry of similar terminal - must be last
String to end programs that use cm
String to begin programs that use cm
Underscore one char and move past it
End underscore mode
Number of blank chars left by us or ue
Terminal underlines even though it doesn't overstri}
Upline (cursor up)
Start underscore mode
Visible bell (may not move cursor)
Sequence to end open/visual mode
Sequence to start open/visual mode
Beehive (fl=escape, f2=ctrl C)
A newline is ignored after a wrap (Concept)
Return acts like ce \r \n (Delta Data)
Standout not erased by writing over it (HP 264?)
Tabs are destructive, magic so char (Teleray le61)

A Sample Entry
The following entry, which describes the Concept-lee, is
among the more complex entries in the termcap file as of
this writing. (This particular concept entry is outdated,
and is used as an example only.)
cllcleelconceptlee:is=\EU\Ef\E7\ES\E8\El\ENH\EK\E\2ee\Eo&\2ee:\
:al=3*\E"R:am:bs:cd=16*\E"'C:ce=16\E"S:cl=2*"L:cm=\Ea%+ %+ :co#8e:\

:dc=16\E~A:dl=3*\E"B:ei=\E\2ee:eo:im=\EAP:in:ip=16*:li#24:mi:nd=\E=:

:se=\Ed\Ee:so=\ED\EE:ta=8\t:ul:up=\E;:vb=\Ek\EK:xn:
Entries may continue onto multiple lines by giving a \ as
the last character of a line, and that empty fields may be
included for readability (here between the last field on a
line and the first field on the next). Capabilities in
termcap are of three types: Boolean capabilities which indicate that the terminal has some particular feature, numeric
capabilities giving the size of the terminal or the size of
particular delays, and string capabilities, which give a
sequence which can be used to perform particular terminal
operations.
Types of Capabilities
All capabilities have two letter codes. For instance, the
fact that the Concept has automatic margins (i.e. an
automatic return and linefeed when the end of a line is
reached) is indicated by the capability am. Hence the
description of the Concept includes am. Numeric capabilities are followed by the character 'if and then the value.
Thus co which indicates the number of columns the terminal
has gives the value '8e' for the Concept.
3-99

TERMCAP(5}

XENIX Programmer's Manual

TERMCAP (5)

Finally, string valued capabilities, such as ce (clear to
end of line sequence) are given by the two character code,
an '=', and then a string ending at the next following ':'.
A delay in milliseconds may appear after the '=' in such a
capability, and padding characters are supplied by the editor after the remainder of the string is sent to provide
this delay. The delay can be either a integer, e.g. '2fiJ',
or an integer followed by an '*', i.e. '3*'. A '*' indicates that the padding required is proportional to the
number of lines affected by the operation, and the amount
given is the per-affected-unit padding required. When a '*'
is specified, it is sometimes useful to give a delay of the
form '3.5' specify a delay per unit to tenths of milliseconds.
A number of escape sequences are provided in the string
valued capabilities for easy encoding of characters there.
A \E maps to an ESCAPE character, ~x maps to a control-x for
any appropriate x, and the sequences \n \r \t \b \f give a
newline, return, tab, backspace and formfeed. Finally,
characters may be given as three octal digits after a \, and
the characters
and \ may be given as \" and \\. If it is
necessary to place a : in a capability it must be escaped in
octal as \072. If it is necessary to place a null character
in a string capability it must be encoded as \2fiJfiJ. The routines which deal with termcap use C strings, and strip the
high bits of the output very late so that a \200 comes out
as a \000 would.
A

Preparing Descriptions
We now outline how to prepare descriptions of terminals.
The most effective way to prepare a terminal description is
by imitating the description of a similar terminal in
termcap and to build up a description gradually, using partial descriptions with ~ to check that they are correct.
Be aware that a very unusual terminal may expose deficiencies in the ability of the termcap file to describe it or
bugs in H. To easily test a new terminal description you
can set the env:ironment variable TERMCAP to a pathname of a
file containing the description you are working on and the
editor will look there rather than in /~/termcap. TERMCAP
can also be set to the termcap entry itself to avoid reading
the file when starting up the editor. (This only works on
version 7 systems.)
Basic capabilities
The number of columns on each line for the terminal is given
by the co numeric capability. If the terminal is a CRT,
then the number of lines on the screen is given by the Ii
capabili ty. If the terminal wraps around to the beginning
3-11'

~ERMCAP

(5)

XENIX Programmer's Manual

TERMCAP (5)

of the next line when it reaches the right margin, then it
should have the am capability. If the terminal can clear
its screen, then this is given by the cl string capability.
If the terminal can backspace, then it should have the bs
capability, unless a backspace is accomplished by a character other than AH (ugh) in which case you should give this
character as the bc string capability. If it overstrikes
(rather than clearing a position when a character is struck
over) then it should have the os capability.
A very important point here is that the local cursor motions
encoded in termcap are undefined at the left and top edges
of a CRT term~nal. The editor will never attempt to backspace around the left edge, nor will it attempt to go up
locally off the top. The editor assumes that feeding off
the bottom of the screen will cause the screen to scroll up,
and the am capability tells whether the cursor sticks at the
right edge of the screen. If the terminal has switch
selectable automatic margins, the termcap file usually
assumes that this is on, i.e. am.
These capabilities suffice to describe hardcopy and glasstty terminals. Thus the model 33 teletype is described as
t3133Itty33:coi72:os
while the Lear Siegler ADM-3 is described as
clladm3131lsi

adm3:am:bs:cl=~Z:lii24:coi80

Cursor addressing
Cursor addressing in the terminal is described by a cm
string capability, with printf(3s) like escapes %x in it.
These sUbstitute to encodings of the current line or column
position, while other characters are passed through
unchanged. If the cm string is thought of as being a function, then its arguments are the line and then the column to
which motion is desired, and the % encodings have the following meanings:
%d
%2
%3

as in printf, 0 origin
like %2d
like %3d
like %c
%.
%+x adds X to value, then %.
%>xy if value > x adds y, no output.
%r
reverses order of line and column, no output
%i
increments line/column (for 1 origin)
%%
gives a single %
%n
exclusive or row and column with 0140 (DM2500)
%B
BCD (16* (x/10» + (x%10), no output.
3-111

TERMCAP(5)

XENIX Programmer's Manual

%D

TERM CAP (5)

Reverse coding (x-2*(x%16», no output. (Delta Data).

Consider the HP2645, which, to get to row 3 and column 12,
needs to be sent \E&a12c03Y padded for 6 milliseconds. Note
that the order of the rows and columns is inverted here, and
that the row and column are printed as two digits. Thus its
cm capability is cm=6\E&%r%2c%2Y. The Microterm ACT-IV
needs the current row and column sent preceded by a AT, with
the row and column simply encoded in binary, cm=~T%.% ••
Terminals which use %. need to be able to backspace the cursor Cbs or bc}, and to move the cursor up one line on the
screen (up introduced below). This is necessary because it
is not always safe to transmit \t, \n AD and \r, as the system may change or discard them.
A final example is the LSI ADM-3a, which uses row and column
offset by a blank character, thus cm=\E=%+ %+ •
Cursor motions
If the terminal can move the cursor one position to the
right, leaving the character at the current position
unchanged, then this sequence should be given as nd (nondestructive space). If it can move the cursor up a line on
the screen in the same column, this should be given as up.
If the terminal has no cursor addressing capability, but can
home the cursor (to very upper left corner of screen) then
this can be given as hOi similarly a fast way of getting to
the lower left hand corner can be given as 11; this may
involve going up with up from the home position, but the
editor will never do this itself (unless 11 does) because it
makes no assumption about the effect of moving up from the
home position.
Area clears
If the terminal can clear from the current position to the
end of the line, leaving the cursor where it is, this should
be given as ce. If the terminal can clear from the current
position to the end of the display, then this should be
given as cd. The editor only uses cd from the first column
of a line.
Insert/delete line
If the terminal can open a new blank line before the line
where the cursor is, this should be given as al: this is
done only from the first position of a line. The cursor
must then appear on the newly blank line. If the terminal
can delete the line which the cursor is on, then this should
be given as dl: this is done only from the first position on
the line to be deleted. If the terminal can scroll the
3-182

rERMCAP(5)

XENIX Programmer's Manual

TERMCAP(5)

screen backwards, then this can be given as sb, but just al
suffices. If the terminal can retain display memory above
then the da capability should be given~ if display memory
can be retained below then db should be given. These let
the editor understand that deleting a line on the screen may
bring non-blank lines up from below or that scrolling back
with sb may bring down non-blank lines.
Insert/delete character
There are two basic kinds of intelligent terminals with
respect to insert/delete character which can be described
using termcap. The most common insert/delete character
operations affect only the characters on the current line
and shift characters off the end of the line rigidly. Other
terminals, such as the Concept 199 and the Perkin Elmer Owl,
make a distinction between typed and untyped blanks on the
screen, shifting upon an insert or delete only to an untyped
blank on the screen which is either eliminated, or expanded
to two untyped blanks. You can find out which kind of terminal you have by clearing the screen and then typing text
separated by cursor motions. Type abc
def using local
cursor motions (not spaces) between the abc and the def.
Then position the cursor before the abc and put the terminal
in insert mode. If typing characters causes the rest of the
line to shift rigidly and characters to falloff the end,
then your terminal does not distinguish between blanks and
untyped positions. If the abc shifts over to the def which
then move together around the end of the current line and
onto the next as you insert, you have the second type of
terminal, and should give the capability in, which stands
for insert null. If your terminal does something different
and unusual then you may have to modify the editor to get it
to use the insert mode your terminal defines. We have seen
no terminals which have an insert mode not not falling into
one of these two classes.
The editor can handle both terminals which have an insert
mOde, and terminals which send a simple sequence to open a
blank position on the current line. Give as im the sequence
to get into insert mode, or give it an empty value if your
terminal uses a sequence to insert a blank position. Give
as ei the sequence to leave insert mode (give this, with an
empty value also if you gave im so). Now give as ic any
sequence needed to be sent just before sending the character
to be inserted. Most terminals with a true insert mode will
not give ic, terminals which send a sequence to open a
screen position should give it here. (Insert mode is
preferable to the sequence to open a position on the screen
if your terminal has both.) If post insert padding is
needed, give this as a number of milliseconds in ip (a
string option). Any other sequence which may need to be
3-183

TERMCAP(S)

XENIX Programmer's Manual

TERMCAP(S)

sent atter an insert of a single character may also be given
in ip.
It is occasionally necessary to move around while in insert
mode to delete characters on the same line (e.g. if there is
a tab after the insertion position). If your terminal
allows motion while in insert mode you can give the capability mi to speed up inserting in this case. Omitting mi will
affect only speed.
Some terminals (notably Datamedia's)
must not have mi because of the way their insert mode works.
Finally, you can specify delete mode by giving dm and ed to
enter and exit delete mode, and dc to delete a single character while in delete mode.
Highlighting, underlining, and visible bells
If your terminal has sequences to enter and exit standout
mode these can be given as so and se respectively. If there
are several flavors of standout mode (such as inverse video,
blinking, or underlining - half bright is not usually an
acceptable standout mode unless the terminal is in inverse
video mode constantly) the preferred mode is inverse video
by itself. If the code to change into or out of standout
mode leaves one or even two blank spaces on the screen, as
the TVI 912 and Teleray 1961 do, this is acceptable, and
although it may confuse some programs slightly, it can't be
helped.
Codes to begin underlining and end underlining can be given
as us and ue respectively. If the terminal has a code to
underline the current character and move the cursor one
space to the right, such as the Microterm Mime, this can be
given as uc. (If the underline code does not move the cursor to the right, give the code followed by a nondestructive
space.)
If the terminal has a way of flashing the screen to indicate
an error quietly (a bell replacement) then this can be given
as vb; it must not move the cursor. If the terminal should
be placed in a different mode during open and visual modes
of ~, this can be given as vs and ve, sent at the start and
end of these modes respectively. These can be used to
change, e.g., from a underline to a block cursor and back.
If the terminal needs to be in a special mode when running a
program that addresses the cursor, the codes to enter and
exit this mode can be given as ti and tee This arises, for
example, from terminals like the Concept with more than one
page of memory. If the terminal has only memory relative
cursor addressing and not screen relative cursor addressing,
a one screen-sized window must be fixed into the terminal
3-184

rERMCAP (5)

XENIX Programmer's Manual

TERMCAP(5)

for cursor addressing to work properly.
If your terminal correctly generates underlined characters
(w~th no special codes needed) even though it does not overstrike, then you should give the capability ul. If overstrikes are erasable with a blank, then this should be indicated by giving eo.
Keypad
If the terminal has a keypad that transmits codes when the
keys are pressed, this information can be given. Note that
it is not possible to handle terminals where the keypad only
wor ks in local (th is applies, for example, to the unshifted
HP 2621 keys). If the keypad can be set to transmit or not
transmit, give these codes as ks and ke. Otherwise the
keypad is assumed to always transmit. The codes sent by the
left arrow, right arrow, up arrow, down arrow, and home keys
can be given as kl, kr, ku, kd, and kh respectively. If
there are function keys such as f9, fl, ••• , f9, the codes
they send can be given as k9, kl, ••• , k9. If these keys
have labels other than the default f9 through f9, the labels
can be given as 19, 11, ••• , 19. If there are other keys
that transmit the same code as the terminal expects for the
corresponding function, such as clear screen, the termcap 2
letter codes can be given in the ko capability, for example,
:ko=cl,ll,sf,sb:, which says that the terminal has clear,
home down, scroll down, and scroll up keys that transmit the
same thing as the cl, 11, sf, and sb entries.
The ma entry is also used to indicate arrow keys on terminals which have single character arrow keys. It is obsolete
but still in use in version 2 of vi, which must be run on
some minicomputers due to memory limitations. This field is
redundant with kl, kr, ku, kd, and kh. It consists of
groups of two characters. In each group, the first character is what an arrow key sends, the second character is the
corresponding vi command. These commands are h for kl, j
for kd, k for ku, 1 for kr, and H for kh. For example, the
mime would be :ma=~KjRZkAXl: indicating arrow keys left
(A H), down (A K), up (A Z), and right (AX). (There is no home
key on the mime.)
Miscellaneous
If the terminal requires other than a null (zero) character
as a pad, then this can be given as pc.
If tabs on the terminal require padding, or if the terminal
uses a character other than AI to tab, then this can be
given as ta.

3-115

TERMCAP (5)

XENIX Programmer's Manual

TERM CAP (5)

Hazeltine terminals, which don't allow ,-, characters to be
printed should indicate hz. Datamedia terminals, which echo
carriage-return linefeed for carriage return and then ignore
a following linefeed should indicate nc. Early Concept terminals, which ignore a linefeed immediately after an am
wrap, should indicate xn. If an erase-eol is required to
get rid of standout (instead of merely writing on top of
it), xs should be given. Teleray terminals, where tabs turn
all characters moved over to blanks, should indicate xt.
Other specific terminal problems may be corrected by adding
more capabilities of the form xz.
Other capabilities include is, an initialization string for
the terminal, and if, the name of a file containing long
initialization strings. These strings are expected to properly clear and then set the tabs on the terminal, if the
terminal has settable tabs. If both are given, is will be
printed before if. This is useful where if is
/~lib/tabset/~ but is clears the tabs first.
Similar Terminals
If there are two very similar terminals, one can be defined
as being just like the other with certain exceptions. The
string capability tc can be given with the name of the similar terminal. This capability must be .J.a.Q.t and the combi.ned
length of the two entries must not exceed 1924. Since termlib routines search the entry from left to right, and since
the tc capability is replaced by the corresponding entry,
the capabilities given at the left override the ones in the
similar terminal. A capability can be canceled with xx@
where xx is the capability. For example, the entry
hn/262lnl:ks@:ke@:tc=262l:
defines a 262lnl that does not have the ks or ke capabilities, and hence does not turn on the function key labels
when in visual mode. This is useful for different modes for
a terminal, or for different· user preferences.
FILES
/etc/termcap

file containing terminal descriptions

SEE ALSO
ex (1), curses (3), termcap (3), tset (1), vi (1), ul (1), more (1)
AUTHOR
William Joy
Mark Horton added underlining and keypad support
BUGS
~

allows only 256 characters for string capabilities, and
3-116

TERMCAP(S)

TERMCAP(S)

XENIX Programmer's Manual

the routines in termcap(~) do not check for overflow of this
buffer. The total length of a single entry (excluding only
escaped newlines) may not exceed 1024.
The ma, vs, and ve entries are specific to the

~

program.

Not all programs support all entries. There are entries
that are not supported by any program.

3-117

1"i't'!'t PH ( 5 )

NAME

ttytype

'HtftPB(5)

- data base defining terminal type; used for
associating terminals with serial ports

DESCRIPTION
The ttytype data base is used to associate a manufacturer's
terminal with the different serial ports on the system.
Each line contains the name of a terminal, a tab character,
and then the XENIX device entry for the serial ports
associated with that terminal. The terminal name must
correspond to an entry in /etc/termcap.
Making an entry in the ttytype file for your terminals
allows the system to make maximum use of terminal features
for certain system facilities that use full screen
capabilities. Among these programs are vi(l), bsh(l), and
ua (1) •
FILES

/etc/ttytype

SEE ALSO
vi(l), bsh(l), ua(l), termcap(5)
USAGE

A typical line in the ttytype file might look like "dumb
/dev/tty3" or "wyse /dev/tty5." The first says that serial
port 3 is connected to a terminal described in /etc/termcap
as having no special characteristics such as cursor movement. The second entry tells XENIX that serial port 5 is
connected to a terminal manufactured by Wyse Technology that
is described in termcap under the name "wyse." The terminal
name is the name found between the first and second vertical
bars of the appropriate entry in /etc/termcap.

3-118

Appendix AI
8UIIBkIC

PO~,

C,

AlII)

pOftBAll

77

The following information is for reference only.
This
information on the internal .formats used for numeric representation is not necessary for general use of the C language or
Fortran 77.
It can be useful when examining actual memory
contents or doing other specialized system programming work.
The same formats are used by both languages.
For more information on Fortran 77, see UJlIX Progra•• erls
Volu.e 2B, A Portab~e Fortran 77 ea.piler.
Fortran 77 Flies are opened at end-of-file.
statement to get to the beginning of the file.

A-~

.anDa~,

Use the REWIND

IftBGBR

POBIIA~S

Integers and "short integers" are 16 bits in length.
"Long
integers" are 32 bits. For both sizes, the leftmost bit is a
sign bit and the other 15 or 31 bits are magnitude. The sign is
zero for positive, one for negative. Negative numbers are in
twos-complement form.
The range of values is as follows:
Sign and 15 bits

-32,768 to 32,767

Sign and 31 bits

-2,147,483,648 to 2,147,483,647

A-2

PLOATIBG-POIft POlUlATS

Single precision floating point is 32 bits in length, double is
64. The leftmost eight bits consist of an exponent in excess 80
notation. RExcess 80 R means that the hexadecimal values from 80
to FF are positive exponents, corresponding to 0 through 7F.
Values less than 80 are negative exponents; 7F through 0 cor respond to -1 through -7E.
The remaining 24 or 56 bits consist of a leading sign bit and
magnitude values. Magnitudes are normalized. RNormalized" means
that the representation of magnitude and exponent is adjusted so
that each magnitude value can be thought of as starting with
.lnnn ••••
For example, the value of 101, decimal 5, would be .101 with an
exponent of 3. The leftmost digit of magnitude does not need to
be represented, because it is always 1 except for the special
case of a value of zero. Therefore, the leftmost magnitude bit
is not stored but is implied. It is referred to as the "hidden
bit. R
Example:
The value 15.25, decimal.

In binary, this is 1111.01

(In binary, .1 = .5 decimal; .01 = .25, etc. Moving to the right
of the pOint halves the value at each move, just as moving to the
left of the point doubles the base 2 value.)
So, 1111.01 represents 15.25 decimal. Normalizing our binary
value, we have .111101 with an exponent of 4.
The exponent
becomes 84 in excess 80 notation, or 1000 0100 in binary. The
sign bit is zero (positive), and the magnitude is 11101000 •••
with as many trailing zeros as needed. Notice that the leading
R.l" has disappeared. It is the unnecessary Rhidden bit." The
binary and hexadecimal values are shown below.
1000 0100 0111 0100 0000 0000 0000 0000
8
4 s 7
4
0
0
0
0
The example is single-precision. Double precision, in this case,
would be the same with eight bytes (32 bits) of trailing zeros.
Other examples:
The fractional decimal value .625. In binary, this is .101; that
is, .5 plus .125. The value is normalized as it is, the exponent
is 0, the sign is positive, 0.
1000 0000 0010 0000 • • •
80s 2
0 •••

A-3

Negative 5.
complement,
negative sign
the sign bit,
excess 8B, -2

In binary, 5 is IB1.
Before taking the twoswe supply a leading zero which will become the
bit: BIB1. ~he twos-complement is IBll. Removing
Bll. Normalizing, .11BB with the exponent-2. In
is 7E. Resul t:

Blll 1119 119B BBBB •••
7
Ese
B •••
Zero, the exception.

This is an all zero value.

B9BB 9BS9 BB9B 9B99 • • •
B
B
B
B •••
All zeros can be thought of as zero by convention. Otherwise, it
would represent the smallest positive number possible in the
scheme.
Too many intrinsic functions, or too many logical operators in
the same statement can cause the error:
"Floating-point
exception." It means that the expression is too complicated and
should be split into several statements.

A-4

VALUES IN IIBIIORY

As with other values in 8~86 memory, floating point values are
stored "back-words." The least signficant 16-bit word is stored
first, then the next, and so forth.
If the single-precision
value 8474~~~~ is stored at location x, it will show as follows
when displaying memory contents:
x
x + 2

~~~~

8474

However, long integers are stored in order. The long integer
with a hexadecimal value of 128A34BF will show as:

x

x + 2

l28A
34BF

A-5

Appendix B:
SAULB r.xft OP ZBIIIX DBVBLOPIIBIl.r

The following is a sample listing of the
provided in a full XENIX Development System.

SYS~ O'.rILI~IBS

typical

utilities

You can obtain a list of your Xenix operating system's
by entering:

utilities

cd / (cr>

18 -PCRllpr(cr>
LIft OP XBBXX

~LI~IBS

bin
boot
boot.fd
boot.fdhd

dev
etc
fd
load.hd

install
lib
load.hd
lost+found

priboot
pribootfd
tmp
usr

xenix
xenix.fd

./bin:
ac
adb
ar
arcv
as
at
awk

df
diff
du
dump
dumpdir
echo
ed

look
1pr
1s
m4
mail
make
man

refer
restor
rev
rm
rmai1
rmdir
sa

test
time
tk
touch
tp
tr
troff

B-1

basename
bc
bsh
cal
calendar
cat
cb
cc
checkeq
chgrp
chmod
chown
clri
cmp
col
comm
cp
crypt
csh
cu
date
dc
dcheck
dd
deroff

edit
esrep
enroll
eqn
ex
expr
f77
false
fgrep
file
find
flagbad
fsck
graph
grep
icheck
join
kill
I
ld
learn
lex
lint
In
login

mesg
mkdir
mntchk
multiuser
mv
ncheck
ndump
neqn
newgrp
nice
nm
nroff
od
osh
passwd
pr
prep
prof
ps
ptx
pwd
quot
random
ranlib
ratfor

sed
sh
size
sleep
sort
sp
spell
spline
split
strip
struct
stty
su
sum
sync
t300
t300s
t450
tabs
tail
tar
tbl
tc
tee
tek

./dev:
altosnet
console
cua0
cul0
ct**
ct0*
ether
fd0
fd0.swap
fdl

hd0
hd0.boot
hd0.layout
hd0.roc0
hd0.secmap
hd0.spares
hd0.track0
hd0a
hd0b
kmem

lp
mem
nct**
nrct**
null
rct**
rfd0
rfdl
rhd0
rhd0.boot

rhd0.layout
rhd0.roc0
rhd0.secmap
rhd0.spares
rhd0.track0
rhd0a
rhd0b
root
rroot
rswap

swap
tar
tty
tty2
tty3
tty4
tty5
tty6
tty7
tty8

./etc:
accton
asktime
checklist
cron
ddate

getty
group
haltsys
inir
init

menusys
mknod
motd
mount
mtab

newuser
rc
shutdown
systemid
termcap

ttys
umou
upda
utmp
wall

dial-login
dmesg

menusys.bin
mkfs

passwd
ttytype

./etc/newuser:
./fd:
*ACS 8600 only
**58b only
B-2

true
tsorj
tty
uniq
unitl
uucp
uulo~

uux

v7gr~

v7loc
v7ls
v7ps
vi
vplo1
vpr
who
wrib
xget
xsenc
yacc
yes

./lib:
c0
cl
c2
cpp
crt0.o

libt4014.a
libt450.a
libtermlib,
libunet.a
libvt0.a

f77cl
f77c2
f77crt0.o
f77passl
libF77.a

libI77.a
libc.a
libcurses.a
libdbm.a
libln.a

libm.a
libmp.a
libplot.a
libt300.a
libt300s.a

./usr:
adm
altos
bin

dict
games
include

lib
preserve
spool

src
sys
tmp

unix
user

./usr/adm:
acct
messages

mssbuf
savacct

usracct
wtmp

l-lail
apropos
chessclock
chfn
chsh
ckdir
clear
clock
copy
ctags
cxref
daytime
decode
diff3
disest
disable

double
enable
error
expand
fcopy
ffmt
finser
fleece
fmt
fold
format
from
setNAME
sets
head
iul

last
layout
leave
lock
lookbib
lorder
makewhatis
map
mkstr
more
msgs
nohup
num
page
pcc
pconfig

plot
print
printenv
reset
script
sddate
see
sendnet
settime
sizefs
soelim
ssp
strings
tod
tra
tset

ua
ucp
ul
users
uudecode
uuencode
uusend
uversion
v7wc
w
wc
whatis
whereis
whoami
whom
xstr

./usr/dict:
hlista
hlistb

hstop
papers

spellhist
words

./lost+found:
./tmp:

./usr/altos:
qa.text
./usr/bin:

./usr/dict/papers:
Ind.ia
Ind.ib

Ind.ic

Rv7man

runinv

./usr/games:
arithmetic
backgammon
banner
craps

master
number
quiz
quiz.k

random
snake
snscore
ttt

wump

fish
fortune
hangman
lib

B-3

./usr/games/lib:
fortunes
mmhow

snake. log

snakerawscores

./usr/games/quiz.k:
africa
chinese
collectives
america
areas
ed
arith
elements
europe
asia
babies
greek
bard
inca

index
latin
locomotive
midearth
morse
murders
poetry

posneg
pres
province
seq-easy
seq-hard
sexes
sov

spell
state
trek
ucc

./usr/include:
a.out.h
ar.h
assert.h
core.h
ctype.h
curses.h
dk.h
dumprestor.h

olda.out.h
olddump.h
pack •.h
psout.h
pwd.h
regexp.h
saio.h
setjmp.h

setty.h
signal.h
stddef.h
stdio.h
symbol.h
sys
sys.s
sysexits.h

time.t
tp-def
utmp.t
vararC1
whoamj
xout8E

pr.oc.h
res.h
sc.h
sites.h
stat.h
systm.h
text.h

timeb.
times.
tty.h
types.
user .1

llib-port
lpd
me
menusys
more. help
refer
struct

tabset
term
tmac
uucp
yaccpc

errno.h
execargs.h
grp.h
ident.h
local
math.h
mp.h
mtab.h

./usr/include/local:
layout.h
sspare.h

uparm.h

./usr/includes/sys:
acct.h
file.h
buf.h
filsys.h
callo.h
ino.h
chars.h
i-node.h
conf.h
ioctl.h
dir.h
locking.h
fblk.h
map.h

mount.h
mpx.h
mx.h
param.h
pk.h
pk.p
prim.h

./usr/lib:
Mail.help
Mail.help.atrun
bsh
bsh.messages
calendar
cign

crontab
crontab.noUNET
diff3
ex2.l3reserve
ex2.l3recover
ex2 .. l3strings
ffmt

./usr/lib/font:
ftB
ftCE
ftCS
ftBC
ftCl
ftCW
ftC
ftCK
ftG
./usr/lib/learn:
C.a
Xinfo
Linfo
editor.a
READ....;ME
eqn.a

font
learn
lex
lintl
lint2
llib-lc
llib-lm

ftGl
ftGM
ftGR

ftl
ftL
ftLl
files .a
lcount
macros.a

./usr/lib/lex:
ncform
B-4

ftPA
ftPB
ftPl

ftR
ftS
ftSB

ftSl
ftSM
ftUD

makefile
morefiles.a
tee

ft~

./usr/lib/me:
acm.me
chars.me
deltext.me

index.me
local.me
nUll.me

revisions
sh.me
tbl.me

thesis.mt

./usr/lib/menusys:
Backup
Dir
Backup?
Dir?
Commands?
Execute

Execute?
Help
Help?

Mail
Mail?
Start

Start?
SysAdmin
SysAdmin'

./usr/lib/refer:
hunt
inv

mkey

eqn.me
float.me
footnote.me

./usr/lib/struct:
beautify
structure
./usr/lib/tabset:
beehive
std
diablo
teleray

vtlBB
xeroxl72B

./usr/lib/term:
tab3BB
tab3B8s-l2
tab3BB-l2
tab37
tab38Bs
tab458

tab458-l2
tab45B-l2-8
tab832

tabal
tablp
tabn3BB

./usr/lib/tmac:
tmac.an
tmac.help
tmac.e
tmac.r

tmac.s
tmac.scover

tmac.sdisp
tmac.skeep

./usr/lib/uucp:
L-devices
L.sys
L-dialcodes
USERFILE

uucico
uuclean

uuxqt

tunetmail
unetmail

uucp
uucppublic

./usr/preserve:
./usr/spool:
at
lpd

mail
msgs

./usr/spool/at:
lasttimedone
past
./usr/spool/at/past:
./usr/spool/lpd:
./user/spool/mail:
./usr/spool/msgs:
bounds
./usr/spool/uucp:
./usr/spool/uucppublic:

8-5

tmac. sre:

./usr/src:
cmd
./usr/srs/cmd:
decode.c
./usr/sys:
./usr/tmp:
./usr/unix:
./usr/user:

Appendix

c:

TRARSFERRIBG FILES BEWED ACS 8611 AIm ALms 586
OR omBR COIIPMBR SYSBIIS (AS!1fCBBOIIOOS COIlIiOllICA~IORS)

This appendix describes how to transfer files between the ACS
8699 and the Altos 586 XENIX computer systems, or betwe~n two
Altos XENIX computer systems (586 or 8699), or between your Altos
computer system and other computer systems which support
asynchronous (serial) communications.
This appendix also
describes how to use modems with your Altos XENIX systems.
The ~ (call UNIX) and uucp (UNIX-to-UNIX copy) facilities are
standard UNIX programs that enable you to transfer files and
execute commands on remote systems. The ~ program, which is
easier to use than the uUQP program but not as powerful, should
be used to communicate with non-UNIX computer systems. Because
of user difficulty in implementing uUQP, Altos has developed a
File Transfer Utility for Xenix-to-Xenix transfer (ftp).
Refer
to Appendix H of the Introduction ~ XENIX manual for step-bystep instructions for running~.
Note that only ACS 8699
versions 2.2d and Altos 586 versions 2.3 and higher have the
XENIX ~ utility.
If you have an earlier version, the uucp
program should be used.

C-l

PSIJIG CD· PACILI"

The ~~ program can be used for foreground asynchronous
communications with almost any other computer system. Under
light to medium system loads, communication is possible at 12BB
baud. Under heavy loads, 6BB baud or 3BB baud is the maximum
data rate. Facilities are provided for executing commands on the
remote system, and transferring files to or from the remote
system.
To use cu, follow these steps:
1.

Determine the serial port to be used for communication. Any
port not utilized by a terminal or a printer can be used,
for purposes of demonstration, we will assume that port 5 is
available. See Figure C-l for Setup.

ACS8600
OR
ACSS86

PORTS

NULL MODEM CABLE
ANOTHER
COMPUTER

ANY
PORT

-

CONSOLE

Figure C-l.

2.

Cu Facility Setup

Become the super-user (using the su command), then execute:
# di8~le /dev/tty5



This command will prevent a terminal from using port 5.
3.

Execute the command:
i en -t -8 1211 -1 /dev/tty5 -a /dev/nnll



The cu program will attempt to establish a connection with
the other computer, using serial port 5. The speed of the
conection will be 12BrfJ baud (cu will not function properly
at baud rates greater than 12BrfJ baud).
The following
message should be displayed after the connection has been
successfully established:
C-2

Connected
All characters typed from this point onwards will be
processed by the remote system, and all output from the
remote system will be displayed on the screen. If a line
begins with the tilde character (-), it will be processed by
the local UNIX system, and will NOT be passed to the remote
system.
The following commands are available when
communicating with a UNIX or a non-UNIX remote system:
•

Terminate the connection •

-

C-8

PBBPAlUBG '!BE

CORPIGORA~IOR

PILBS

The uucp program comes ready to use.
It does need, however,
certain information to establish the connection between the 586
and 86~~ systems. You provide this information by adding entries
to several files on each system. The follow ing table gives the
steps needed for ~ system to prepare the files:
TASK:

~

EFFECTED:

Assign a system name
to the system

/etc/systemid

Define the communications
line characteristics

/usr/lib/uucp/L-devices

Give information needed
to login to the other
system

/usr/lib/uucp/L.sys

Specify file accessibility

/usr/lib/uucp/USERFILE

Unless you have special requirements, you probably can edit the
files on both systems in a few minutes. To make the task simpler,
this chapter gives recommended entries.
Some versions of XENIX
that come with the 586 already have the recommended entries
placed in the files.
In this case, you don't have to add
anything to the 586 files, but must still modify the 86~~ files.
You can use the XENIX editor to check the contents of the 586's
files to see if you must modify them.
In case you have some special requirements, this document also
describes how to prepare your own entries.
You'll use one of the XENIX editors to add the entries to the
files. To edit the files, you must be a XENIX superuser (root).
You can become a superuser either by logging in as root or by
using the ~ command.

Recommended Entries
You can use a set of standard entries to set up the 586's files
if your requirements meet these assumptions:
1.

You must assign the system name Altos86 to the 86~~ system
and the name AltosS86 to the 586 system. If you don't, you
must give different system names in the /etc/systemid,
/usr/lib/uucp/L.SYS, and /usr/lib/uucp/USERFILE files.

2.

The line connecting the two systems must connect into port
tty5 on the each system. If it doesn't, you must give
different port names in the /usr/lib/uucp/L-devices and
/usr/lib/uucp/L.Sys files.
C-9

3.

The connection between the two systems must be direct. That
is, it can't go through a telephone system. If it isn't a
direct connection, you must give a different baud rate in
the /usr/lib/uucp/L-devices and /usr/lib/uucp/L.SYS files.

If your requirements don't meet these assumptions, read the
instructions in the chapter nIf You Have Special Requirements. n
They tell you how to tailor the file entries to yor requirements.
If your requirements do match these assumptions, copy these
entries into the files shown if they are not already there:
.!D.B DB 586;

ENTRY

~

/etc/systemid

Altos586

/usr/lib/uucp/L-devices

tty5 0 9600

/usr/lib/uucp/L.sys

Altos86 Any ttys 9600 ttys ogin:-AMogin:-~M-ogin: uucp

/usr/lib/uucp/USERFILE

root, /
, /usr /tmp

/usr/lib/crontab

0 0-23 * * * /usr/lib/uucico -rl -s
Altos 86
o 4 * * * /usr/lib/uucp/uuclean -pTM

The entry for the /usr/lib/uucp/L.sys file must have the carriage
returns (AM) embedded as shown. See the UNIX manuals for
information on how to embed carriage returns within a character
string using .your editor •
.lOB DB

86,n,;

~

EN~RY

/etc/systemid

Altos86

/usr/lib/uucp/L-devices

ttys 0 9600

/usr/lib/uucp/L"Sys

Altoss86 Never ttys 9600 ttys

/usr/lib/uucp/USERFILE

root, /
, /usr /tmp

/usr/lib/crontab

o

4

* * * /usr/lib/uucp/uuclean -pTM

If these recommended entries meet your needs, skip the next
chapter and go to the chapter nDisabling and Enabling the TTY
ports. n
Refer to Table C-l for a summary of what data should be in the
appropriate 586 and 8600 files to support the uucp package.

C-li

~able

C-l.

Su..ary of Pile BDtries Required for 586 and 86.1

Files on the 586:
/etc/systemid:
AltosS86
/usr/lib/uucp/L-devices:
ttyS 0 9688
/usr/lib/uucp/L.sys:
Altos86 Any ttyS 9688 ttyS ogin:-... M-ogin: ...... M-ogin:uucp
/usr/lib/uucp/USERFILE:
root, /
, /usr /tmp
/usr/lib/crontab:

o

8

0-23 * * * /usr/lib/uucp/uucico -rl -sAltos86
4 * * * /usr/lib/uucp/uuclean -pTM

Files on the 8611:
/etc/systemid:
Altos86
/usr/lib/uucp/L-devices:
ttyS 0 9688
/usr/lib/uucp/L.sys:
Altos586 Never

ttyS 9688 ttyS

/usr/lib/uucp/USERFILE:
root, /
, /usr /tmp
/usr/lib/crontab:
8 4 * * * /usr/lib/uucp/uuclean

C-ll

-pTM

IF YOU HAVE SPECIAL REQUIREMBftS

If you can't use the suggested entries, the following subchapters
give instructions on prepar ing each file. This chapter is
organized as follows:
Assigning System Names
Defining the Communications Line Characteristics
Supplying the Login Information
Defining the File Accessibility
Assigning the System Names

Uucp needs a unique name for each system. The names identi fy each
system in commands and during the login. To assign a system
name, use an editor to add a line to the file /etc/syste.id.
This line should contain a single word entry that can be any
legal UNIX name. The name cannot be the same name as any other
system name that this system will communicate with through uucp.
Defining the Ca.munications Line Characteristics

Uucp needs certain information about the communications line it
will use. To· provide this information, edit the file
/usr/lib/uucp/L-devices on each system to add a line of this
format:
format for both systems:
port call-unit baud-rate
where:
port

names the port to be used.

call-unit

Enter a " (zero) for this field.

baud-rate

gives the baud rate of the line. If the
systems are directly connected, the baud rate
is 9600.

This entry:
tty5 0 9600
states that the line connects through port tty5 and has a baud
rat e 0 f 96 00.
If the communications line can operate at more than one baud
rate, you must include a separate entry for each baud rate as
done here:
C-12

tty5 0 300
tty5 0 600
Supplying the Login Information

Uucp needs certain information to establish a connection between
the systems. To provide this information, edit the file
/usr/lib/uDCp/L.Sys ,to add a line of this format:
format for the 586 system:
system-name time port baud-rate phone login
format for the 8600 system:
system-name time port baud-rate phone
where:
system-name

gives the name assigned to the other system
in ita /etc/systemid file.

time

gives the times that the uucp program is to
try to login to the other system. For 586
system, state Any. This has uucp establish
the connection any time you call it. For the
8600 system, state Rever. This prevents the
8600 from ever making the connection.
names the port through which the connection
is made to the other system. The port name
must match the port name given in the
system's /usr/lib/uucp/L-devices file.

port

baud-rate

gives the baud rate that is to be used. The
baud rate must match one of the baud rates
given for the port in the system's
/usr/lib/uucp/L-devices file.

phone

must be the same name given for the port
field of this entry.

login

for the 586 only, consists of a series of
fields telling uucp how to login to the 8600
system. The entry should be:
ogin:-AM-ogin:-AM-ogin: uucp
The AM characters in the string are carriage
returns (CONTROL-M) embedded with the string.
These carriage returns must appear within the
file as shown. See the UNIX documentation
for information on how to embed control
characters within strings using your editor.

C-l3

Defining the File Accessibility

Uucp needs permission to access files on either system. To
provide permission, edit the file /usr/lib/uucp/USERFILE on each
system to lines of this format:
format for both systems:
root,
I
, lusr Itmp

where:
root,

,

I

lusr Itmp

gives the superuser on either system access
to any file in any directory through uucp.
gives any non-superuser on either system
access to any file in any daughter directory
of the lusr Itmp directories through uucp.

C-14

DXSABLIS &lID BllABLDG BB ft'r

PO~

Before testing the uucp network and copying files using uucp,
the following steps must be performed:
1.

On the 586, enter:
disable /dev/tty5 (CIl>

Substitute the name of the port you're using in this command
if the connection to the 8688 isn't through port tty5.
2.

On the 8688, enter:
enable /dev/tty5 (CR)

If necessary, substitute the name of the port you're using
in this command.

Before you begin copying files from the 8600 to the 586, you
should test the network by copying a single file. If the copy
succeeds, you can start copying over the bulk of your files. If
it doesn't succeed, you must check your connection and your
configuration files.
The test copies the file /etc/passwd from the 586 to the the file
/tmp/passwd on the 8600. To conduct the test, follow these steps:
1.

Boot and become a superuser (root) 'on both systems.

2.

On the 586, enter:

I

uucp /etc/passvd

Altos86\1/tIIp/passvd 

Substitute the system name you gave the 8600 in this command
if you didn't name it Altos8600 in its /etc/systemid file.
3.

The copy takes about one minute to complete.
time, on the 8600, enter:

After that

cat /tmp/passwd 

If cat shows that the file /tmp/passwd contains the contents
of the file /etc/passwd on the 586, then the uucp copy
worked. If the /tmp/passwd file doesn't exist or is empty,
then the copy didn't work.
If the copy works, then go on to the chapter "Copying Files Using
Uucp." If the copy didn't work, check the connection between the
two systems.
Once you're sure that the cable is prope rly
connected (and that nothing is wrong with the cable) try the
steps above again. If they still don't work, check the contents
of the configuration files you prepared. Once you're sure that
they are correct, again try the copy.
If you still have problems, use the informa tion below to try to
debug your setup. These steps describe what happens when uucp
performs a copy. By looking at the files mentioned, you should
be able to determine where the problem lies. Then turn to the
OBXX progra••:er's Manual. It contains more information on uucp
that should be helpful for solving your problem.
When uucp performs the copy, these steps should occur:
1.

The uucp program creates two files in the 586's
/usr/spool/uucp directory. The first, D.Altos8600n0001,
contains a copy of the file /etc/passwd. The second file,
C.Altos8600n0001, contains control information. (The names
of these files will be different if you didn't assign the
name Altos86 to the 8600J

C-l6

Uucp also places the message, "QUEUED (C.Altos8600n090l)" in
the file /usr/spool/uucp/LOGFILE on the 586.
At the end of this step, the program uucp stops execution.
If a file /usr/spool/uucp/STST* exists on the 586, remove it
before retrying the procedure.
2.

The program uucico then begins execution. Its first task is
to examine the 586 file /usr/lib/uucp/L.SYS. The entry in
the file tells uucico to immediately login to the 8600. The
following steps occur as part of the login:
Uucico sends a carriage return to the 8600, which
should respond with a login message. Uucico then logs
in on the 8600.
The uucico program on the 586 executes the uucico
program on the 8600.
The uucico program on the 586 creates two temporary
files in the 586's /usr/spool/uucp directory that are
prefixed with "LCR".
Uucico on the 586 places the message "SUCCEEDED (call
to Altos86)" in the 586 file /usr/spool/uucp/LOGFILE.

3.

The uucico program on the 586 checks its spool directory and
learns that it should transfer a file -from the 586 to the
8600.
The message "REQUEST (S /etc/passwd /tmp/passwd
username) is placed in the /usr/spool/uucp/LOGFILE files on
both systems.

4.

Uucico on the 586 transfers the file D.Altos8600nOOOl, which
is a copy of /etc/passwd, from the 586 to the 8600. The
uucico program on the 8600 places the file in the directory
/usr/spool/uucp. It then moves the file to the file
/tmp/passwd.

5.

The message "REQUEST (SUCCEEDED)" is placed in the
/usr/spool/uucp/LOGFILE files on both systems.

C-17

COPYIBG PILES USIBG UUCP

After you've tested the connection and the configuration files,
you can begin copying files from the 8600 to the 586. Follow
these steps to do the copying:
1.

Turn on and boot both systems.
both systems.

2.

If any of the 8600 files you want to copy aren't part of the
8600 directories, copy them into a directory. (These typically would be files that you've copied onto a diskette or
tape using the tar command.)

3.

Use the uucp command on the 586 to copy files from the 8600
to the 586. The last chapter in this appendix, nUsing the
Uucp Command," gives instructions on using the uucp command.
You can use the uucp command as many times as necessary to
copy files.

C-18

Log in as the superuser on

OSIBG mE UOCP COIIIlA.ND

Once you've enabled and disabled the ports, you can begin using
uucp to copy files. The basic format of the uucp command is:

uucp [-d] Altos86lsource-file destination-file 
where:

-d

is an optional parameter that has uucp
create, if necessary, all necessary
directories to place the source file(s) in
the destination file given

Altos86

gives the name you assigned to the 8699 in
its /etc/systemid file. You must follow the
system name with an exclamation mark (1).

source-file

gives the name of the source file or files to
be copied from the 8699. The name must
include the pathname to the directory that
contains the file or files.
The name can
include the metacharaters ? * [] that the
8600 will expand. Uucp will copy every file
whose name fits in the expanded name.

destination-file
gives the name of the file into which uucp
will place the contents of the source file.
If a pathname is given, uucp places the
copied file into the named directory.
Otherwise, the copied file goes into the
current directory. If more than one file is
copied, then the copied files are placed into
files of the same name as the files on the
8690 system.
Let's say that you want to copy the entire contents of the
directory /usr/marketing/reports from the 8600 to a directory of
the same name on the 586. You would use this command on the ACS
8600:

uucp -d /usr/aarketing/reports/* Altos586\1/usr/marketing/reports 
Theasterick (*) following the Altos86 pathname has uucp copy all
the files in the directory. The -d has uucp create the directory
/usr/marketing/reports on the 586 if it doesn't already exist.

C-19

OSING MODgS WID ALms JUII sYS'lEMS

The ..cJl and ~ programs can be used for local dedicated pointto-point communication between computers in the same office, or
for remote communication over telephone lines, in which case a
modem must be used at both ends of the connection. Most commercially available asynchronous modems can be attached to an Altos
XENIX system using a standard computer-to-modem cable. Examples
of modems which have been used successfully with Altos systems
include Racal-Vadic, Cermatek, and Hayes.
Figure C-3 shows the
Altos XENIX system connected to another system via a modem.

ACS8600
OR
ACS586

MODEM
CABLE

I

I

MODEM I

I

TELEPHONE
LINE
ANOTHER
COMPUTER

ANY
PORT

CONSOLE

Figure C-3.

Altos XENIX System with Modem

A special cable (usually called a "computer to modem" cable) must
be used to attach a modem to either the ACS 8600 or the 586.
Most modem manufacturers and cable manufacturers supply these
cables as off-the-shelf items. However, if the proper cable
cannot be found, it may be necessary to build your own cable. To
assist you, the RS-232C pins used by the 8600 and the 586 are
shown in Figure C-4.

C-28

TD

..

2 USUALLY CONNECTED TO PIN 3 ON THE MODEM

~

~

...
RS-232C
CONNECTOR
ONTHE
586 OR THE

RD
RTS
CTS

...

3 USUSALL Y CONNECTED TO PIN 2 ON THE MODEM
4 USUALLY CONNECTED TO PIN 5 ON THE MODEM
..

DSR

6 USUALLY CONNECTED TO PIN 20 ON THE MODEM

-...

GND ...

-8600

DCD

~

...

5 USUALLY CONNECTED TO PIN 4 ON THE MODEM

DTR

Figure C-4.

7 USUALLY CONNECTED TO PIN 7 ON THE MODEM
8 USUALLY NOT CONNECTED
10 USUALLY CONNECTED TO PIN 6 ON THE MODEM

RS-232C Connector Pin Assignments

Modems can be used with ~ or uucp. To use a modem without autodial capability, manually dial the desired number to establish
the connection. Then execute the cu command or one or more uucp
commands. ~ and ~ will operate normally. At the conclusion
of the session, you must manually dis-establish the telephone
connection (i.e., hang up the phone).
Modems with auto-dial capability can also be used. To use cu,
simply execute the cu command. Most modems will ask one or more
questions in response to a particular key being pressed. The
modem will then automatically establish the connection.
A special program (named "dial") is necessary to use uucp with an
auto-dial modem. An example of such a program is given on the
next page. For example, the dial program can be invoked by the
following entry in the file /usr/lib/crontab on the 586:

o

0

* * * dial/dev/tty5 4085551234 /usr/lib/uucp/uucico-rl-sAtlos8E

This entry means that the dial program will be run every night at
midnight. The dial program automatically dials the number 408555-1234, and then starts the uucico program.

C-21

/*

* The dial command has the format:
" ,:**
(',
dial ttyline number program
.
*
* where:
[

*
*
ttyline is the name of the serial line
number is the phone number
*
program is the name of the program to run
*
*
* Forexample:
*
dial /dev/tty5' 4985551234 /usr/lib/uucp1uucico -rl-sAltos
*
*
* This version of dial works only with the Cermatek 212A.
*/
iin~lude 
iin~lude 
iinclude 
struct sgttyb termio;

J.

main (argc, argv)
int arge;
!char **argv;

"{

t

int cflag, fd;
char
*Pi
,
1
signal- (SIGNUP, SIG_IGN);
/* Ignore hang-up si,]nal
p, ,setbuf (stdin, (char *) 9) ;
/* Don't buffer standard input
setbuf (stdout, (char *)9);
/* Don't buffer standard output
setbuf (stderr, (char *)9);
/* Don't buffer standard error
signal (SIGALRM, SIG_DFL);
/* Allow 69 seconds to make the
alarm(60);
/* connection
if «fd = open (argv[l], 2» <9) {
printf ("Can't oper %s\n", argv [1]) ;
exit(l);

*/
*/
*/
*/ '
*/ '
*/;

}

ioctl (fd, TIOCGETP, &termio); /*get the terminal I/O structure */
/*
* if called as Idial, use 399 baud else use 1299 bau9_._.... _ ,
*/
. -----~-.--.:~----'-~-. '-'. . ~---, ~ ."'-.~-\"
.
II :....---.....
termio.sg_ispeed = termio.sg_ospeed = (rep = rindex(argv[9], '/')} \
? * ( ++E) : argv [ 9 ] [ 9] ) '== '1') ? B399 : B1290;
\
termio.sg_flags &= -(ECHO 1 CRMOD); /* turn off echo and crmod modes
~'(,
termio.sg_flags 1= CBREAK;
/* set cbreak mode
,
ioctl (fd, TIOCSETP, &termio);
/*restore the terminal i/o
/* structure
/* enter interactive mode of modem */
'y'output("\n\r\n\r", fd);
/* wait for response from modem
\ wait ("NUMBER? •• ", fd);
*/
/* dial number
*/ .'
-C:.,output{argv[2], fd);
/* output carriage return
*/
--~ .. ~ toutput("\r", fd);
*/
.·~t.,-wait("DATA MODE.", fd);
/* wait for response
alar]
/*
connection
made,
turn
off
1"alarm(0)
;
.1:",;,.
c'
f

\'

'"

)

~'1

.'

,:......

i} ;

C-22

' .........-~

execvp(argv[3], &argv[3]);

} Ii.,;

j.~i'i';~

,\",.1:;'\"""

/* execute the remaining part of
/* command

¥:I

/* 'Output characters S LOW L Y
output (p, fd)
char *p;
int fd;

*
*

I

I

*/

{

char c;
while (c

= *p++) {
sleep (2);
write(fd, &c,

1);

}
}

wait (s, fd)
char *s;
int fd;
{

char c;
char *p;
int unget
while (1)
p

= 0;
{

= s;

/* point to the strings to be compared
*/
/* read until the first character matches */

do {

if (unget)
unget = 0;
else
read (fd, &c, 1);
} while (c 1= *p);
while (1) {
/* done if last character */
if (*++p == '\0') {
return;
}

/* read in the next character
read (fd, &c, 1);
/* if the next character doesn't compare ••
if (*p ! = c) {
/* start allover again */
unget = 1;
break;
8

}

}

}
}

C-23

*/
*/

Appendix D:
8186 ASSBllBLY LAIIGOAGB REPBRBRCB IIAROAL

The following pages represent an 8986 Assembly Language Reference
Manual extracted with permission from a Microsoft, Inc. publication.
The section numbers of this excerpt reflect the
enumeration of the original publication.

D-l

8086 Assembler Reference Manual

Microsoft Corporation.
XENIX Support Group
10700 Northup Ave.
Bellevue, WA 98004

~.

Introduction

This document describes the usage and input
the XENIX 8086 assembler ~.

syntax

of

The input syntax of the XENIX 8086 assembler is generally similar to that of the UNIX PDP-II assembler ~.
AQ is an assembler which produces an output file that
contains relocation infor~ation and a complete symbol table.
The output is acceptable to the XENIX link-editor.lJ;i, which
may be used to combine the outputs of several assembler runs
and to obtain object programs from libraries.
The output
format has been designed so that if a progr~ contains no
unresolved references to external symbols, it is executable
without further processing •

.2..

Usage
~

is used as follows:
as ( -1 ] [

-0

output ]

~

If the optional "-1" argument is given, an assembly listing is produced which includes the source, the assembled
(binary) code, and any assembly errors, and placed in
.fli.e.L.
The assembler is expecting the source input to be in
.fli.e •.a., where .f.ll.e is any valid XENIX filename. The output
of the assembler is by default placed on the file ~ •.Q. in
the current directory; the "-0" flag causes the output to
be placed on the named ~.

D-2

~.

Lexical conventions

Assembler
tokens
(alternatively,"symbols"
or
operators.
~.~.

include
"names"),

identifiers
constants, and

Identifiers

An identifier
consists
of
a
sequence
of
alphanumeric
characters (including period '.' and
underscore '_'as alphanumeric) of which the first may
not be numeric.
Only the first eight characters are
significant. The case of alphabetics in identifiers is
significant.
~.2.

Constants

A hex constant consists of a sequence of digits
the letters " 4 " , "h", "~'I, "~II, "~II, and
"~II (any of which may be capitalized),
preceeded by
the character 'I'.
The letters are interpreted with
the following values:

and

HEX
A
B
C
D

E
F

DECIMAL
IB
11
12
13
14
15

An octal constant consists of a series of digits,
preceeded by the tilde character " - I I . The digits
must be in the range from ~ to 2.
A decimal constant consists simply of a sequence
of digits. The magnitude of the constant should be
representable in ~ bits; i.e., be less than 32,768.
~.~.

Blanks

Blank and tab characters may be freely interspersed between tokens, but may not be used within
tokens (except in character constants). A blank or tab
is required to separate adjacent identifiers or constants not otherwise separated.
~.~.

Comments

The character 'I I introduces a comment, which
extends through the end of the line on which it
appears. Comments are ignored by the assembler.
D-3

.!.

Segments

Assembled code and data fall into three segments: the
text segment, the data segment, and the bss segment. The
text segment is the one in which the assembly begins, and it
is the one into which instructions are typically placed.
The XENIX system will, if desired, enforce the purity of the
text segment of programs by trapping write operations into
it. Object programs produced by the assembler must be processed by the link-editor ~ (using its '_~I flag) if the
text segment is to be write-protected. A single copy of the
text segment is shared among all processes executing such a
program.
The data segment is available for placing data or
instructions which will be modified during execution. Anything which may go in the text segment may be put into the
data segment.
In programs with write-protected, sharable
text segments, the data segment contains the initialized but
variable parts of a program. If the text segment is not
pure, the data segment begins immediately after the text
segment; if the text segment is pure, the data segment is in
an address space of its own, starting at location zero (B).
The bss segment may not contain any explicitly initialized code or data. The length of the bss segment (like that
of text or data) is determined by the high-water mark of the
location counter within it. The bss segment is actually an
extension of the data segment and begins immediately after
it. At the start of execution of a program, the bss segment
is set to B. The advantage in using the bss segment for
storage that starts off empty is that the initialization
information need not be stored in the output file. See also
location counter and assignment statements below.
~.

~

location counter

The special symbol, '.', is the location counter.
Its
value at any time is the offset within the appropriate segment from the start of the statement in which it appears.
The location counter may be aSSigned to, with the restriction that the current segment may not change; furthermore,
the value of ' • I may not decrease • If. the effect of the
assignment is to increase the value of ' • "
the required
number of null bytes are generated (but see Segments above) •
.[.

Statements

A source program is composed of a sequence of statements.
Statements are separated by new-lines. There are
four kinds of statements: null statements, expression statements, aSSignment statements, and keyword statements.
The format

for

most

8B 86

assembly
D-4

language

source

statements is:
[

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-21:37:19
Create Date                     : 2017:08:05 09:40:56-08:00
Modify Date                     : 2017:08:05 10:21:23-07:00
Metadata Date                   : 2017:08:05 10:21:23-07:00
Producer                        : Adobe Acrobat 9.0 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:55c3a778-31d2-094c-8f6e-a35c75738d0e
Instance ID                     : uuid:0c820d22-6f65-8447-82a9-741b56a74e7d
Page Layout                     : SinglePage
Page Mode                       : UseNone
Page Count                      : 494
EXIF Metadata provided by EXIF.tools

Navigation menu