800 1295 04A_Commands_Reference_Manual_198609 04A Commands Reference Manual 198609

800-1295-04A_Commands_Reference_Manual_198609 manual pdf -FilePursuit

800-1295-04A_Commands_Reference_Manual_198609 800-1295-04A_Commands_Reference_Manual_198609

User Manual: 800-1295-04A_Commands_Reference_Manual_198609

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

Download800-1295-04A_Commands_Reference_Manual_198609 800-1295-04A Commands Reference Manual 198609
Open PDF In BrowserView PDF
6sun®
•

microsystems

Comlllands Reference Manual

Sun Microsystems, Inc.

• 2550 Garcia Avenue

• Mountain View, CA 94043

• 415-960-1300

Credits and Trademarks

Sun Workstation® is a registered trademark of Sun Microsystems, Inc.
SunStation®, Sun Microsystems®, SunCore®, SunWindows®, DVMA®, and the combination of Sun
with a numeric suffix are trademarks of Sun Microsystems, Inc.
UNIX, UNIXI32V, UNIX

System III, and UNIX System V are trademarks of AT&T Bell Laboratories.

Intel ® and Multibus® are registered trademarks of Intel Corporation.
DEC®, PDP®, VT®, and VAX® are registered trademarks of Digital Equipment Corporation.

Copyright © 1986 by Sun Microsystems.
This publication is protected by Federal Copyright Law, with all rights reserved. No part of this publication may be reproduced, stored in a retrieval system, translated, transcribed, or transmitted, in any fonn, or
by any means manual, electric, electronic, electro-magnetic, mechanical, chemical, optical, or otherwise,
without prior explicit written pennission from Sun Microsystems.

INTRO( 1)

USER COMMANDS

INTRO(I)

NAME

intro - introduction to commands
DESCRIPTION

This section describes publicly accessible commands in alphabetic order. Certain distinctions of purpose
are made in the headings:
(1)

Commands of general utility, many with enhancements from 4.3 BSD. Wherever possible, we
have incorporated System V versions of commands and utilities into our standard UNIX release.
Where a command has both a System V and a BSD version, and it has been possible to merge
them, we have done so. In some cases, where the System V version was compatible with BSD
and offered significant added value, we adopted that version as our standard.

(IC)

Commands for communication with other systems.

(10)

Commands used primarily for graphics and computer-aided design.

(1 V)

Optionally installed commands from System V, or commands with versions from System V.
These commands either depend upon System V functionality, or have incompatibities with the
corresponding BSD version. They are included in the System V Software installation option.
Once installed, they can be found in the directory lusrl5bin.
In most cases, versions that differed were similar enough so that only the differences for the System V version needed to be noted on the manual page. In a few cases, however, a different
manual page for each version was required.

SEE ALSO

Section 6 in this manual for computer games.
Section 7 in this manual for descriptions of publicly available files and macro packages for document preparation.
Section 8 in this manual for system administration procedures, system maintenance and operation
commands, local daemons, and network-services servers.
Getting Started With UNIX: Beginner's Guide
Setting Up Your UNIX Environment: Beginner's Guide
Windows and Window-Based Tools: Beginner's Guide
Using the Network: Beginner's Guide
Programming Utilities/or the Sun Workstation
DIAGNOSTICS

Upon termination each command returns two bytes of status, one supplied by the system giving the cause
for termination, and (in the case of 'normal' termination) one supplied by the program, see wait and
exit (2). The former byte is 0 for normal termination, the latter is customarily 0 for successful execution,
nonzero to indicate troubles such as erroneous parameters, bad or inaccessible data, or other inability to
cope with the task at hand. It is called variously "exit code," "exit status" or "return code," and is described
only where special conventions are involved.

Sun Release 3.2

Last change: 26 March 1986

1

ADB( 1)

USER COMMANDS

ADB(l)

NAME

adb - debugger
SYNOPSIS

adb [ -w] [ -k] [ -I dir] [ obffil [ corfil ] ]
DESCRIPTION

adb is an interactive, general-purpose debugger. It can be used to examine files and provides a controlled
environment for the execution of UNIX programs.
obffil is normally an executable program file, preferably containing a symbol table. If the file does not contain a symbol table, it can still be examined, but the symbolic features of adb cannot be used. The default
for objfil is a.out. corfil is assumed to be a core image file produced after executing obffil. The default for
corfil is core.
OPTIONS
-w

Create both objfil and corfil if necessary and open them for reading and writing so that files can be
modified using adb.

-k

Do UNIX kernel memory mapping; should be used when core is a UNIX crash dump or /dev/mem.

-I

specifies a directory where files to be read with $< or $« (see below) will be sought; the default
is lusrllibladb.

USAGE

Refer to adb in Debugging Tools for the Sun Workstation for more complete information on how to use
adb. (Note: Some commands require that you compile progams to be debugged with the -go compiler
flag; see cc(lV) for details.)
Commands

adb reads commands from the standard input and displays responses on the standard output. It ignores the
QUIT signal. INTERRUPT invokes the next adb command adb generally recognizes command input of the

form:
[ address] [, count] command [ ; ]
address and count (if supplied) are expressions that result, respectively, in a new current address, and a
repetition count. command is composed of a verb followed by a modifier or list of modifiers.
The symbol. represents the current location. It is initially zero. The default count is 1.
Verbs

?
I

=

@

$r
$R
$x
$X
>
RETURN

Print locations starting at address in obffil.
Print locations starting at address in corfil.
Print the value of address itself.
Interpret address as a source address. Print locations in objfil or lines of source, as appropriate.
Manage a subprocess.
Print names and contents of CPU registers.
Print names and contents of MC68881 registers, if any.
Print the names and contents ofFPA registers 0 through 15, if any.
Print the names and contents ofFPA registers 16 through 31, if any.
Assign a value to a variable or register.
Repeat the previous command with a count of 1. Increment.
Shell escape.

Modifiers

Modifiers specify the format of command output Each modifier consists of a letter, preceded by an integer
repeat count.

2

Last change: 27 February 1986

Sun Release 3.2

ADB (1)

USER COMMANDS

ADB(1 )

Format Modifiers

The following format modifiers apply to the commands ?, I, @, and =. To specify a format, follow the
command with an optional repeat count, and the desired format letter or letters:
[ v] [ [r]f . .. ]

where v is one of these four command verbs, r is a repeat count, and f is one of the format letters listed
below:
(. increment: 2) Print 2 bytes in octal.
o
(4) Print 4 bytes in octal.
q
(2) Print in signed octal.
(4) Print long signed octal.
Q
(2) Print in decimal.
d
D
(4) Print long decimal.
x
(2) Print 2 bytes in hexadecimal.
X
(4) Print 4 bytes in hexadecimal.
(2) Print as an unsigned decimal number.
u
(4) Print long unsigned decimal.
U
f
(4) Print a single-precision floating-point number.
F
(8) Print a double-precision floating-point number.
eE
(12) Print a 96-bit MC68881 extended-precision floating-point number.
(1) Print the addressed byte in octal.
b
(1) Print the addressed character.
c
(1) Print the addressed character using escape convention.
C
s
(n) Print the addressed string.
(n) Print a string using the escape convention.
S
y
(4) Print 4 bytes in date format.
(n) Print as machine instructions.
z
(n) Print with MC68010 machine instruction timings.
I
(0) Print the source text line specified by •
(0) Print the value of • in symbolic form.
a
Print the addressed value in symbolic form.
(4)
P
A
(0) Print the value of . in source-symbol form.
(4) Print the addressed value in source-symbolform.
P
(0) Tab to the next appropriate tab stop.
t
(0) Print a space.
r
(0) Print a newline.
n
, ,
(0) Print the enclosed string.
(0) Decrement.
(0) Increment.
+
(0) Decrement. by 1

o

A

A

Modifiers/or? and I Only

I value mask
L value mask
w value
W value
m b1 e1 f1[?1]

Apply mask and compare for value; move. to matching location.
Apply mask and compare for 4-byte value; move. to matching location.
Write the 2-byte value to address.
Write the 4-byte value to address.
Map new values for bl, el ,fl. If the '?' or 'I' is followed by * then the second segment
(b2 ,e2 ,[2) of the address mapping is changed.

: Modifiers

be
Be
d
D
r

Sun Release 3.2

Set breakpoint, execute e when reached
Set breakpoint using source address, execute e when reached
Delete bre~oint
Delete bre~int at source address
Run objfil as a subprocess

Last change: 27 February 1986

3

ADB( 1)

cs

ss
Ss

t
k

$ Modifiers
file
?
r

x
b

c
C
d

e
w

s
o
q
v
m
f
p
p

i
W

USER COMMANDS

ADB (1)

The subprocess is continued with signal s
Single-step the subprocess with signal s
Single-step the subprocess with signal s using source lines
Add the signal specified by address to the list of signals passed directly to the subprocess
Remove the signal specified by address from the list implicitly passed to the subprocess.
Terminate the current subprocess, if any.
Read commands from the file file.
Similar to <, but can be used in a file of commands without closing the file.
Append output to file, which is created if it does not exist
Print process id, the signal which stopped the subprocess, and the registers.
Print the general registers and the instruction addressed by pc.
If a MC68881 is present, print its registers.
Print all breakpoints and their associated counts and commands.
C stack backtrace.
C stack backtracea with names and (32 bit) values of all automatic and static variables for
each active function.
Set the default radix to address and report the new value. Note that address is interpreted in
the (old) current radix. Thus "ql0$d" never changes the default radix.
Print the names and values of external variables.
Set the page width for output to address (default 80).
Set the limit for symbol matches to address (default 255).
All integers input are regarded as octal.
Exit from adb.
Print all non zero variables in octal.
Print the address map.
Print a list of known source filenames.
Print a list of known procedure names.
(Kernel debugging) Change the current kernel memory mapping to map the designated user
structure to the address given by _u, (the address of the user's proc structure).
Show which signals are passed to the subprocess with the minimum of adb interference.
Reopen objfil and cor/lie for writing, as though the -w command-line argument had been
given.

Variables
Named variables are set initially by adb but are not used subsequently.
o
The last value printed.
1
The last offset part of an instruction source.
2
The previous value of variable 1.
9
The count on the last $< or $« command.

On entry the following are set from the system header in the corfil or objfil as appropriate.
b
The base address of the data segment.
B
The number of an address register that points to the FPA page.
d
The data segment size.
e
The entry point
F
A value of '1' indicates FPA disassembly.
m
The 'magic' number (0407,0410 or 0413).
s
The stack segment size.
t
The text segment size.
Expressions
+

4

The value of dot.
The value of dot incremented by the current increment.
The value of dot decremented by the current increment.

Last change: 27 February 1986

Sun Release 3.2

ADB(l)

USER COMMANDS

ADB(l)

&
integer

The last address typed. (Used to be "tI".)
A number. The prefixes 00 and 00 indicate octal; Ot and OT, decimal; Ox and OX, hexadecimal (the default).
int.frac
A floating-point number.
ASCII value of up to 4 characters.
'ecce'
The value of name, which is either a variable name or a register name.

 ::=

RELEASE NUMBER I a

The character a in the list is equivalent to specifying all releases for the named sees file.
D

10

The delta(l) command creates a 'null' delta in each release (if any) being skipped when a delta is
made in a new release. For example, releases 3 and 4 are skipped when making delta 5.1 after
delta 2.7. These null deltas serve as 'anchor points' so that branch deltas may be created from
them later. If the D flag is absent from the sees file, skipped releases will be non-existent in the
sees file, preventing branch deltas from being created from them in the future.

Last change: 1 February 1985

Sun Release 3.2

ADMIN ( 1)

q text

USER COMMANDS

ADMIN(l)

Text is defined by the user. The text is substituted for all occurrences of the %Q% keyword in

sees file text retrieved by get(1).
mmodule
Module name of the sees file substituted for all occurrences of the %M% keyword in sees file
text retrieved by get(l). If the m flag is not specified, the value assigned is the name of the sees
file with the leading s. removed.

t type

Type of module in the sees file substituted for all occurrences of %Y% keyword in sees file text
retrieved by get(l).

v [program]

Validity checking program: delta(l) prompts for Modification Request (MR) numbers as the reason for creating a delta. The optional pro gram specifies the name of an MR number validity
checking program (see delta(l». If this flag is set when creating an sees file, the -m option must
also be used even if its value is null.
FILES

The last component of all sees file names must be of the form sJile-name. New sees files are given mode
444 (see chmod(l V». Write permission in the pertinent directory is, of course, required to create a file.
All writing done by admin is to a temporary x-file, called xJile-name, (see get(l», created with mode 444
if the admin command is creating a new sees file, or with the same mode as the sees file if it exists.
After successful execution of admin, the sees file is removed (if it exists), and the x-file is renamed with
the name of the sees file. This ensures that changes are made to the sees file only if no errors occurred.
It is recommended that directories containing sees files be mode 755 and that sees files themselves be
mode 444. The mode of the directories allows only the owner to modify sees files contained in the directories. The mode of the sees files prevents any modification at all except by sees commands.
If it should be necessary to patch an sees file for any reason, the mode may be changed to 644 by the
owner allowing use of a text editor. "Care must be taken!" The edited file should always be processed by
an admin -b to check for corruption followed by an admin -z to generate a proper check-sum. Another
admin -b is recommended to ensure the sees file is valid.

Admin also uses a transient lock file (called z.file-name), to prevent simultaneous updates to the sees file
by different users. See get(l) for further information.
SEE ALSO

sces(l), delta(l), ed(1), get(l), help(l), prs(l), what(l), sccsfile(5).

Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

Use help (1) for explanations.

Sun Release 3.2

Last change: 1 February 1985

11

AR(I)

USER COMMANDS

AR(I)

NAME

ar - archive and library maintainer
SYNOPSIS

ar dim Ipi q I r I t Ix [ ab position-name] [ cilouv ] archive file-entry . ..
DESCRIPTION
ar maintains library archives. A library is a set of files that have been combined into a single archive file
(see ar(5». ar is normally used to create and update library files used by the link editor Id(l), but can be

used for any similar purpose.
archive is the archive file. file-entry is a file contained in the archive.
OPTIONS

You must indicate one of: d, m, p, q, r, t, or x, which may be followed by one or more of the modifiers
abcilouv.
d

Delete the named files from the archive file.

m

Move the named files to the end of the archive.

p

Display the named files in the archive.

q

Quick append Append the named files to the end of the archive file without searching the archive
for duplicate names. Useful only to avoid quadratic behavior when creating a large archive
piece-by-piece.

r

Replace the named files in the archive.

t

Display a table of contents of the archive file. If no names are given, all files in the archive are
listed; if names are given, only those files are listed

x

Extract the named files. If no names are given, all files in the archive are extracted. In neither
case does x alter the archive file.

MODIFIERS

a

Place new files after posname (posname argument must be present). Applies only to the r and m
options.

b

Place new files before posname (posname argument must be present). Applies only to the r and m
options.

c

Normally ar creates archive when it needs to, and displays a message to this effect. The c
modifier suppresses this message.
Identical to the b modifier.
Local. Ar places its temporary files in the directory Itmp. The I modifier places them in the local
directory instead.

o

Old date. When files are extracted with the x option,
recorded in the archive.

u

Replace only those files that have changed since they were put in the archive. Used with the r
option.

v

Verbose. Give a file-by-file description of the creation of a new archive file from the old archive
and the constituent files. When used with t, it gives a long listing of information about the files.
When used with p, it precedes each file with a name.

0

sets the "last modified" date to the date

EXAMPLES

Creating a new archive:
orpheus% ar rcv archive file.o
a - file.o
Adding to an archive:
orpheus% ar rav file.o archive next.c

12

Last change: 19 May 1986

Sun Release 3.2

AR(1 )

USER COMMANDS

AR(I)

a - nextc
Extracting from an archive:
orpheus% ar xv archive file.o
x - file.o
orpheus% Is file.o
file.o
Seeing the table of contents:
orpheus% ar t archive
file.o
next.c
FILES
Itmplv*

temporaries

SEE ALSO
lorder(l), Id(I), ranlib(I), ar(5)
BUGS

If the same file is mentioned twice in an argument list, it is put in the archive twice.
The "last-modified" date of a file will not be altered by the
the extracted file or the superuser.

Sun Release 3.2

0

option unless the user is either the owner of

Last change: 19 May 1986

13

ARCH(l)

USER COMMANDS

ARCH(1)

NAME

arch - display the Sun WoIkstation architecture of the current host
SYNOPSIS

arch
DESCRIPTION
The arch command displays the architecture of the current Sun host.
SEE ALSO
rnach(1),rnachid(l)

14

Last change: 29 May 1986

Sun Release 3.2

AS(l)

USER COMMANDS

AS(l)

NAME

as - Sun-I, Sun-2 and Sun-3 assembler
SYNOPSIS

as [ -d2] [ -e] [ -b] [ -j ] [ -J] [ -L] [ -mc68010 ] [ -mc68020] [ -0 objfile] [ -0]
[-R ]jilename
DESCRIPTION
as translates assembly code in the namedjilename into executable object code in the specified objfile.

All undefined symbols in the assembly are treated as global.
The output of the assembly is left in the file objjile.
OPTIONS

-d2

Specifies that instruction offsets involving forward or external references and having sizes
unspecified in the assembly language are two bytes long. The default is four bytes. See also the -j
option.

-e

Allows control sections to begin on any two-byte boundary, rather than only four-byte boundaries.

-b

Suppress span-dependent instruction calculations and force all branches to be of medium length,
but all calls to take the most general form. This is used when assembly must be minimized, while
program size and run-time are unimportant. This option results in a smaller and faster program
than that produced by the -J option, but some very large programs may not be able to use it
because of the limits of the medium-length branches.

-j

Use short (pc-relative) branches to resolve jump's andjsr's to externals. This is for compact programs which cannot use the -d2 flag because of large program relocation.

-J

Suppress span-dependent instruction calculations and force all branches and calls to take the most
general form. This is used when assembly time must be minimized, but program size and run time
are not important.

-L

Save defined labels beginning with an 'L', which are normally discarded to save space in the
resultant symbol table. The compilers generate such temporary labels.

-mc68010
Accept only MC68010 instructions and addressing modes, and put the MC68010 machine-type
tag in the object file. This is the default on Sun-2's.
-mc68020
Accept the full MC68020, MC6888 1 and the Sun FPA instruction sets and addressing modes, and
put the MC68020 machine-type tag in the object file. This is the default on Sun 3's.
-0

The next argument is taken as the name of the object file to be produced. If the -0 flag isn't used,
the objfile is named a.out.

-0

Perform span-dependent instruction resolution over entire files rather than just over individual
procedures.

-R

Make initialized data segments read-only by concatenating them to the text segments. This eliminates the need to run editor scripts on assembly code to make initialized data read-only and
shared.

FILES

ItmplaS*

default temporary file

SEE ALSO

Id(I), nm(I), adb(1), dbx(l), a.out(5)
Assembly Language Reference Manual

Sun Release 3.2

Last change: 20 March 1986

15

AS( 1)

USER COMMANDS

AS(I)

BUGS

The Pascal compiler, pc, qualifies a nested procedure name by chaining the names of the enclosing procedures. This sometimes results in names long enough to abort the assembler, which currently limits
identifiers to 512 characters.

16

Last change: 20 March 1986

Sun Release 3.2

AT( 1)

USER COMMANDS

AT(l)

NAME

at - execute commands at a later time
SYNOPSIS

at [ -csm ] time [ date] [week] [script ]
DESCRIPTION

at spools a copy of the named script for execution at a later date or time. script is the name of a file to be
used as command input for the Bourne shell, sh(1), the C-Shell, csh(l), or an arbitrary shell specified by
the SHELL environment variable.
The time argument consists of 1 to 4 digits, followed by an optional 'A' or 'P' for AM or PM (if no letters
follow the digits, a 24-hour clock is assumed). One- and two-digit numbers are taken to be hours; three
and four digits specify hours and minutes. An optional colon (':') may be used to separate the hour and
minute fields. Alternatively, 'N' or 'M', optionally preceded by '12', '1200', or '12:00', may be used to
specify noon or midnight.
The optional date argument is either the name of a month, followed by a day-of-the-month number, or a
named day-of-the-week; if the keyword week follows, execution is moved out by seven days. Names of
months and days can be abbreviated, as long as the abbreviation is unambiguous.
If script is omitted, command input is accepted from the standard input.
The spool file includes a four-line header that indicates the owner of the job, the name of the script the
shell is to use, and whether mail is to be sent.
This header is followed by a cd command to the current directory (from which at was called) and a umask
command to set the modes on any files created by the job. at also copies all relevant environment variables
to the spool file.

script is run with the user and group IDs of whoever created the spool file (the user who invoked the at
command).
at jobs are started by periodic execution of the command lusrlIib/atrun from cron (8). The precise timing
of each at job depends upon the how often atrun is executed.
OPTIONS

-c

C-Shell. csh(l) is used to execute script.

-s

Standard (Bourne) shell. sh(l) is used to execute the job.

If neither -c, nor -s is specified, at uses the value of the SHELL environment variable to determine which
shell to use.
-m

Mail. Send mail after the job has been run. If errors occur during execution of the script, then
resulting error messages are included in the mail message. When -m is omitted, error output is
lost (unless redirected within the script itself).

EXAMPLES

at8amjan 24
at -s 1200n week
at -c -m 1530 fr week
DIAGNOSTICS

Complains about various syntax errors and times that are out of range.
FILES

lusrlspool/at
lusrlspool/atlyy.ddd.hhhh.*
lusrlspool/atlpast
Iusrlspool/atllasttimedone
Iusrlliblatrun

Sun Release 3.2

spooling area
job file
directory where jobs are executed from
last time atrun was run
job initiator (run by cron(8»

Last change: 17 July 1986

17

AT(1)

USER COMMANDS

AT(1)

SEE ALSO
atq(1), atrm(1), cron(8)
BUGS

Due to the granularity of the execution of lusrlIib/atrun, there may be bugs in scheduling jobs almost
exactly 24 hours ahead.

If the system crashes, mail stating that the job was not completed is not sent to the user.
Sometimes old spool files are not removed from the directory lusrlspooIlatlpast. This is usually due to a
system crash, and requires that these files be removed by hand.
Shell interpreter specifiers (e.g., #!/binlcsh ) in the beginning of script are ignored.

18

Last change: 17 July 1986

Sun Release 3.2

ATQ(l)

USER COMMANDS

ATQ( 1)

NAME

atq - print the queue of jobs waiting to be run
SYNOPSIS

atq [ -c ] [ -0 ] username ...
DESCRIPTION
atq prints the queue of jobs, created with the at(l) command, that are waiting to be run at later date.

With no flags, the queue is sorted in chronological order of execution.

If no usemames are specified, the entire queue is displayed; otherwise, only those jobs belonging to the
named users are displayed.
OPTIONS

-c

By creation time. Sorted the queue by the time that the at(l) command was given, the most
recently created job first.

-0

Number of jobs. Print the total number of jobs currently in the queue. Do not list them.

FILES

lusrlspoollat

spool area

SEE ALSO
at(1), atrm(1), cron(8)

Sun Release 3.2

Last change: 17 July 1986

19

ATRM( 1)

USER COMMANDS

ATRM(I)

NAME

atrm - remove jobs spooled by at
SYNOPSIS
atrm [ -6] [ - ] [job-number ] ... [username] ...
DESCRIPTION
atrm removes delayed-execution jobs that were created with the at(l) command. The list of jobs can be
displayed by atq(I).

atrm removes each job-number you specify, and/or all jobs belonging to username, provided that you own
the indicated jobs.
Jobs belonging to other users can only be removed by the super-user.
OPTIONS
-f

-i

Force. All information regarding the removal of the specified jobs is suppressed.
Interactive. atrm asks if a job should be removed; a response of 'y' verifies that the job is to be
removed.
Remove jobs that were queued by the current user. If invoked by the super-user, the entire queue
will be flushed

FILES

lusrlspool/at

spool area

SEE ALSO
at(l), atq(I), cron(8)

20

Last change: 17 July 1986

Sun Release 3.2

AWK(I)

USER COMMANDS

AWK(I)

NAME

awk - pattern scanning and processing language
SYNOPSIS

awk [-f programyle] [ -Fc] [program] [variable=value ... ] [file ... ]
DESCRIPTION

Awk scans each of its input file s for lines that match any of a set of patterns specified in pro gram. The
inputfiles are read in order; the standard input is read if there are no files. The filename - means the standard input.
The set of patterns may either appear literally on the command line as program, or, by using the -f option,
the set of patterns may be in a pro gramyle; a pro gramyle of - means the standard input. If the pro gram
is specified on the command line, it should be enclosed in single quotes (') to protect it from the shell.
awk variables may be set on the command line using arguments of the form variable=value. This causes
the awk variable variable to be set to the value value before the first record of the next file argument that
follows the variable=value argument is read.
With each pattern in program there can be an associated action that will be performed when a line of afile
matches the pattern. See the discussion below for the format of input lines and the awk language. Each
line in each inputfile is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern.
OPTIONS
-f programyle

Use the contents of programJile as the source for the program.

-F c

Use the character c as the field separator (FS) character. See the discussion ofFS below.

LINES, STATEMENTS, AND THE AWK LANGUAGE

Input Lines
An input line is made up of fields separated by white space. The field separator can be changed by using
FS - see below. Fields are denoted $1, $2, •••, up to $9; $0 refers to the entire line.
Pattern-action Statements
A pattern-action statement has the form
pattern { action}
A missing action means copy the line to the output; a missing pattern always matches.
An action is a sequence of statements. A statement can be one of the following:

if ( conditional) statement [ else statement]
while (conditional) statement
for ( expression ; conditional; expression) statement
break
continue
{ [ statement] ••• }
variable =expression
print [ expression-list] [ >expression ]
printf format [ , expression-list] [ >expression ]
next
# skip remaining patterns on this input line
exit
# skip the rest of the input

Format of the Awk Language
Statements are terminated by semicolons, new lines or right braces. An empty expression-list stands for the
whole line.
Expressions take on string or numeric values as appropriate, and are built using the operators +, -, *, /, %,
and concatenation (indicated by a blank). The C operators ++ , - , += , -= , *= , /= , and %= are also
available in expressions.

Sun Release 3.2

Last change: 1 February 1985

21

AWK(I)

USER COMMANDS

AWK(I)

Variables may be scalars, array elements (denoted x [ i]) or fields. Variables are initialized to the null
string. Array subscripts may be any string, not necessarily numeric, providing a form of associative
memory. String constants are quoted "•••".
The print statement prints its arguments on the standard output (or on a file if >file is present), separated by
the current output field separator, and terminated by the output record separator. The printf statement formats its expression list according to the format template format (see print/(3S) for a description of the formatting control characters).

Built In Functions
The built-in function length returns the length of its argument taken as a string, or of the whole line if no
argument There are also built-in functions exp, log, sqrt, and int, where int truncates its argument to an
integer. substr(s, m, n) returns the n-character substring of s that begins at position m.
sprintf'(format, expr, expr, ••• ) formats the expressions according to the print/(3S) format given by format
and returns the resulting string.

Patterns

Patterns are arbitrary Boolean combinations ( !, II, &&, and parentheses) of regular expressions and relational expressions. Regular expressions must be surrounded by slashes and are as in egrep. Isolated regular expressions in a pattern apply to the entire line. Regular expressions may also occur in relational
expressions.
A pattern may consist of two patterns separated by a comma; in this case, the action is performed for all
lines between an occurrence of the first pattern and the next occurrence of the second.
A relational expression is one of the following:

expression matehop regular-expression
expression relop expression
where a relop is any of the six relational operators in C, and a matehop is either - (for "contains") or !(for Hdoes not contain"). A conditional is an arithmetic expression, a relational expression, or a Boolean
combination of these.
The special pattern BEGIN may be used to capture control before the first input line is read, in which case
BEGIN must be the first pattern. The special pattern END may be used to capture control after the last
input line is read, in which case END must be the last pattern.
Special Variable Names
A single character e may be used to separate the fields by starting the program with
BEGIN { FS = "e" }
or by using the -Fe option.
Other variable names with special meanings include NF, the number of fields in the current record; NR, the
ordinal number of the current record; FILENAME, the name of the current input file; OFS, the output field
separator (default blank); ORS, the output record separator (default newline); and OFMT, the output format for numbers (default %.6g).
EXAMPLES
Print lines longer than 72 characters:

length> 72
Print first two fields in opposite order:
{print $2, $1 }
Add up first column, print sum and average:
END

22

{s += $1 }
{ print" sum is", s, " average is", S/NR }

Last change: 1 February 1985

Sun Release 3.2

AWK(l)

USER COMMANDS

AWK( 1)

Print fields in reverse order:
{ for (i = NF; i > 0; -i) print $i }
Print all lines between start/stop pairs:
fstart!, fstopf

Print all lines whose first field is different from previous one:
$1 != prev {print; prev = $1 }
SEE ALSO

Using UNIX Text Utilities on the Sun Workstation
sed(1V), grep(1V), lex(1)
BUGS

Input white space is not preserved on output if fields are involved.
There are no explicit conversions between numbers and strings. To force an expression to be treated as a
number add 0 to it; to force it to be treated as a string concatenate the null string (" ") to it

Syntax errors result in the cryptic message ttawk: bailing out near line 1.tt

Sun Release 3.2

Last change: 1 February 1985

23

BANNER ( I)

USER COMMANDS

BANNER(I)

NAME

banner - make posters
SYNOPSIS

lusr/5binlbanner strings
DESCRIPTION
Note:

Optional Software (System V Option). Refer to Installing UNIX on the Sun Workstation for information on how to install this command.

banner prints its arguments (each up to 10 characters long) in large letters on the standard output.
SEE ALSO
echo(lV)

24

Last change: 17 April 1986

Sun Release 3.2

BASENAME ( 1 )

USER COMMANDS

BASENAME ( 1 )

NAME

basename, dirname - deliver portions of path names
SYNOPSIS
base name string [ suffix ]
dirname string
DESCRIPTION
basename deletes any prefix ending in I and the suffix, if present in string. It directs the result to the standard output, and is normally used inside substitution marks C ') within shell procedures.

dirname delivers all but the last level of the path name in string.
EXAMPLES
This shell procedure invoked with the argument lusrlsre/binleat.e compiles the named file and moves the
output to cat in the current directory:

ee$l
mv a.out'basename $l.e'
The following example will set the shell variable NAME to lusrlsrdemd:
NAME='dirname lusrlsrdemdleat.e'
SEE ALSO
sh(l)

Sun Release 3.2

Last change: 13 March 1986

25

BC( 1)

USER COMMANDS

BC(l )

NAME

bc - arbitrary-precision arithmetic language
SYNOPSIS

be [ -e ] [ -I ] [ file ••• ]
DESCRIPTION
Be is an interactive processor for a language which resembles C but provides unlimited precision arithmetic. Be takes input from any files given, then reads the standard input. The syntax for be programs is as
follows; L means letter a-z, E means expression, S means statement.

Comments
are enclosed in 1* and *1.
Names
simple variables: L
array elements: L [ E ]
The words 'ibase', 'obase', and 'scale'
Other operands
arbitrarily long numbers with optional sign and decimal point
(E)
sqrt (E)
length (E)

scale (E)
L(E, ••• ,E)

number of significant decimal digits
number of digits right of decimal point

Operators

+ _ * I % (% is remainder; is power)
++ (prefix and postfix; apply to names)
A

A

== <= >= != < >
= += _= *= 1= %= =
A

Statements

E
{S; ..• ;S}
if(E)S
while (E) S
for ( E ; E ; E ) S
null statement
break
quit
Function definitions
define L ( L ,•.•, L ) {
auto L, ••• ,L
S; ••• S
return (E)
}

Functions in -I math library
s(x)
sine
c(x)
cosine
e(x)
exponential
l(x)
log
a(x)
arctangent
j(n,x) Bessel function

26

Last change: 1 April 1981

Sun Release 3.2

BC( 1)

USER COMMANDS

BC(1 )

All function arguments are passed by value.
The value of a statement that is an expression is printed unless the main operator is an assignment. Either
semicolons or newlines may separate statements. Assignment to seale influences the number of digits to be
retained on arithmetic operations in the manner of de (1). Assignments to ibase or obase set the input and
output number radix respectively.
The same letter may be used as an array, a function, and a simple variable simultaneously. All variables
are global to the program. 'Auto' variables are pushed down during function calls. When using arrays as
function arguments or defining them as automatic variables empty square brackets must follow the array
name.
EXAMPLES
Define a function to compute an approximate value of the exponential function:
scale = 20
define e(x){
auto a, b, c, i, s
a=1
b=1
s=1
for(i=l; 1==1; i++){
a= a*x
b = b*i
c = alb
if(c == 0) return(s)
s = s+C
}
}

Print approximate values of the exponential function of the first ten integers:
for(i=l; k=10; i++) e(i)
OPTIONS
-I

-c

is the name of an arbitrary precision math library.
Compile only: be is actually a preprocessor for de(l), which it invokes automatically, unless the

-c (compile only) option is present. In this case the de input is sent to the standard output instead.
FILES

lusr/lib/lib.b mathematical library
dc( 1)
desk calculator proper
SEE ALSO
dc(l)

Games, Demos and Other Pursuites: Beginner's Guide
BUGS

For statement must have all three E' s.
Quit is interpreted when read, not when executed.

Sun Release 3.2

Last change: 1 April 1981

27

BIFF( 1)

USER COMMANDS

BIFF( 1)

NAME

biff - mail alarm
SYNOPSIS

birr [yin]
DESCRIPTION

bifj informs the system whether you want to be notified when mail arrives during the current terminal session. The command:

biffy
enables notification; the command:

biffn
disables it; finally, the command:

biff
on its own tells you whether the notification is y or n. When mail notification is enabled, the header and
first few lines of the message are printed on your screen whenever mail arrives. A biffy command is often
included in the file .login or .profile to be executed at each login.
bifjoperates asynchronously. For synchronous notification use the MAIL variable of sh or the mail variable
of csh.
SEE ALSO

csh(I), sh(I), mail(I), comsat(8)

28

Last change: 23 September 1985

Sun Release 3.2

BINMAIL( 1)

USER COMMANDS

BINMAIL(l)

NAME

binmail- send or receive mail among users
SYNOPSIS
tbin/maD [ -i] [ -p ] [ -q ] [ -f filename ]
tbin/maD address . ..
DESCRIPTION
Note: This is the old version 7 UNIX system mail program. The default nuzil command is described in
mail(l), and its binary is in the directory lusrlucb.

Ibinlmail with no address prints a user's mail, message-by-message in last-in, first-out order. Ibinlmail
accepts commands from the standard input to direct disposition messages.
When addresses are named, Ibinlnuzil takes the standard input up to an end-of-file (or a line with just' .')
and adds it to each person's 'mail' file. The message is preceded by the sender's name and a postmark.
Lines that look like postmarks are prepended with '>'. A person is usually a user name recognized by
login, or a network address (see aliases (5».

If there is any pending mail, login tells you there is mail when you log in. It is also possible to have the CShell, or the daemon bifftell you about mail that arrives while you are logged in.
To forward mail automatically, add the addresses of additional recipients to the forward file in your home
directory. Note that forwarding addresses must be valid, or the messages will "bounce." (You cannot, for
instance, reroute your mail to a new host by forwarding it to your new address if it is not yet listed in the
yP aliases domain.)
OPTIONS
Printing Mail

-i

continue after interrupts - an interrupt normally terminates the Ibinlnuzil accepts the following
interactive commands when printing messages.

-p

print messages without prompting for commands. Exit immediately upon receiving an interrupt.

-q

quit immediately upon interrupt.

-rfilename
use filename as if it were the mail file.
Sending Mail

-d

deliver mail directly, don't route the message through sendmail. This option is often used by pro-

grams that send mail.
-i

continue after interrupts mail file unchanged

an interrupt normally terminates the Ibinlnuzil command and leaves the

-rname
specify a string to appear as the name of the sender.
COMMANDS

?
print a command summary.
EOT (control-D)
put unexamined mail back in the mail file and quit.

!command
escape to the Shell to do command.
go back to previous message.
+

go on to next message.

newline go on to next message.
d

Sun Release 3.2

delete message and go on to the next.

Last change: 23 September 1985

29

BINMAIL( 1)

dq

USER COMMANDS

BINMAIL( 1)

delete message and quit

m [person ] _.

mail the message to the named persons (yourself is default).
n

go on to next message.

p

print message (again).

q

same as EOT.

s rJile] ...
save the message in the named files ('mbox' default). If saved successfully, remove it from the
list and go on to the next message.
W

[file] •••

save the message, without a header, in the named files ('mbox' default). If saved successfully,
remove it from the list and go on to the next message.
x

exit without changing the mail file.

FILES

letc/passwd

to identify sender and locate address
incoming mail for user *
mbox
saved mail
Itmplma*
temp file
lusrlspoollmaill* .lock lock for mail directory
dead.letter unmailable text is saved here
$HOMElJorward
list of forwarding recipients

lusrlspoollmaill*

SEE ALSO

mail(l), biff(l), write(l), uucp(lC), uux(IC), xsend(I), sendmail(8), aliases(5), csh(l)
BUGS

Race conditions sometimes result in a failure to remove a lock file.
The superuser can read your mail, unless it is encrypted by des, encrypt, or xsend. Even if you encrypt it,
the superuser can delete it.

30

Last change: 23 September 1985

Sun Release 3.2

CAL( 1)

USER COMMANDS

CAL ( 1)

NAME

cal - display calendar
SYNOPSIS

cal [ [ month] year ]
DESCRIPTION
Cal displays a calendar for the specified year. If a month is also specified, a calendar for that month only is
displayed. H neither is specified, a calendar for the present month is printed.

Year can be between 1 and 9999. Be aware that 'cal 78' refers to the early Christian era, not the 20th century. Also, the year is always considered to start in January, even though this is historically naive.
month is a number between 1 and 12.
The calendar produced is that for England and her colonies.
Try September 1752.

Sun Release 3.2

Last change: 17 February 1986

31

CALENDAR ( 1 )

USER COMMANDS

CALENDAR ( 1 )

NAME

calendar - reminder service
SYNOPSIS

calendar [ - ]
DESCRIPTION
Calendar consults the file calendar in the current directory and displays lines that contain today's or

tomorrow's date anywhere in the line. Most reasonable month-day dates - such as 'Dec. 7,' 'december
7,' and '1217' - are recognized, but '7 December' or '7/12' are not. If you give the month as "*" with a
date - for example, "* 1" - that day in any month will do. On weekends 'tomorrow' extends through
Monday.
When the optional - argument is present, calendar does its job for every user who has a file calendar in
his login directory and sends him any positive results by mail(l). Normally this is done daily in the wee
hours under control of cron (8).
The file calendar is first run through the C preprocessor, Iliblcpp, to include any other calendar files
specified with the usual "#include" syntax. Included calendars are usually shared by all users, and maintained by the system administrator.
FILES

-/calendar
lusrllib/calendar to figure out today's and tomorrow's dates
letclpasswd
Itmplcal*
llib/cpp subprocess

lusrlbin/egrep
subprocess
Ibin/sed subprocess
Ibin/mail
subprocess
SEE ALSO

at(I), cron(8), mail(l)

BUGS
Calendar's extended idea of 'tomorrow' doesn't account for holidays.

32

Last change: 17 February 1986

Sun Release 3.2

CAT ( IV)

USER COMMANDS

CAT ( IV)

NAME

cat - concatenate and display
SYNOPSIS

cat [ -u ] [ -0] [ -b] [ -s ] [ -v] [ -e ] [ -t ] [ - ] [filename . .. ]
SYSTEM V SYNOPSIS
cat [ -u ] [ -s] [ -y ] [ -e ] [ -t] [ - ] [filename . .. ]
DESCRIPTION
cat reads eachfile in sequence and displays it on the standard output Thus

% cat goodies
displays the contents of goodies on the standard output, and

% cat filel file2 >file3
concatenates the first two files and places the result on the third.
If no filename argument is given, or if the argument '-' is given, cat reads from the standard input If the
standard input is a terminal, input is terminated by an EOF signal, usually AD.
OPTIONS
-u

Unbuffered. If -u is not used, output is buffered in blocks, or line-buffered if standard output is a
tenninal.

-0

precedes each line output with its line number.

-b

numbers the lines, as -0, but omits the line numbers from blank lines.

-s

substitutes a single blank line for multiple adjacent blank lines.

-v

displays non-printing characters (with the exception of tabs and newlines) so that they are visible.
Control characters print like AX for Control-X; the DEL character (octal 0177) prints as A? NonASCII characters (with the high bit set) are displayed as M-x where M- stands for' 'meta" and x
is the character specified by the seven low order bits.

-e

displays non-printing characters, as -v, and in addition displays a $ character at the end of each
line.

-t

displays non-printing characters, as -v, and in addition displays tab characters as "I.

SYSTEM V OPTIONS
-s
suppresses messages about files which can't be opened.
-y

displays non-printing character (with the exception of tabs, newlines, and formfeeds) so that they
are visible.

-e

if the -v option is specified, displays a $ character at the end of each line.

-t

if the -v option is specified, displays tab characters as AI and formfeeds as AL.

SEE ALSO
cP(I), ex(I), more(I), pr(IV), pg(IV), tail(l)
BUGS

Beware of 'cat a b >a' and 'cat a b >b', which destroy the input files before reading them.

Sun Release 3.2

Last change: 24 April 1986

33

CB( 1)

USER COMMANDS

CB(1)

NAME

cb - C program beautifier
SYNOPSIS

cb [ -s] [ -j ] [ -Ileng ] [filename . .. ]
DESCRIPTION

cb reads C programs either from its arguments or from the standard input and writes them on the standard
output with spacing and indentation that displays the structure of the code.
indent(1) is preferred.
OPTIONS

With no options, cb preserves all user NEWUNES.
-s

Standard C style. Canonicalizes the code to the style of Kernighan and Ritchie in The C Programming Language.

-j

Split lines are put back together.

-Ileng Split lines longer than leng.
SEE ALSO

indent(l)
BUGS

Punctuation hidden in preprocessor statements can cause indentation errors.

34

Last change: 16 April 1986

Sun Release 3.2

CC( IV)

USER COMMANDS

CC( IV)

NAME

cc - C compiler
SYNOPSIS

cc [-a] [-align _block] [ -c] [-C] [-dryrun] [-Dname[=de!]] [-E] [float_option]
[ -fsingle] [ -g] [ -go] [ -belp] [ -Ipathname] [ -J] [ -Ilib]
[ -Ldir [ -M ] [ - i ) ouljile] [ -0 ] [ -p ] [ -pg] [ -pipe] [ -P ]
[ -Qoption prog opt] [ -Qpatb pathname ] [ -Qproduce sourcetype] [ -R ] [ -s ]
[ -temp=dir] [ -time] [ -Uname ] [ -v ] [ -w] sourcefile ...
SYSTEM V SYNOPSIS

/usr/Sbinlcc arguments
Note:

arguments to lusrl5binlcc are identical to those listed above.

DESCRIPTION

cc is the C compiler. It translates programs written in the C programming language into executable load
modules, or into relocatable binary programs for subsequent loading with the ld(l) linker.
In addition to the many options, cc accepts several types of filename arguments. For instance, files with
names ending in .c are taken to be C source programs. They are compiled, and each resulting object program is placed in the current directory. The object file is named after its source file - the suffix .0 replacing .c in the name of the object. In the same way, files whose names end with .s are taken to be assembly
source programs. They are assembled, and produce .0 file. Filenames ending in .iI are taken to be inline
expansion code template files; these are used to expand calls to selected routines in-line when the -0 option
is in effect. See FILES, below for a complete list of compiler-related filename suffixes.
Other arguments refer to assembler or loader options, object programs, or object libraries. Unless -c, -S,
-E -P or -Qproduce is specified, these programs and libraries, together with the results of any specified
compilations or assemblies, are loaded (in the order given) to produce an output file named a .out. You can
specify a name for the executable by using the -0 option.
If a single C program is compiled and loaded all at once, the intermediate file is deleted.
OPTIONS

See ld(l) for link-time options.
-a

Insert code to count how many times each basic block is executed. Creates a .d file for
every .f file compiled. The.d file accumulates execution data for the corresponding
source file. The tcov(l) utility can then be run on the source file to generate statistics
about the program.

-align _block

Cause the global symbol block to be page-aligned: its size is increased to a whole number
of pages, and its first byte is placed at the beginning of a page.

-c

Suppress linking with ld(l) and produce a .0 file for each source file. A single object file
can be named explicitly using the -0 option.

-C

Prevent the C preprocessor, cpp(l), from removing comments.

-dryrun

Show but do not execute the commands constructed by the compilation driver.

-Dname[=def] Define a symbol name to the C preprocessor (cpp(l». Equivalent to a #define directive
in the source. If no de! is given, name is defined as '1'.
-E

Run the source file through cpp(l), the C preprocessor, only. Sends the output to the
standard output, or to a file named with the -0 option. Includes the cpp line numbering
information. (See also, the -P option.)

float_option

Floating-point code generation option. Can be one of:

-f68881
Generate in-line code for Motorola MC68881 floating-point processor (supported only on Sun-3 systems).

Sun Release 3.2

Last change: 20 August 1986

35

CC( IV)

USER COMMANDS

CC(IV)

-ffpa

Generate in-line code for Sun Floating Point Accelerator (supported only on
Sun-3 systems).

-fsky

Generate in-line code for Sky floating-point processor (supported only on Sun2).

-fsoft

Generate software floating-point calls (this is the default).

-fswitch
Run-time-switched floating-point calls. The compiled object code is linked at
runtime to routines that support one of the above types of floating point code.
This was the default in previous releases. Only for use with programs that are
floating-point intensive, and must be portable to machines with various
floating-point hardware options.

-fsingle

Use single-precision arithmetic in computations involving only 80at expressions - that
is, do not convert everything to double, which is the default. Note that floating-point
parameters are still converted to double precision, and functions returning values still
return double-precision values.
Although not standard C, certain programs run much faster using this option. Be aware
that some significance can be lost due to lower-precision intermediate values.

-g

Produce additional symbol table information for dbx(l) and dbxtool(l) and pass the -Ig
flag to ld(l). When this option is given, the -0 and -R options are suppressed.

-go

Produce additional symbol table information for adb(l). When this option is given, the
-0 and -R options are suppressed.

-help

Display helpful information about cc.

-Ipathname

Add pathname to the list of directories in which to search for #include files with relative
filenames (not beginning with slash I). The preprocessor first searches for #include files
in the directory containing sourcefile, then in directories named with -I options (if any),
and finally, in lusr/include .

-J

Generate 32-bit offsets in switch statement labels.

-IUb

Link with object library lib (for ld(1».

-Ldir

Add dir to the list of directories containing object-library routines (for linking using
ld(l).

-M

Run only the macro preprocessor on the named C programs, requesting that it generate
makefile dependencies and send the result to the standard output (see make(l) for details
about makefiles and dependencies).

-ooutfile

Name the output file outfile. outfile must have the appropriate suffix for the type of file to
be produced by the compilation (see FILES, below). outfile cannot be the same as
sourcefile (the compiler will not overwrite the source file).

-0

Optimize the object code. Ignored when either --g or -go is used

-p

Prepare the object code to collect data for profiling with prof(l). Invokes a run-time
recording mechanism that produces a mon.out file (at normal termination).

-pg

Prepare the object code to collect data for profiling with gprof(l). Invokes a run-time
recording mechanism that produces a gmon.out file (at normal termination).

-pipe

Use pipes, rather than intermediate files, between compilation stages. (Very cpuintensive.)

-P

Run the source file through cpp(l), the C preprocessor, only. Puts the output in a file
with a .i suffix. Does not include cpp -type line number information in the output

-Qoption prog opt

36

Last change: 20 August 1986

Sun Release 3.2

CC( IV)

USER COMMANDS

CC( IV)

Pass the option opt to the program pro g. The option must be appropriate to that program
and may begin with a minus sign. prog can be one of: as, cpp, inline, or Id.
-Qpath pathname
Insert a directory pathname into the compilation search path (to use alternate versions of
programs invoked during compilation).
-Qproduce sourcetype
Produce source code of the type sourcetype. sourcetype can be one of:
.c
C source (from bb_count) .
.i
Preprocessed C source from cpp (1) .
•0
Object file from as (I) .
.s
Assembler source (from ccom, in line or c2).
-R

Merge data segment with text segment for asCI). Data initialized in the object file produced by this compilation is read-only, and (unless linked with Id -N) is shared between
processes. Ignored when either -g or -go is used.

-s

Do not assemble the program but produce an assembly source file.

-temp=dir

Set directory for temporary files to be dir.

-time

Report execution times for the various compilation passes.

-Uname

Remove any initial definition of the cpp(l) symbol name. (Inverse of the -D option.)

-v

Verbose. Print the version number of the compiler and the name of each program it executes.

-w

Do not print warnings.

ENVIRONMENT
FLOAT_OPTION When no floating-point option is specified, the compiler uses the value of this environ-

ment variable (if set). Recognized values are: f68881, ffpa, fsky, fswitch and fsoft.
FILES
a.out
file.a
file.c
file.d
filej
file .f
file.F
file .iI
file .0
file .p
file .r
file .s
file .S
file.tcov
lliblc2
Iliblccom
lliblcompile
lliblcpp
lliblcrtO.o
lliblFcrtl.o
lliblgcrtO.o
Ilibllibc .a
lliblmcrtO.o
lliblMcrtl.o

Sun Release 3.2

executable output file
library of object files
C source file
tcov(l) test coverage input file
C source file after preprocessing with cpp(1)
FORTRAN 77 source file
FORTRAN 77 source file for cpp(1)
inline expansion file
object file
Pascal source file
Ratfor source file
assembler source file
assembler source for cpp (1)
output from tcov (1)
object code optimizer
compiler
compiler command-line processing driver
macro preprocessor
runtime startoff
startup code for -fsoft option
startofffor profiling with gprof(l)
standard library, see intro (3)
startofffor profiling withprof(l) intro(3)
startup code for -f68881 option

Last change: 20 August 1986

37

CC( IV)

lliblScrtl.o
IliblWcrtl.o
lusrlinclu.tk
lusrlliblbb count
lusrlliblbb link.o
lusrllibllibc y.a
lusrllibllibF77.a
lusrlliblimine
IusrllibllibI77.a
lusrllibllibm.a
lusrllibllibU77.a
lusrl5libllibc.a
lusrl5libllibcy.a
Itmpl*
mon.out
gmon.out

USER COMMANDS

CC(IV)

startup code for -fsky option
startup code for -ffpa option
standard directory for #include files
block counting preprocessor
basic block counting routine
profiling library, see gprof( I) or prof( 1)
FORTRAN 77 library
inline expander of library calls
FORTRAN 77 library
math library
FORTRAN 77 library
System V standard compatibility library, see intro(3V)
System V profiling library, see gprof( 1) or prof( I)
compiler temporary files
file produced for analysis by prof(l)
file produced for analysis by gpro/(l)

SEE ALSO

monitor(3), prof(l), gprof(I), tcov(l), adb(l), ar(I), ld(l), dbx(l), as(I), cpp(l), make(1)
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978
UNIX Programming in Programming Utilities for the Sun Workstation

Floating-Point Programmer's Guide/or the Sun Workstation
UNIX Interface Overview

DIAGNOSTICS

The diagnostics produced by C itself are intended to be self-explanatory. Occasional obscure messages
may be produced by the preprocessor, assembler, or loader.
BUGS

The program context given in syntax error messages is taken from the input text after the C preprocessor
has performed substitutions. Therefore, error messages involving syntax errors in or near macro references
or manifest constants may be misleading.

38

Last change: 20 August 1986

Sun Release 3.2

CD( 1)

USER COMMANDS

CD(l)

NAME

cd - change working directory
SYNOPSIS

cd [ directory ]
DESCRIPTION

Directory becomes the new working directory. The process must have execute (search) permission in
directory. If cd is used without arguments, it returns you to your login directory. In csh(l) you may
specify a list of directories in which directory is to be sought as a subdirectory if it is not a subdirectory of
the current directory; see the description of the cdpath variable in csh(l).
SEE ALSO

csh(l), sh(l), pwd(l)

Sun Release 3.2

Last change: 26 April 1983

39

CDC(l)

USER COMMANDS

CDC(I)

NAME

cdc - change the delta commentary of an sees delta
SYNOPSIS
lusr/ucb/sccslcdc -rSID [ -m [ mr/ist ] ] [ -y [ comment] ] filename ...
DESCRIPTION
cdc changes the delta commentary, for the SID specified by the -r option, of each named sees filename.

Delta commentary is defined to be the Modification Request (MR) and comment information normally
specified via the delta command (-m and -y options).
If a directory is named, cdc behaves as though each file in the directory were specified as a narned
filename, except that non-Sees files (last component of the path name does not begin with s.) and unreadable files are silently ignored. If a name of - is given, the standard input is read (see WARNINGS); each line
of the standard input is taken to be the name of an sees file to be processed.
Arguments to cdc, which may appear in any order, consist of options and file names.
OPTIONS
All the described options apply independently to each named file:

-rSID

Specifies the Sees IDentification (SID) string of a delta for which the delta commentary is to
be changed.

-m [mrlist] If the sees file has the v flag set (see admin(l», a list of MR numbers to be added and/or
deleted in the delta commentary of the SID specified by the -r option may be supplied. A null
MR list has no effect.
MR entries are added to the list of MRs in the same manner as that of delta. In order to delete
an MR, precede the MR number with the character! (see EXAMPLES). If the MR to be
deleted is currently in the list of MRs, it is removed and changed into a "comment" line. A
list of all deleted MRs is placed in the comment section of the delta commentary and preceded
by a comment line stating that they were deleted.

If -m is not used and the standard input is a terminal, the prompt MRs? is issued on the standard output before the standard input is read; if the standard input is not a terminal, no prompt
is issued. The MRs? prompt always precedes the comments? prompt (see -yoption).
MRs in a list are separated by blanks and/or tab characters. An unescaped new-line character
terminates the MR list.
Note that if the v flag has a value (see admin(I», it is taken to be the name of a program (or
shell procedure) which validates the correctness of the MR numbers. If a non-zero exit status
is returned from the MR number validation program, cdc terminates and the delta commentary remains unchanged.
-y [comment]
Arbitrary text used to replace the comment(s) already existing for the delta specified by the-r
option. The previous comments are kept and preceded by a comment line stating that they
were changed. A null comment has no effect.

If -y is not specified and the standard input is a terminal, the prompt comments? is issued on
the standard output before the standard input is read; if the standard input is not a terminal, no
prompt is issued. An unescaped new-line character terminates the comment text
The exact permissions necessary to modify the sees file are documented in Source Code Control System.
Simply stated, they are either (1) if you made the delta, you can change its delta commentary; or (2) if you
own the file and directory you can modify the delta commentary.
EXAMPLES

40

Last change: 23 September 1985

Sun Release 3.2

CDC(I)

USER COMMANDS

CDC(I)

tutoria1% cdc -rl.6 -m"bI78-12345 !bI77-S4321 bI79-00001" -ytrouble s.file
adds bI78-12345 and bI79-00001 to the MR list, removes b177-54321 from the MR list, and adds the comment trouble to delta 1.6 of s.file.
tutoria1% cdc -rl.6 s.ftle
MRs? !bI77-S4321 bI78-12345 bl79-00001
comments? trouble
does the same thing.
WARNINGS

If sees file names are supplied to the cdc command via the standard input (- on the command line), then
the -m and -y options must also be used.
FILES

x-file
z-file

(see delta(l»
(see delta(1»

SEE ALSO
admin(I), comb(l), delta(I), get(I), help(I), prs(I), sccs(I), sccsdiff(I), sccsfile(5), va1(I), what(l)

Programming Utilities/or the Sun Workstation.
DIAGNOSTICS
Use help for explanations.

Sun Release 3.2

Last change: 23 September 1985

41

CFLOW( 1)

USER COMMANDS

CFLOW(I )

NAME

cflow- generate C flow graph
SYNOPSIS
cHow [-r] [-ix] [-i_] [ - is printed.
As an example, given the following infile.c:
int
i;

rnainO
{
fO;
gO;
fO;
}

fO
{

i= ho;
}
the command:
cflow -ix file.c
produces the output
1
main: intO, 
2
f: intO, 
3
h:<>
4
i: int, 
5
g:<>
When the nesting level becomes too deep, the -e option of pr(lV) can be used to compress the tab expansion to something less than every eight spaces.
SYSTEM V DESCRIPTION
The System V version of "cflow" in lusrlShin/cHow makes the C preprocessor cpp(l) search in
lusrlSinclude for include files before it searches in lusr/include.
OPTIONS

The following options are interpreted by cjlow:
-r

42

Reverse the "caller:callee" relationship producing an inverted listing showing the callers of each

Last change: 10 April 1986

Sun Release 3.2

CFLOW(I)

USER COMMANDS

CFLOW(I)

function. The listing is also sorted in lexicographical order by callee.

-ix
-i

Include external and static data symbols. The default is to include only functions in the flowgraph.
Include names that begin with an underscore. The default is to exclude these functions (and data if

-ix is used).
-dnurn The num decimal integer indicates the depth at which the flowgraph is cut off. By default this is a
very large number. Attempts to set the cutoff depth to a nonpositive integer will be met with contempt.
DIAGNOSTICS

Complains about bad options. Complains about multiple definitions and only believes the first. Other messages may come from the various programs used (e.g., the C-preprocessor).
SEE ALSO
as(I), cc(1V), cpP(I), lex(I), lint(lV), nm(I), pr(IV), yacc(I).
BUGS

Files produced by lex(l) and yacc(l) cause the reordering of line number declarations which can confuse
cflow. To get proper results, feed cflow the yacc or lex input.

Sun Release 3.2

Last change: 10 April 1986

43

CHECKNR(I)

USER COMMANDS

CHECKNR(I)

NAME

checknr - check nroff/troff files
SYNOPSIS

checknr [ -s] [ -f] [ -8 .xl.yl.x2.y2 ... .xn.yn] [ -c .xl.x2.x3 ... .xn ] [filename .•. J
DESCRIPTION

Checknr checks a list of nroff(l) or troff(l) input files for certain kinds of errors involving mismatched
opening and closing delimiters and unknown commands. If no files are specified, checknr checks the standard input. Delimiters checked are:
(I)

Font changes using \fx ... \tp.

(2)

Size changes using \sx ... \sO.

(3)

Macros that come in open ••• close forms, for example, the .TS and .TE macros which must
always come in pairs.

Checknr knows about the ms(7) and me (7) macro packages.
Checknr is intended to be used on documents that are prepared with checknr in mind. It expects a certain
document writing style for \f and \s commands, in that each \fx must be terminated with \tp and each \sx
must be terminated with \sO. While it will work to directly go into the next font or explicitly specify the
original font or point size, and many existing documents actually do this, such a practice will produce complaints from checknr. Since it is probably better to use the \tP and \sO forms anyway, you should think of
this as a contribution to your document preparation style.
OPTIONS
-s

Ignore \s size changes.

-f

Ignore \f font changes.

-8

Add pairs of macros to the list The pairs of macros are assumed to be those (such as .DS and
.DE) that should be checked for balance. The -8 option must be followed by groups of six characters, each group defining a pair of macros. The six characters are a period, the first macro name,
another period, and the second macro name. For example, to define a pair .BS and .ES, use
-8.BS.ES

-c

define commands which checknr would otherwise complain about as undefined.

SEE ALSO
nrofI(I), troff(I), ms(7), me(7), checkeq(l)
BUGS

There is no way to define a 1 character macro name using -8

44

Last change: 13 March 1984

Sun Release 3.2

CHGRP(l)

USER COMMANDS

CHGRP(l)

NAME

chgrp - change group
SYNOPSIS
cbgrp [ -r] [ -R ] group filename ...
DESCRIPTION
chgrp changes the group-ID of the filename(s) given as arguments to group. The group may be either a
decimal GID or a group name found in the group-ID file,/etc/group.

You must belong to the specified group and be the owner of the file, or be the superuser.
OPTIONS

-r

Force. Do not report errors.

-R

Recursive. chgrp descends through diretories supplied as arguments, setting the specified groupID as it proceeds. When symbolic links are encountered, their group is changed, but they are not
traversed.

FILES

tetc/group
SEE ALSO
chown(2), passwd(5), group(5)

Sun Release 3.2

Last change: 25 July 1986

45

CHMOD( IV)

USER COMMANDS

CHMOD( IV)

NAME

chmod - change mode
SYNOPSIS
chmod [ -tR ] mode filename •••
DESCRIPTION

Change the permissions, or mode, of a file or files. Only the owner of a file (or the superuser) may change
its mode.
The mode of each narned file is changed according to mode, which may be absolute or symbolic.
Absolute Modes
An absolute mode is an octal number constructed from the OR of the following modes:
400
read by owner

200
100

write by owner
execute (search in directory) by owner

040
020
010

read by group
write by group
execute (search) by group
read by others
write by others
execute (search) by others

004
002
001
4000
2000
1000

set user ID on execution
set group ID on execution
sticky bit, (see chmod (2) for more information)

Symbolic Modes
A symbolic mode has the form:

[ who ] op permission [ op permission ]•••
who is a combination of:
u
user's permissions
g
group permissions
o
others
a
all, or ugo

If who is omitted, the default is a, but the setting of the file creation mask (see umask in sh(l) or
csh(l) for more information) is taken into account. When who is omitted, chmod will not override
the restrictions of your user mask.
opis one of:
+
to add the permission
to remove the permission
to assign the permission explicitly (all other bits for that category, owner, group, or others, will be reset).

=

permission is any combination of:
r
read
w
write
x
execute
X
give execute permission if the file is a directory or if there is execute permission for one of the other user
s
set owner- or group-ID. This is only useful with u or g.
t
set the sticky bit to save program text between processes.

The letters u, g, or
class.

0

indicate that permission is to be taken from the current mode for the user-

Omitting permission is only useful with =, to take away all permissions.

46

Last change: 25 July 1986

Sun Release 3.2

CHMOD( IV)

USER COMMANDS

CHMOD(IV)

Multiple symbolic modes, separated by commas, may be given. Operations are performed in the order
specified.
SYSTEM V DESCRIPTION
If who is omitted in a symbolic mode, it does not take the file creation mask into account, but acts as if who
werea.
OPTIONS
-f

-R

Force. chmod will not complain if it fails to change the mode of a file.
recursively descend through directory arguments, setting the mode for each file as described
above. When symbolic links are encountered, their mode is not changed and they are not
traversed.

EXAMPLES
The first example denies write permission to others, the second makes a file executable by all if it is executable by anyone:

chmod o-w file
chmod +X file
SEE ALSO
Is(IV), sh(l), csh(l), chmod(2), chown(8)

Sun Release 3.2

Last change: 25 July 1986

47

CHSH( I)

USER COMMANDS

CHSH(I)

NAME

chsh - change default login shell
SYNOPSIS

chsh usernarne [ shell ]
DESCRIPTION
Chsh changes the login shell field of the user's password file entry. If no shell is specified, the shell reverts
to the default login shell/binlsh. To specify a shell other than Ibinlcsh, you must be the super-user.
EXAMPLES

angel% chsb billlbinlcsb
SEE ALSO
csh(l), passwd(I), passwd(5)

48

Last change: 22 December 1983

Sun Release 3.2

CLEAR ( 1)

USER COMMANDS

CLEAR(I)

NAME
clear - clear screen

SYNOPSIS
clear

DESCRIPTION
Clear clears your screen if this is possible. It looks in the environment for the terminal type and then in
letcltermcap to figure out how to clear the screen.

FILES
letcltermcap

Sun Release 3.2

terminal capability data base

Last change: 12 February 1985

49

USER COMMANDS

NAME

clear_colormap - clear the color map
SYNOPSIS

clear_colormap
DESCRIPTION

Clear_colormap clears your hardware colormap.

50

Last change: 21 August 1985

Sun Release 3.2

USER COMMANDS

CLEAR_FUNCTIONS ( 1 )

NAME

clear functions - reset state of selection service
SYNOPSIS

clear functions
DESCRIPTION

clearJunctions instructs the selection service that no function keys are currently depressed. It is useful in
cases where erroneous programs have reported a key press but not the corresponding release. The usual
symptom for this situation is that all selections are secondary (underscored rather than inverted), even
though no function keys are down.
FILES

lusrlbinlselection svc
SEE ALSO

Editing and the Text Facility, in Windows and Window-Based Tools, Beginner's Guide

Sun Release 3.2

Last change: April 4 1986

51

CLICK ( 1)

USER COMMANDS

CLICK(I)

NAME

click - control the keyboard keystroke click sound
SYNOPSIS
click [ -y ] [ -0

] [

-d keyboard device]

DESCRIPTION
Change the setting of the audible keyboard click. The default is no keyboard click. If you want to turn
clicking on then a good place to do it is in letclrc.local.

Only keyboards that support a clicker respond to this command. At the time of this writing, the only keyboard known to have a clicker is the Sun 3 keyboard
OPTIONS

-y

Yes, enable clicking.

-0

No, disable clicking.

-d keyboard device
Specify the keyboard device being set. The default is Idevlkbd.
SEE ALSO
kb(4S)
DIAGNOSTICS
A short help message is printed if an unknown flag is specified or if the -d switch is used and the keyboard
device name is not supplied. A diagnostic is printed if the keyboard device name can't be opened or is not
a keyboard type device.
BUGS

There is no way to determine the state of the keyboard click setting.

52

Last change: 18 December 1985

Sun Release 3.2

CLOCK ( 1)

USER COMMANDS

CLOCK ( 1)

NAME

clock, clocktool- display the time in a window
SYNOPSIS
clock [ -s] [ -t ] [ -r ] [ -d mdyaw] [ -f]
DESCRIPTION
clock is a standard tool provided with the SunView environment.

clock displays the current time in its own window. In its open state, clock shows the date and time textual
form. In its closed state, clock appears as a clock face which keeps time.
Note: In previous releases clock was known as clocktool. In the current release, clocktool is retained as a
symbolic link to clock.
OPTIONS
-r

-d

causes clock to use a square face with roman numerals in the iconic state. This replaces the
default round clock face.
display date information in a small area just below the clock face. The date information to be
displayed may include:
m
d
Y
a
w

the month,
the day of the month (1-31),
the year,
the string AM or PM, as appropriate,
the day of the week (Sun-Sat).

There is only room for 3 of these, but any 3 may be displayed in any sequence.

-f

Display the date and day of week on the clock face.

-s

start clock with the seconds turned on. By default, the clock starts with seconds turned off, and
updates every minute. With seconds turned on, it updates every second, and, if iconic, displays a
second hand.

-t

Test mode - ignore the real time, and instead run in a loop continuously incrementing the time by
one minute and displaying it.

clock also accepts all of the generic tool arguments discussed in suntoo1s(I).
When open, clock listens for keyboard input, toggling its state on four characters:
s or S

toggles the display of seconds.

torT

toggles the 'test' mode.

SEE ALSO
suntools(I), date(l)
FILES

lusrllib/fontslfixedwidthfonts/sail.r.6

BUGS
If you reset the system time, clock will not reflect the new time until you change its state closed, close it if open. To reset the system time, see date(I).

open it if

The date display doesn't go well with the round clock face.
The clock sometimes freezes. Bringing up the Frame Menu will unstick it.

Sun Release 3.2

Last change: 29 May 1986

53

CMDTOOL(I)

USER COMMANDS

CMDTOOL(l)

NAME

cmdtool - Run a shell (or other program) from the SunView text facility
SYNOPSIS

cmdtool [ -C] [-P n] [program [args] ]
DESCRIPTION
cmdtool is a standard tool provided with the SunView environment.

When invoked, cmdtool runs a program (usually a shell) in a text-based command subwindow. Typed
characters are inserted at the caret. If this program is a shell, it accepts commands and runs programs in
the usual way. (See BUGS below).
Text can be edited anywhere on the command line the same way as in any other text subwindow. Commands and their output are kept in a log which can be scrolled using the scrollbar. The log file can also be
edited, or even saved using the Save command in the text facility's pop-up menu. The Split command, also
in the pop-up menu, can be used to create two or more independently scrolling views of the log.
DEFAULTS OPTIONS

trty/Append_only-.log
TRUE is the standard default; it means that only the command line may be editted. FALSE permits editting of the entire log. See the descripton of Enable Edit below.
trtyllnsert_makes_caret_visible
This entry describes how hard the command subwindow should try to keep the caret visible.
Same_as_for_text
Is the standard default; it means that the setting for
Insert_makes_caret_visible will be taken from the Text category instead
of Tty when a command subwindow is created
If auto scroll
If the caret is showing, and an inserted newline would position it below the
bottom of the screen as determined by trextlLower_context, the text is
scrolled to keep it showing. The amount scrolled is controlled by
lTextlAuto_scroltby. See textedit (1) for more information.
Always
Upon any input action, if the caret is positioned off the screen, it is scrolled
back into view.
trty/Checkpoint_frequency
ois the standard default; it means that no checkpointing will take place. For a value n greater than
zero, checkpointing will take place after every nth edit Each character typed, each Get, and each
Delete counts as an edit If the transcript file is named Itmpltty.txt.OOOxxx, at each checkpoint, an
updated copy of the transcript will be saved in Itmpltty.txt.OOOxxx%%.
trextlEdit back char
Set the character for deleting the character preceding the caret Note: Stty erase has no effect; text
based tools only refer to the defaults database. The standard default is the DEL key.
trextlEdit back word
Set the character for deleting the word preceding the caret Note: Stty werase has no effect; text
based tools only refer to the defaults database. The standard default is CfRL-W.
lTextlEdit back line
Set the character for deleting from the newline preceding the caret to the caret Note: Stty kill has
no effect; text based tools only refer to the defaults database. The standard default is CTRL-U.
COMMANDLINE OPTIONS

54

-C

Redirect system console output to this instance of the cmdtool. This will prevent system error
messages from being printed in unexpected places on the screen. Moreover, since a cmdtool window is scrollable, messages that go off the top of the window can be scrolled back for reexamination.

-p n

Set the checkPoint frequency to n.

Last change: 30 September 1985

Sun Release 3.2

CMDTOOL(l)

USER COMMANDS

CMDTOOL(I)

cmdtool also takes generic tool arguments; see suntools (1) for a list of these arguments.
program [ args]
If a program argument is present, cmdtool executes it Subsequent arguments will be assumed to
be arguments of the program argument, .and will be passed to it for execution. If there are no
arguments, cmdtool runs the program corresponding to the SHELL environment variable. If this
environment variable is not available, then cmdtool runs !bin/she
THE COMMAND SUBWINDOW

The subwindow of cmdtool is a command sub window, which is also found in dbxtool and potentially in
other tools as well. The command subwindow is based on the text facility. For more information about the
text facility, see Windows and Window-Based Tools: Beginner's Guide. The pop-up menu associated with
command subwindow is the same as that for the text facility (see tutedit (1», with one additional item,
Enable Edit. The generic text menu items will not be described here except for Put, then Get, as it
approximates the functionality of StutT in shelltool (1), and is also implemented for shelltool.
Put, then Get
When there is a selection, this item reads Put, then Get. It causes the selection to be copied both
to the shelf and to the caret.
Put, then Get
When there is no selection but there is text on the shelf, Put, then is grayed out, though Get
remains active. Selecting this item causes the contents of the shelf to be copied to the caret. When
there is no selection and nothing is on the shelf, this item is inactive.

Enable Edit
If the defaults entry Append_onlyJog is set to TRUE, but at some point you want to edit the log,
selecting this menu item makes editting the log possible. When the log is editable, this item reads
Disable Edit, and selecting it makes the log read-only before the start of the command line.
Certain text facility accelerators that are especially useful in command subwindows are described here. See
tutedit (1) for more infonnation.
CTRL·RErUR.N

Holding down the control key while typing newline (carriage return) positions the caret at the bottom and scrolls it into view, as detennined by the defaults option ffextILower_context.
CfRL·P is an accelerator for the Put, then Get menu item described above.

CAPS-lock
Bound to F1, it causes subsequent keyboard input to be uppercase. This key is a toggle; striking it
a second time undoes the effect of the first strike.
FILES
Itmpltty .txlnnnnnn

-I.textswrc
SEE ALSO

shelltool(l), suntools( 1), textedit( 1), defaultsedit( 1),
Windows and Window-Based Tools: Beginner's Guide

BUGS
Full terminal emulation is not yet supported. Programs that use CBREAK or RAW mode, NO ECHO, or curses
do not work as expected. Some examples of manifestations of this deficiency include:
To send a command to more other than newline, the desired command must be followed by CfRL-D.
vi comes up in open mode.

The Mh command in mail doesn't work.
The password to su is echoed.

Sun Release 3.2

Last change: 30 September 1985

55

CMDTOOL(I)

CTRL-C

USER COMMANDS

CMDTOOL(I)

from a cmdtool running su but not started from a shell owned by root doesn't work.

•

The select system call never notices input on stdin.

•

rlogin double echos andCTRL-D kills rlogin, not just the program running from iL

Occasionally the program run from cmdtool unexplainably hangs.

56

Last change: 30 September 1985

Sun Release 3.2

USER COMMANDS

CMP( I)

CMP( I)

NAME

cmp - compare two files
SYNOPSIS

cmp [ -I] [ -s ] filel file2
DESCRIPTION
Cmp compares filel andfile2. If filel is '-', cmp reads from the standard input. Under default options,
cmp makes no comment if the files are the same; if they differ, it announces the byte and line number at
which the difference occurred. If one file is an initial subsequence of the other, that fact is noted
OPTIONS
-I

-s

Print the byte number (decimal) and the differing bytes (octal) for each difference.
Print nothing for differing files; return codes only.

SEE ALSO
diff(l), comm(l)
DIAGNOSTICS
Exit code 0 is returned for identical files, I for different files, and 2 for an inaccessible or missing argument

Sun Release 3.2

Last change: 29 April 1983

57

COL { IV)

USER COMMANDS

COL { IV)

NAME

col - filter reverse paper motions
SYNOPSIS

col [-bfbp]
SYSTEM V SYNOPSIS

lusr/5binlcol [ -bfpx ]
DESCRIPTION
col copies the standard input to the standard output and performs line overlays implied by reverse line
feeds (ESc-7 in ASCII) and by forward and reverse half line feeds (Esc-9 and Esc-8). col is particularly use-

ful for filtering multicolurnn output made with the .rt command of nroff and output resulting from use of
the tbl preprocessor.
The control characters SO (ASCII code '017"), and SI (016) are assumed to start and end text in an alternate
character set The character set (primary or alternate) associated with each printing character read is
remembered; on output, so and SI characters are generated where necessary to maintain the correct treatment of each character.
All control characters are removed from the input except space, backspace, tab, return, newline, ESC (033)
followed by one of 7, 8, 9, SI, SO, and vr (013). This last character is an alternate form of full reverse line
feed, for compatibility with some other hardware conventions. All other non-printing characters are
ignored.
SYSTEM V DESCRIPTION

The System V version of col converts spaces to tabs by default
OPTIONS

-b

col assumes that the output device in use is not capable of backspacing. In this case, if several
characters are to appear in the same place, only the last one read will be taken.

-f

Fine. Although col accepts half line motions in its input, it normally does not produce them on
output Instead, text that would appear between lines is moved to the next lower full-line boundary. The -f option suppresses this treatment - in this case the output from col may contain forward half line feeds (Esc-9), but will still never contain either kind of reverse line motion.

-b

Convert strings of blanks to tabs to decrease the printing time.

-p

Pass escape-sequences that col does not know about to the output, rather than stripping them out.
This option is highly discouraged unless you are fully aware of the position of the escape
sequences within the text

SYSTEM V OPTIONS

The -b, -f, and -p options are described above.
-x

Suppress converting spaces to tabs.

SEE ALSO

troff(1), tbl{l)
BUGS

col can't back up more than 128 lines.
At most 1600 characters, including backspaces, are allowed on a line.
Local vertical motions that would result in backing up over the first line of the document are ignored. As a
result, the first line must not have any superscripts.

58

Last change: 29 March 1986

Sun Release 3.2

COLCRT(l)

USER COMMANDS

COLCRT(l)

NAME

colcrt - filter nroff output for CRT previewing
SYNOPSIS

colert [ - ] [ -2 ] [filename ... ]
DESCRIPTION

Colert provides virtual half-line and reverse line feed sequences for terminals without such capability, and
on which overstriking is destructive. Half-line characters and underlining (changed to dashing '-') are
placed on new lines in between the normal output lines.
OPTIONS

Suppress all underlining - especially useful for previewing allboxed tables from tbl(l).
-2

Print all half-lines, effectively double spacing the output Normally, a minimal space output format is used which suppresses empty lines. Colert never suppresses two consecutive empty lines,
however. The -2 option is useful for sending output to the line printer when the output contains
superscripts and subscripts which would otherwise be invisible.

EXAMPLE

A typical use of eolert would be
tbl exum2.n 1 nroff -ms 1 colcrt - 1 more
SEE ALSO

nroff(l), troff(1), col(1V), more(l), ul(1)
BUGS

Can't back up more than 102 lines.
General overstriking is lost; as a special case 'I' overstruck with '-' or underline becomes' +'.
Lines are trimmed to 132 characters.
Some provision should be made for processing superscripts and subscripts in documents which are already
double-spaced.

Sun Release 3.2

Last change: 13 April 1983

59

COLRM(I)

USER COMMANDS

COLRM(I)

NAME

colrm - remove columns from a file
SYNOPSIS

colrm [starteol [endeol ] ]
DESCRIPTION

Colrm removes selected columns from a text file. The text is is taken from standard input and copied to the
standard output with the specified columns removed.
If only starteol is specified, the columns of each line are removed starting with starteol and extending to
the end of the line. If both starteol and endeol are specified, all columns between starteol and endeol,
inclusive, are removed.
Column numbering starts with column 1.
SEE ALSO

expand(l)

60

Last change: 13 April 1983

Sun Release 3.2

COMB(l)

USER COMMANDS

COMB(l)

NAME

comb - combine sees deltas
SYNOPSIS

lusrlsccslcomb [ -0 ] [ --s ] [ -p SID] [ -c list] filename ...
DESCRIPTION

Comb generates a shell procedure (see sh(l» which, when run, will reconstruct the given sees files. If a
directory is named, comb behaves as though each file in the directory were specified as a named file,
except that non-sees files Oast component of the path name does not begin with s.) and unreadable files
are silently ignored. If a name of - is given, the standard input is read; each line of the standard input is
taken to be the name of an sees file to be processed; non-sees files and unreadable files are silently
ignored. The generated shell procedure is written on the standard output.
OPTIONS

Options are explained as though only one named file is to be processed, but the effects of any option apply
independently to each named file.
-p SID The sees IDentification string (SID) of the oldest delta to be preserved. All older deltas are discarded in the reconstructed file.

-c list

A list of deltas to be preserved. All other deltas are discarded. See get(1) for the syntax of a list.

-0

For each get --e generated, the reconstructed file is accessed at the release of the delta to be
created. In the absence of the -0 option, the reconstructed file is accessed at the most recent
ancestor. Use of the -0 option may decrease the size of the reconstructed sees file. It may also
alter the shape of the delta tree of the original file.

--s

Generate a shell procedure which, when run, will produce a report giving, for each file: the file
name, size (in blocks) after combining, original size (also in blocks), and percentage change computed by:
100-.-(original---combinedfr original
It is recommended that before any sees files are actually combined, you should use this option to
determine exactly how much space is saved by the combining process.

If no options are specified, comb preserves only leaf deltas and the minimal number of ancestors needed to
preserve the tree.
FILES
s.COMB

comb?????

The name of the reconstructed sees file.
Temporary.

SEE ALSO

sccs(l), admin(l), delta(l), get(l), help(l), prs(1), sccsfile(5).
Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

Use help (1) for explanations.
BUGS

Comb may rearrange the shape of the tree of deltas. It may not save any space; in fact, it is possible for the
reconstructed file to actually be larger than the original.

Sun Release 3.2

Last change: 6 March 1984

61

COMM(l)

USER COMMANDS

COMM(l)

NAME

comm - select or reject lines common to two sorted files
SYNOPSIS
comm [ - [123] ] file1 file2
DESCRIPTION

Comm reads filel and file2, which should be ordered in ASCII collating sequence (see sort(l V», and produces a three column output: lines only infilel; lines only infile2; and lines in both files. The filenamemeans the standard input
Flags 1, 2, or 3 suppress printing of the corresponding column. Thus comm -12 prints only the lines common to the two files; comm -23 prints only lines in the first file but not in the second; comm -123 does
nothing.
SEE ALSO
cmp(l), diff(l), uniq(l)

62

Last change: 17 February 1986

Sun Release 3.2

COMPACT(I)

USER COMMANDS

COMPACT(I)

NAME

compact, uncompact, ccat - compress and uncompress files, and cat them
SYNOPSIS
compact [ filename •.• ]
uncompact [ filename. •• ]
ccat [ filename ••• ]
DESCRIPTION

Compact compresses the named files using an adaptive Huffman code. If no file names are given, the standard input is compacted to the standard output. Compact operates as an on-line algorithm. Each time a
byte is read, it is encoded immediately according to the current prefix code. This code is an optimal Huffman code for the set of frequencies seen so far. It is unnecessary to prepend a decoding tree to the
compressed file since the encoder and the decoder start in the same state and stay synchronized Furthermore, compact and uncompact can operate as filters. In particular:
.•• I compact I uncompact I •••
operates as a (very slow) no-oPe
When an argument file is given, it is compacted and the resulting file is placed infile.C; file is removed.
The first two bytes of the compacted file code the fact that the file is compacted. This code is used to
prohibit recompaction.
The amount of compression to be expected depends on the type of file being compressed. Typical values
of compression are: Text (38%), Pascal Source (43%), C Source (36%) and Binary (19%). These values
are the percentages of file bytes reduced.

Uncompact restores the original file from a file calledfile.C which was compressed by compact. If no file
names are given, the standard input is uncompacted to the standard output
Ccat cats the original file from a file compressed by compact. without uncompressing the file.
FILES

*.C

compacted file created by compact, removed by uncompact

SEE ALSO
Gallager, Robert G., 'Variations on a Theme of Huffman', I.E.E.E. Transactions on Information Theory.
vol. IT-24, no. 6, November 1978, pp. 668 - 674.

Sun Release 3.2

Last change: 1 November 1983

63

COMPRESS ( 1 )

USER COMMANDS

COMPRESS ( 1 )

NAME

compress, uncompress, zcat - compress and expand files
SYNOPSIS

compress [ -c] [ -f] [ -v ] [ -b bits] [filename . .. ]
uncompress [ -c] [ -v] [filename . .. ]
zeat [filename . .. ]
DESCRIPTION

compress reduces the size of the named files using adaptive Lernpel-Ziv coding. Whenever possible, each
file is replaced by one with the extension .Z, while keeping the same ownership modes, access and
modification times. If no files are specified, the standard input is compressed to the standard output.
The amount of compression obtained depends on the size of the input, the number of bits per code, and the

distribution of common substrings. Typically, text such as source code or English is reduced by 50-60%.
Compression is generally much better than that achieved by Huffman coding (as used in pack), or adaptive
Huffman coding (compact), and takes less time to compute. The bits parameter specified during compression is encoded within the compressed file, along with a magic number to ensure that neither decompression of random data nor recompression of compressed data is subsequently allowed.
Compressed files can be restored to their original form using uncompress.

zeat produces uncompressed output on the standard output, but leaves the compressed

.z file intact

OPTIONS

-c

Write to the standard output; no files are changed. The nondestructive behavior of zcat is identical
to that of uncompress -c.

-f

Force compression of name, even if it does not actually shrink or the corresponding name.z file
already exists.
Except when run in the background under Ibinlsh, if -f is not given and compress is run in the
foreground, the user is prompted as to whether an existing name file should be overwritten.

.z

-v

Verbose. Display the percentage reduction for each file compressed.

-b bits Set the upper limit (in bits) for common substring codes. bits must be between 9 and 16 (16 is the
default).
DIAGNOSTICS

Exit status is normally 0; if the last file was not compressed because it became larger, the status is 2. H an
error occurs, exit status is 1.
Usage: compress [-fvc] [-b maxbits] [file ...]
Invalid options were specified on the command line.
Missing maxbits Maxbits must follow -b.

file: not in compressed format
The file specified to uncompress has not been compressed.
file: compressed with xx bits, can only handle yy bits
file was compressed by a program that could deal with more bits than the compress code on this
machine. Recompress the file with smaller bits.
file: already has Z suffix -- no change
The file is assumed to be already compressed. Rename the file and try again.
file already exists; do you wish to overwrite (y or n)?
Respond "y" if you want the output file to be replaced; "n" if not.
uncompress: corrupt input
A SIGSEGV violation was detected, which usually means that the input file is corrupted.

64

Last change: 17 July 1986

Sun Release 3.2

COMPRESS ( 1 )

USER COMMANDS

COMPRESS ( 1 )

Compression: xx.xx%
Percentage of the input saved by compression. (Relevant only for -v.)
-- not a regular file: unchanged
When the input file is not a regular file, (e.g. a directory), it is left unaltered.
-- has xx other links: unchanged
The input file has links; it is left unchanged. See In (1) for more information.
-- file unchanged
No savings are achieved by compression. The input remains uncompressed.
SEE ALSO

A Technique for High Performance Data Compression, Terry A. Welch, IEEE Computer, vol. 17, no. 6
(June 1984), pp. 8-19.
compact( 1), pack( 1)

BUGS
Although compressed files are compatible between machines with large memory, -b12 should be used for
file transfer to architectures with a small process data space (64KB or less).

compress should be more flexible about the existence of the .Z suffix.

Sun Release 3.2

Last change: 17 July 1986

65

CP( 1)

USER COMMANDS

CP(I)

NAME

cp - copy files
SYNOPSIS

cp [ -i] [ -p ] filel file2
cp [ -i] [-p] [ -rR ]file ... directory
DESCRIPTION
filel is copied onto file2. The mode and owner of file2 are preserved if it already existed; the mode of the
source file, modified by the current umask, is used otherwise.

In the second form, one or more namedfiles are copied into directory with their original filenames.
cp refuses to copy a file onto itself.
OPTIONS

-i

Interactive: prompt the user with the name of the file whenever the copy would overwrite an old
file. Answering with 'y' means that cp should go ahead and copy the file. Any other answer will
prevent cp from overwriting the file.

-p

Preserve: attempt to preserve (duplicate) in its copies the modification times and modes of the
source files, ignoring the present umask.

-r
-R

Recursive: if any of the source files are directories, cp copies each subtree rooted at that name; in
this case the destination must be a directory.

EXAMPLES
To make a backup copy of goodies:
% cp goodies old.goodies

To copy an entire directory hierarchy:
% cp -r /usr/wendy/src /usr/wendylbackup

However, BEWARE of a recursive copy like this one:
% cp -r /usr/wendy/src /usr/wendy/srdbackup
which keeps copying files until it fills the entire file system.
SEE ALSO
cat(1V), pr(1V), mv(I), rcp(IC)

66

Last change: 16 February 1984

Sun Release 3.2

CPIO( 1)

USER COMMANDS

CPIO( 1)

NAME

cpio - copy file archives in and out
SYNOPSIS
cpio -0 [ aBcv ]

cpio -i [ bcdfmrsStuv6] [patterns]
cpio -p [adlmruv] directory
DESCRIPTION
cpio copies files into and out from a cpio copy archive. The archive (built by cpio -0) contains pathname
and status information, along with the contents of one or more archived files.
OPTIONS
cpio -0 Copy out as an archive. Reads the standard input for a list of pathnames, then copies the named
files to the standard output in archive form - including pathname and status information.

a

Reset the access times of input files after they have been copied.

B

Input/output is to be blocked at 5120 bytes to the record This does not apply to the pass
option. This option is only meaningful with data directed to or from raw magnetic devices, such as Idev/rmt?

c

Write header information in ASCII character form for portability.

v

Verbose option. A list of filenames is displayed When used with the t option, the table
of contents looks like the output of an Is -I command (see ls(1 V».

cpio -i Copy in an archive. Reads in an archive from the standard input and extracts files with names
matching filename substitution patterns, supplied as arguments.
patterns are similar to those in sh or csh, save that within cpio, the metacharacters ?, * and [••. ]
also match the slash (I) character. If no patterns are specified, the default is * (select all files).
b

Swap both bytes and halfwords after reading in data.

d

directories should be created as needed.

f

Copy in all files except those matching patterns.

m

Retain previous file modification time. This option is ineffective on directories that are
being copied.

r

Interactively rename files. If the user types a null line, the file is skipped.

s

Swap bytes after reading in data

S

Swap halfwords after reading in data.

t

Print a table of contents of the input archive. No files are created.

u

Copy unconditionally. Normally, an older file will not replace a newer file with the same
name.

6

Process a UNIX Version 6 file or files.

cpio -p One pass. Copies out and in in a single operation. Destination pathnames are interpreted relative
to the named directory .
Whenever possible, link files rather than copying them.
EXAMPLES
To copy the contents of a directory into an archive:

tutorial% Is I cpio -0 > Idev/mtO

Sun Release 3.2

Last change: 17 February 1986

67

CPIO( 1)

USER COMMANDS

CPIO( 1)

To duplicate the olddir directory hierarchy in the newdir directory:
tutorial% cd olddir
tutorial% find • -depth -print I cpio -pdl newdir
The trivial case
find • -depth -print

I cpio -oB

>/dev/rmtO

can be handled more efficiently by:
find. -cpio ldev/rmtlOm

cpio archive tapes from other sites may have bytes swapped within the archive. Although the s option only
swaps the data bytes and not those in the header cpio recognizes tapes like this and swaps the bytes in the
header automatically.
SEE ALSO

ar(1), find(I), cpio(5), tar(l)

BUGS
Pathnames are restricted to 128 characters. If there are too many unique linked files, cpio runs out of
memory and linking information is lost thereafter. Only the superuser can copy special files.

68

Last change: 17 February 1986

Sun Release 3.2

CPP( 1)

USER COMMANDS

CPP( 1)

NAME

cpp - the C language preprocessor
SYNOPSIS
Ilib/cpp [-P] [-c] [-M] [ -Uname ] [ -Dname ] [-Dname=def] [-T] [ -R] [ -Idir ]

[ifile [ofile ] ]
DESCRIPTION
Cpp is the C language preprocessor which is invoked as the first pass of any C compilation using the
cc(lV) command (cpp may optionally be invoked as the first pass of a FORTRAN 77 or Pascal compilation - see [17 (1) or pc (1». Thus the output of cpp is designed to be in a form acceptable as input to the
next pass of the compiler. The preferred way to invoke cpp is through the cc (1 V) command. See m4 (1 V)
for a general macro processor.

Cpp optionally accepts two file names as arguments. [file and ofile are respectively the input and output
for the preprocessor. They default to standard input and standard output if not supplied.
OPTIONS

-P

Preprocess the input without producing the line control information used by the next pass of the C
compiler.

-C

Pass all comments (except those which appear on cpp directive lines) through the preprocessor.
By default, cpp strips out C-style comments.

-M

Generate a list of makefile dependencies to the standard output. This list indicates that the object
file which would be generated from the input file depends on the input file and all the include files
referenced.

-Uname
Remove any initial definition of name, where name is a reserved symbol that is predefined by the
particular preprocessor. Following is the current list of these possibly reserved symbols. On Sun
computers, unix, m68k, and sun are defined (mc68000 is defined as well for backward compatibility). On Sun-2 computers, M68010 is also defined (mc68010 is defined as well for backward
compatibility); on Sun-3 computers, M68020 is also defined (mc68020 is defined as well for
backward compatibility).
ibm, gcos, os, tss, unix
operating system:
interdata, pdpl1, u370, u3b, u3b5, vax, m68k, M68010, M68020,
hardware:
sun
RES,RT
UNIX system variant:
tint (1 V):
lint

-Dname
Define name as 1 (one). This is the same as if a -Dname=l option appeared on the cpp command
line, or as if a #define name 1 line appeared in the source file that cpp is processing.

-Dname=def
Define name as if by a #define directive. This is the same as if a #define name de[ line
appeared in the source file that cpp is processing. The -D option has lower precedence than the
-U option. That is, if the same name is used in both a -U option and a -D option, the name will
be undefined regardless of the order of the options.
-T

Use only the first eight characters for distinguishing different preprocessor names. This option is
include for backward compatibility with systems which always use only the first eight characters.

-Idir

Change the algorithm for searching for #include files whose names do not begin with / to look in
dir before looking in the directories on the standard list. Thus, #include files whose names are
enclosed in " " will be searched for first in the directory of the current source file, then in directories named in -I options, and last in directories on a standard list. For #include files whose
names are enclosed in <>, the directory of the ifile argument is not searched. See the section entitled DETAILS below, for exact details of the search order.

Sun Release 3.2

Last change: 20 February 1986

69

CPP(I)

USER COMMANDS

-R

CPP( 1)

Allow recursive macros.

DIRECTIVES
All cpp directives start with lines begun by #. White space (blanks or tabs) can appear after the #. The

directives are:
#define nam£ token-string
Replace subsequent instances of nam£ with token-string.
#define nam£ ( arg, •••, arg) token-string
There can be no space between nam£ and the '('. Replace subsequent instances of nam£ followed
by a '(', a list of comma-separated tokens, and a '(' by token-string where each occurrence of an
arg in the token-string is replaced by the corresponding token in the comma-separated list.
#Undefnam£
Forget the definition of nam£ (if any) from now on.
#include "filenam£"
#include 
Include at this point the contents of filenam£ (which is then run through cpp). When the
 notation is used, filename is only searched for in the standard places. See DETAILS
below.
#line integer-constant ''filenam£''
Generate line control information for the next pass of the C compiler. Integer-constant is interpreted as the line number of the next line and filenam£ is interpreted as the file where it comes
from. If ''filenam£'' is not given, the current filename is unchanged.
#endif comment
Ends a section of lines begun by a test directive (#if, #ifdef, or #ifndef). Each test directive must
have a matching #endif. The comm£nt can be used to associate the #endif with its opening #if.
#ifdef nam£
The lines following will appear in the output if and only if nam£ has been the subject of a previous
#define or a -D option without being the subject of an intervening #Undef.
#ifndef nam£
The lines following will not appear in the output if and only if name has been the subject of a previous #define or a -D option without being the subject of an intervening #Undef.
#if constant-expression
Lines following will appear in the output if and only if the constant-expression evaluates to
nonzero. All binary non-assignment C operators, including &&, II, and " are legal in constantexpression. The?: operator, and the unary -, !, and - operators, are also legal in constantexpression. The precedence of the operators is the same as defined by the C language. There is
also a unary operator defined, which can be used in constant-expression in these two forms:
defined ( nam£ ) or defined nam£. This allows the effect of #ifdef and lifndef in a #if directive.
Only these operators, integer constants, and names which are known by cpp should be used in
constant-expression. In particular, the sizeof operator is not available.
#else cOmm£ntary
Reverses for the following lines the notion of the test directive currently in effect. So if lines previous to this directive are ignored, the following lines will appear in the output, and vice versa.
The cOmm£ntary can be used to associate the #else with its opening #if.

The test directives and corresponding #else directives can be nested.
DETAILS

Directory search order for #include files is:
1. the directory of the file which contains the #include request (that is, #include is relative to the file
being scanned when the request is made)

70

Last change: 20 February 1986

Sun Release 3.2

CPP( 1)

USER COMMANDS

CPP( 1)

2. the directories specified by -I options, in left-to-right order.
3. the standard directory(s) (/usr/include on UNIX systems).

Special Names: Two special names are understood by

cpp. The name __LINE__ is defined as the
current line number (a decimal integer) as known by cpp, and __FILE__ is defined as the current
filename (a C string) as known by cpp. They can be used anywhere (including in macros) just as any other
defined name.

A newline terminates a character constant or quoted string.
An escaped newline (that is, a backslash immediately followed by a newline) may be used in the body
of a #define statement to continue the definition onto the next line. The escaped newline is not included in
the macro body.

Comments are removed (unless the -C option is used on the command line). Comments are also
ignored, except that a comment terminates a token.
Macro formal parameters are recognized in #define bodies even inside character constants and quoted
strings. The output from:
#define abc(a) '\a'
abc (xyz)
is the seven characters '\xyz' (space, single-quote, escape character, x, y, z, single-quote). Macro names
are not recognized inside character constants or quoted strings during the regular scan. Thus:
#define abc xyz
printf(" abc");
does not expand 'abc' in the second line, because it is inside a quoted string which is not part of a #define
macro definition.

Macros are not expanded while processing a #define or #Undef. Thus:
#define abc bletch
#define xyz abc
#Undefabc
xyz
produces 'abc'. The token appearing immediately after a #ifdef or #ifndef is not expanded.

Macros are not expanded during the scan which determines the actual parameters to another macro
call. Thus:
#define reverse(first,second)second first
#define greeting hello
reverse~eeting,

#define greeting goodbye
)

produces' goodbye' (and warns about the redefinition of 'greeting').

Output consists of a copy of the input file, with modifications, plus lines of the form:
# lineno "filename" "level" -

indicating the original source line number and filename of the following
output line and whether this is the first such line after an include file has been entered (level=1), the first
such line after an include file has been exited (level=2), or any other such line (level is empty).

FILES
lusrlinclude

standard directory for #include files

SEE ALSO

cc(lV), m4(lV), t77(1), pc(l).
DIAGNOSTICS
The error messages produced by cpp are intended to be self-explanatory. The line number and filename
where the error occurred are printed along with the diagnostic.

Sun Release 3.2

Last change: 20 February 1986

71

CPP( 1)

USER COMMANDS

CPP( 1)

NOTES

When newline characters were found in argument lists for macros to be expanded, some previous versions
of cpp put out the newlines as they were found and expanded. The current version of cpp replaces these
newlines with blanks.

72

Last change: 20 February 1986

Sun Release 3.2

CRYPf(l)

USER COMMANDS

CRYPf( 1)

NAME

crypt - encode/decode
SYNOPSIS

crypt [password]
DESCRIPTION
crypt encrypts and decrypts the contents of a file. crypt reads from the standard input and writes on the
standard output The password is a key that selects a particular transformation. If no password is given,
crypt demands a key from the terminal and turns off printing while the key is being typed in. crypt

encrypts and decrypts with the same key:
tutorial% crypt key encrypted.file
tutorial% crypt key  ( and) form separate words; if paired, the pairs form single words. These shell metacharacters
can be made part of other words, and their special meaning can be suppressed by preceding them with a
backslash (\). A NEWLINE preceded by a \ is equivalent to a SPACE.

In addition, a string enclosed in matched pairs of single-quotes ( , ), double-quotes (" ), or backquotes ( .. ),
forms a partial word; metacharacters in such a string, including any SPACE or TAB characters, do not form
separate words. Within pairs of backquote ( .. ) or double-quote ( " ) characters, a NEWLINE preceded by a
backslash (\) gives a true NEWLINE character. Additional functions of each type of quote are described,
below, under Variable Substitution. Command Substitution. and Filename Substitution.
When the shell's input is not a terminal, the character # introduces a comment that continues to the end of
the input line. Its special meaning is suppressed when preceded by a \ or enclosed in matching quotes.
Command Line Parsing
A simple command is composed of a sequence of words. The first word (that is not part of an 110 redirection) specifies the command to be executed. A simple command, or a set of simple commands separated by
I or 1& characters, forms a pipeline. With I, the standard output of the preceding command is redirected to
the standard input of the command that follows. With I &, both the standard error and the standard output
are redirected through the pipeline.

Pipelines can be separated by semicolons ( ; ), in which case they are executed sequentially. Pipelines that
are separated by && or II form conditional sequences in which the execution of pipelines on the right
depends upon the success or failure, respectively, of the pipeline on the left.
A pipeline or sequence can be enclosed within parentheses "( )" to form a simple command that can be a
component in a pipeline or sequence.
A sequence of pipelines can be executed asynchronously, or "in the background" by appending an &;
rather than waiting for the sequence to finish before issuing a prompt, the shell displays the job number
(see Job Control. below) and associated process IDs, and prompts immediately.
History Substitution
History substitution allows you to use words from previous command lines in the command line you are
typing. This simplifies spelling corrections and the repetition of complicated commands or arguments.
Command lines are saved in the history list, the size of which is controlled by the history variable. The
most recent command is retained in any case. A history substitution begins with a ! (although you can
change this with the bistchars variable) and may occur anywhere on the command line; history substitutions do not nest. The! can be escaped with \ to suppress its special meaning.

Input lines containing history substitutions are echoed on the terminal after being expanded, but before any
other substititions take place or the command gets executed.
Event Designators
An event designator is a reference to a command-line entry in the history list
!
Start a history subsititution, except when followed by a SPACE, TAB, NEWLINE,

=

or (.
Refer to the previous command By itself, this substitution repeats the previous command.
!n
Refer to command-line n. !-n Refer to the current command-line minus n.
!str
Refer to the most recent command starting with str.
!?str[?] Refer to the most recent command containing str.
!{...}
insulate a history reference from adjacent characters (if necessary).

!!

Word Designators

A : separates the event specification from the word designator. It can be omitted if the word designator
begins with a A, $, *, - or %.
#
The entire command line typed so far.
The first input word (command).
n
The n 'th argument

o

76

Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

$
%

x-y

*
x*
x-

CSH( 1)

The first argument, that is, 1.
The last argument
The word matched by (the most recent) ?s search.
A range of words; -y Abbreviates O-y.
All the arguments, or a null value if there is just one word in the event.
Abbreviates x-So
Like x* but omitting word $.

Modifiers

After the optional word designator, you can add a sequence of one or more of the following modifiers, each
preceded by a :.
Remove a trailing pathname component, leaving the head.
Remove a trailing suffix of the form" .xxx" , leaving the basename.
Remove all but the suffix.
e
s1l/r[1] Substitute r for l.
Remove all leading pathname components, leaving the tail.
t
Repeat the previous substitution.
&
Apply the change globally, prefixing the above, for example, 'g&'.
g
Print the new command but do not execute it.
p
Quote the substituted words, escaping further substitutions.
q
Like q, but break into words at each SPACE, TAB or NEWLINE.
x
h
r

Unless preceded by a g the modification is applied only to the first string that matches l; an error results if
no string matches.
The left-hand side of substitutions are not regular expressions, but character strings. Any character can be
used as the delimiter in place of I. A backslash quotes the delimiter character. The character &, in the
right hand side, is replaced by the text from the left-hand-side. The & can be quoted with a backslash. A
null I uses the previous string either from a I or from a contextual scan string s from !?s. You can omit the
rightmost delimiter if a NEWLINE immediately follows r; the rightmost? in a context scan can similarly be

omitted.
Without an event specification, a history reference refers either to the previous command, or to a previous
history reference on the command line (if any).
Quick Substitution
Al Ar[A] This is equivalent to the history substitution: !:sAIAr[A].
Aliases

The C-Shell maintains a list of aliases that you can create, display, and modify using the alias and unalias
commands. The shell checks the first word in each command to see if it matches the name of an existing
alias. If it does, the command is reprocessed with the alias definition replacing its name; the history substitution mechanism is made available as though that command were the previous input line. This allows history substitutions, escaped with a backslash in the definition, to be replaced with actual command-line
arguments when the alias is used. If no history substitution is called for, the arguments remain unchanged.
Aliases can be nested. That is, an alias definition can contain the name of another alias. Nested aliases are
expanded before any history substitutions is applied. This is useful in pipelines such as
alias 1m 1s -1 \!* I more'
which when called, pipes the output of Is(IV) through more (1).
Execpt for the first word, the name of the alias may not appear in its definition, nor in any alias referred to
by its definition. Such loops are detected, and cause an error message.
1/0 Redirection

The following metacharacters indicate that the subsequent word is the name of a file to which the
command's standard input, standard output, or standard error is redirected; this word is variable, command,
and filename expanded separately from the rest of the command.

Sun Release 3.2

Last change: 24 July 1986

77

CSH( 1)

USER COMMANDS

<

CSH(1 )

Redirect the standard input

«word
Read the standard input, up to a line that is identical with word, and place the resulting lines in a
temporary file. Unless word is escaped or quoted, variable and command substitutions are performed on these lines. Then, invoke the pipeline with the temporary file as it's standard input
word is not subjected to variable, filename or command substitution, and each line is compared to
it before any substitutions are performed by the shell.

>

>!

>& >&!
Redirect the standard output to a file. If the file does not exist, it is created. If it does exist, it is
overwritten; its previous contents are lost.
When set, the variable noclobber prevents destruction of existing files. It also prevents redirection to terminals and Idevlnull, unless one of the! forms is used. The & forms redirect both standard output and the the standard error (diagnostic output) to the file.

»

»&

»!

»&!

Append the standard output Like >, but places output at the end of the file rather than overwriting
it If noclobber is set, it is an error for the file not to exist, unless one of the ! forms is used The
& forms append both the standard error and standard output to the file.
Variable Substitution
After an input line is aliased and parsed, and before each command is executed, variable substitution is performed 110 redirections are recognized before variable expansion is applied, and are variable-expanded
separately. Strings enclosed in backquotes (" ), even when they contain variable references, are interpreted
later (see Command Substitution). Otherwise, variable substitution is performed on the command name
and argument list together.
The C-Shell maintains a set of variables, each of which is composed of a name and a value. A variable
name consists of up to 20 letters and digits, and starts with a letter (the underscore is considered a letter).
A variable's value is a space-separated list of zero or more words. A references to a variable starts with a
$, and is replaced the words of that variable's value, by selected words from the value, or by information
about the variable, as described below. Braces can be used to insulate the reference from subsequent characters, which might otherwise be interpreted as part of it
Variable substitution can be suppressed by preceding the $ with a \, except within double-quotes where it
always occurs. Within single-quotes, variable substitution is suppressed. A $ is escaped if followed by a
SPACE, TAB orNEWUNE.
Variables can be created, displayed, or destroyed using the set and unset commands. Some variables are
maintained or used by the shell. For instance, the argv variable contains an image of the shell's argument
list Of the variables used by the shell, a number are toggles; the shell does not care what their value is,
only whether they are set or not
Numerical values can be operated on as numbers (as with the @ builtin). With numeric operations, an
empty value is considered to be zero; the second and subsequent words of multiword values are ignored.
For instance, when the verbose variable is set to any value (including an empty value), command input is
echoed on the terminal.
Command and filename substitution is subsequently applied to the words that result from the variable substitution, except when suppressed by double-quotes, when noglob is set (suppressing filename substitution), or when the reference is quoted with the :q modifier. Within double-quotes, a reference is expanded
to form (a portion of) a quoted string; multiword values are expanded to a string with embedded SPACEs.
When the :q modifier is applied to the reference, it is expanded to a list of SPACE-separated words, each of
which is quoted to prevent subsequent command or filename substitutions.
Except as noted below, it is an error to refer to a variable that is not set

$var
${var} These

78

are replaced by words from the value of var, each separated by a SPACE. If var is an
Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

CSH( 1)

environment variable, its value is returned (but : modifiers and the other forms given below are
not available).
$var [index]
${var [index]}

These select only the indicated words from the value of var. Variable substitution is applied to
index, which may consist of (or result in) a either single number, two numbers separated by a-,
or an asterisk. Words are indexed starting from '1'; a * selects all words. If the first number of a
range is omitted (as with '$argv[-2]'), it defaults to '1'. If the last number of a range is omitted
(as with '$argv[1-]'), it defaults to $#var (the word count). It is not an error for a range to be
empty if the second argument is omitted (or within range).

$#name
${#name}

These give the number of words in the variable.
$0

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

$n

${n} Equivalent to $argv[n].

$*

Equivalent to $argv[ *].

The modifiers :b, :t, :r, :q and :x can be applied (see History Substitution), as can :gb, :gt and :gr. If
braces ( { } ) are used, then the modifiers must appear within the braces. The current implementation allows
only one such modifier per expansion.
The following references may not be modified with: modifiers.
$?var
${?var} Substitutes the string' l' if var is set or '0' if it is not set

$?O

Substitutes' l' if the current input filename is known, or '0' if it is not

$$

Substitute the process number of the (parent) shell.

$<

Substitutes a line from the standard input, with no further interpretation thereafter. It can be used
to read from the keyboard in a C-Shell script

Command and Filename Substitutions
Command and filename substitutions are applied selectively to the arguments of builtin commands. Portions of expressions that are not evaluated are not expanded. For non-builtin commands, filename expansion of the command name is done separately from that of the argument list; expansion occurs in a subshell, after I/O redirection is performed
Command Substitution
A command enclosed by backquotes (' ... ' ) is performed by a subshell. Its standard output is broken into
separate words at each SPACE, TAB and NEWUNE; null words are discarded This text replaces the
backquoted string on the current command line. Within double-quotes, only NEWLINES force new words;
SPACE and TAB characters are preserved. However, a final NEWLINE is ignored. It is therefore possible
for a command substitution to yield a partial word.
Filename Substitution
Unquoted words containing any of the characters *, ?, [, or {, or that begin with -, are expanded (also
known as globbing) to an alphabetically sorted list of filenames, as follows:

*

Match any (zero or more) characters.

?

Match any single character.

[ ... ]

Match any single character in the enclosed list(s) or range(s). A list is a string of characters. A
range is two characters separated by a minus-sign (-), and includes all the characters in between
in the ASCII collating sequence (see ascii(7».

Sun Release 3.2

Last change: 24 July 1986

79

CSH( 1)

USER COMMANDS

CSH( 1)

{Sir ,sir ,...}

Expand to each string (or filename-matching pattern) in the comma-separated list. Unlike the
pattern-matching expressions above, the expansion of this construct is not sorted. For instance,
"{b,a}" expands to 'b' 'a', (not 'a' 'b'). As special cases, the characters { and }, along with the
string {}, are passed undisturbed.
Your home directory, as indicated by the value of the variable home, or that of user, as indicated
by the password entry for user.
Only the patterns. ? and [...] imply pattern matching; an error results if no filename matches a pattern
that contains them. The dot character (.), when it is the first character in a filename or patbname component, must be matched explicitly. The slash (I) must also be matched explicitly.
Expressions and Operators

A number of C-Shell builtin commands accept expressions, in which the operators are similar to those of C
and have the same precedence. These expressions typically appear in the @, exit, if, set and while commands, and are often used to regulate the flow of control for executing commands. Components of an
expression are separated by white space.
Null or missing values are considered '0'. The result of all expressions are strings, which may represent
decimal numbers.

The following C-Shell operators are grouped in order of precedence:
( ... )

~uping

one's complement
logical negation

• I %
multiplication, division, remainder (These are right associative, which can lead to unexpected
results. Group combinations explicitly with parentheses.)
+ addition, subtraction (also right associative)
« » bitwise shift left, bitwise shift right
< > <= >=
less than, greater than, less than or equal to, greater than or equal to
== != =- !equal to, not equal to, filename-substitution pattern match (described below), filename-substitution
pattern mismatch
&
bitwise AND
bitwise XOR (exclusive or)
I
bitwise inclusive OR
&&
logical AND
II
logical OR
The operators: ==, !=, =-, and !- compare their arguments as strings; other operators use numbers. The
oprators =- and !- each check whether or not a string to the left matches a filename substitution pattern on
the right. This reduces the need for switch statements when pattern-matching between strings is all that is
required.
Also available are file inquiries:
-r file
Returns true, or '1' if the user has read access. Otherwise it returns false, or '0' .
-w file
True if the user has write access.
-x file
True if the user has execute access.
-e file
True if file exists.
-0 file
True if the user owns file.
-zfile
True iffile is of zero length (empty).
-f file
True if file is a plain file.
-dfile
True iffile is a directory.

80

Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

CSH( I}

If file does not exist or is inaccessible, then all inquiries return false.
An inquiry as to the success of a command is also available:

{cmd}

If cmd runs successfully, the espression evaluates to true, '1'. Otherwise it evaluates
to false '0'. (Note that, conversely, cmd itself typically returns '0' when it runs successfully, or some other value if it encounters a problem. If you want to get at the
status directly, use the value of the status variable rather than this expression).

Control Flow
The shell contains a number of commands to regulate the flow of control in scripts, and within limits, from
the terminal. These commands operate by forcing the shell either to reread input (to loop), or to skip input
under certain conditions (to branch).

Each occurrence of a foreach, switch, while, if... then and else builtin must appear as the first word on its
own input line.
If the shell's input is not seekable and a loop is being rea~ that input is buffered. The shell performs seeks
within the internal buffer to accomplish the rereading implied by the loop. (To the extent that this allows,
backward goto commands will succeed on nonseekable inputs.)
Command Execution
If the command is a C-Shell builtin, the shell executes it directly. Otherwise, the shell searches for a file by
that name with execute access. If the command-name contains a /, the shell takes it as a pathname, and
searches for it If the command-name does not contain a /, the shell attempts to resolve it to a pathname,
searching each directory in the path variable for the command. To speed the search, the shell uses its hash
table (see the rehash builtin) to eliminate directories that have no applicable files. This hashing can be disabled with the -c or -t, options, or the unhash builtin.

As a special case, if there is no / in the in the name of the script and there is an alias for the word shell, the
expansion of the shell alias is prepended (without modification), to the command line. The system attempts
to execute the first word of this special (late-occurring) alias, which should be a full pathname. Remaining
words of the alias's definition, along with the text of the input line, are treated as arguments.
When a pathnarne is found that has proper execute permissions, the shell forks a new process and passes it,
along with its arguments to the kernel (using the execve(2) system call). The kernel then attempts to overlay the new process with the desired program. If the file is an executable binary (in a.out(5), the kernel
succeeds, and begins executing the new process. If the file is a text file, and the first line begins with #!, the
next word is taken to be the pathname of a shell (or command) to interpret that script. Subsequent words
on the first line are taken as options for that shell. The kernel invokes (overlays) the indicated shell, using
the name of the script as an argument

If neither of the above conditions holds, the kernel cannot overlay the file (the execve(2) call fails); the CShell then attempts to execute the file by spawning a new shell, as follows:

If the first character of the file is a #, a C-Shell is invoked.
Otherwise, a standard (Bourne) shell is invoked.
Signal Handling
The shell normally ignores QUIT signals. Background jobs are immune to signals generated from the keyboar~ including hangups. Other signals have the values that the C-Shell inherited from its environment.
The shell's handling of interrupt and terminate signals within scripts can be controlled by the onintr builtin. Login shells catch the TERM signal; otherwise this signal is passed on to child processes. In no case
are interrupts allowed when a login shell is reading the .logout file.
Job Control
The shell associates a numbered job with each command sequence, to keep track of those commands that
are running in the background or have been stopped with TSTP signals (typically "'z or "'Y). When a comman~ or command sequence (semicolon separated list), is started in the background using the & metacharacter, the shell displays a line with the job number in brackets, and a list of associated process numbers:

Sun Release 3.2

Last change: 24 July 1986

81

CSH( 1)

USER COMMANDS

CSH(I)

[1] 1234
To see the current list of jobs, use the jobs builtin command. The job most recendy stopped (or put into the
background if none are stopped) is referred to as the current job, and is indicated with a +. The previous
job is indicated with a -; when the current job is terminated or moved to the foreground, this job takes its
place (becomes the new current job).
To manipulate jobs, refer to the bg, fg, kill, stop and % builtins.
A reference to a job begins with a %. By itself, the percent-sign refers to the current job.
%

%+ %%
The current job.
%The previous job.
%j
Refer to job j as in: kill -9 %j. j can be a job number, or a string that uniquely specifies the
command-line by which it was started; rg %vi might bring a stopped vi job to the foreground, for
instance.
%?string
Specify the job for which the command-line uniquely contains string.
A job running in the background stops when it attempts to read from the terminal. Background jobs can
normally produce output, but this can be suppressed using the stty tostop command.

Status Reporting
While running interactively, the shell tracks the status of each job and reports whenever a finishes or
becomes blocked. It normally displays a message to this effect as it issues a prompt, so as to avoid disturbing the appearance of your input. When set, the notiry variable indicates that the shell is to report status
changes immediately. By default, the notiry command marks the current process; after starting a background job, type notify to mark it.
Builtin Commands
Builtin commands are executed within the C-Shell. If a builtin command occurs
pipeline except the last, it is executed in a subshell.

as any component of a

Null command. This command is interpreted, but perfonns no action.
alias [name [def] ]
Assign def to the alias name. def is a list of words that may contain escaped historysubstitution metasyntax. name is not allowed to be alias or unalias. If de! is omitted, the alias
name is displayed along with its current definition. If both name and del are omitted, all
aliases are displayed.
bg [%job] ...
Run the current or specified jobs in the background
break

Resume execution after the end of the nearest enclosingforeach or while loop. The remaining
commands on the current line are executed. This allows multilevel breaks to be written as a
list of break commands, all on one line.

breaksw

Break from a switch, resuming after the endsw.

case label: A label in a switch statement.
cd [dir]
chdir [dir] Change the shell's working directory to directory dire If no argument is given, change to the
home directory of the user. If dir is a relative pathname not found in the current directory,
check for it in those directories listed in the cdpath variable. If dir is the name of a shell variable whose value starts with a /, change to the directory named by that value.

82

continue

Continue execution of the nearest enclosing while or roreach.

default:

Labels the default case in a switch statement. The default should come after all case labels.
Any remaining commands on the command line are first executed.

Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

CSH( 1)

dirs [-I]
Print the directory stack, most recent to the left; the first directory shown is the current directory. With the -I argument, produce an unabbreviated printout; use of the - notation is
suppressed.
echo [ -n] list
The words in list are written to the shell's standard output, separated by spaces. The output is
terminated with a NEWLINE unless the -n option is used.
eval arg ... Reads the arguments as input to the shell, and executes the resulting command(s). This is usually used to execute commands generated as the result of command or variable substitution,
since parsing occurs before these substitutions. See tset(l) for an example of how to use eval.
exec command
Execute command in place of the current shell, which terminates.
exit [(expr)]
The shell exits, either with the value of the status variable, or with the value of the specified
by the expression expr.
fg % Uob] Bring the current or specified job into the foreground.
foreach var (wordlist)
end

The variable var is successively set to each member of wordlist. The sequence of commands
between this command and the matching end is executed for each new value of var. (Both
foreach and end must appear alone on separate lines.)
The builtin command continue may be used to continue the loop prematurely and the builtin
command break to terminate it prematurely. When this command is read from the terminal,
the loop is read up once prompting with '1' before any statements in the loop are executed.

glob wordlist
Perform filename expansion on wordlist. Like echo, but no \ escapes are recognized. Words
are delimited by null characters in the output.
goto label The specified label is filename and command expanded to yield a label. The shell rewinds its
input as much as possible and searches for a line of the form label: possibly preceded by
SPACE or TAB characters. Execution continues after the indicated line.
hashstat

Print a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding execs). An exec is attempted for each component of the path where the
hash function indicates a possible hit, and in each component that does not begin with a '/'.

history [-hr] [n]
Display the history list; if n is given, display only the n most recent events.
-r
-h

Reverse the order of printout to be most recent first rather than oldest first.
display the history list without leading numbers. This is used to produce files suitable
for sourcing using the -h option to source.

if (expr) command
If the specified expression evaluates to true, the single command with arguments is executed.
Variable substitution on command happens early, at the same time it does for the rest of the if
command. command must be a simple command, not a pipeline, a command list, or a
parenthesized command list Note that I/O redirection occurs even if expr is false, when command is not executed (this is a bug).
if (expr) then
else if (expr2) then

Sun Release 3.2

Last change: 24 July 1986

83

CSH( 1)

USER COMMANDS

CSH( 1)

else
endif

If expr is true, commands up to the fi~st else are executed. Otherwise, if expr2 is true, the
commands between the else if and the second else are executed. Otherwise, commands
between the else and the endif are executed. Any number of else if pairs are allowed, but only
one else. Only one endif is needed, but it is required. The words else and endif must be the
first nonwhite characters on a line. The if must appear alone on its input line or after an else.)

jobs [-I]

List the active jobs under job control.
-I

List process ids, in addition to the normal information.

kill [-sig] [Pid] [%job ] ...
kill -I
Send the TERM (terminate) signal, by default, or the signal specified, to the specified process
id, the job indicated, or the current job. Signals are either given by number or by name. There
is no default Typing 'kill' does not send a signal to the current job. If the signal being sent is
TERM (terminate) or HUP (hang up), then the job or process is sent a CONT (continue) signal as
well.
-I

List the signal names that can be sent.

limit [-b] [resource [max-use]]
Limit the consumption by the current process or any process it spawns, each not to exceed
max-use on the specified resource. If max-use is omitted, print the current limit; if resource is
omitted, display all limits.
-b

Use hard limits instead of the current limits. Hard limits impose a ceiling on the
values of the current limits. Only the superuser may raise the hard limits.

resource is one of:
cputime
file size
datasize
stacksize
coredumpsize

Maximum CPU seconds per process.
Largest single file allowed.
Maximum data size (including stack) for the process.
Maximum stack size for the process.
Maximum size of a core dump (file).

max-use is a number, with an optional scaling factor, as follows:
nb
nk
nm
mm:ss

Hours (for cputime).
n kilobytes. This is the default for all but cputime.
n megabytes or minutes (for cputime).
Minutes and seconds (for cputime).

login

Terminate a login shell and invoke login(l). The .logout file is not processed.

logout

Terminate a login shell.

nice [+n I-n] [command]
Increment the nice value for the shell or for command by n. The higher the nice value, the
lower the priority of a process, and the slower it runs. When given, command is always run in
a subshell, and the restrictions placed on commands in simple if commands apply. If command is omitted, nice increments the value for the current shell. If no increment is specified,
nice sets the nice value to 4. The range of nice values is from -20 to 20. Values of n outside
this range set the value to the lower, or to the higher boundary, respectively.

+n

-n

Increment the nice value by n.
Decrement by n. This argument can be used only by the super-user.

nobup [command]
Run command with hang ups ignored. With no arguments, ignore hangups throughout the
remainder of a script When given, command is always run in a subshell, and the restrictions
placed on commands in simple if commands apply. All processes detached with & are

84

Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

CSH( 1)

effectively nohup'ed.
notify [%job] .•.
Notify the user asynchronously when the status of the current, or of specified jobs, changes.
onintr [ - I label]
Control the action of the shell on interrupts. With no arguments, onintr restores the default
action of the shell on interrupts. (The shell terminates shell scripts and returns to the terminal
command input level). With the - argument, the shell ignores all interrupts. With a label
argument, the shell executes a goto label when an interrupt is received or a child process terminates because it was interrupted
popd [+n]
Pops the directory stack, and cds to the new top directory. The elements of the directory stack
are numbered from 0 starting at the top.
+n

Discard the n'th entry in the stack.

pushd [+n I dir]
Push a directory onto the directory stack. With no arguments, exchange the top two elements.
+n
dir

rehash

Rotate the n'th entry to the top of the stack and cd to it
push the current working directory onto the stack and change to dir.

Recompute the internal hash table of the contents of directories listed in the path variable to
account for new commands added.

repeatcountconunand
Repeat conunand count times command is subject to the same restrictions as with the one-line
if statement.

set [var [= value] ]
set var [n] word
With no arguments, set displays the values of all shell variables. Multiword values are
displayed as a parenthesized list. With the var argument alone, set assigns an empty (null)
value to the variable var. With arguments of the form var = value set assigns value to var,
where value is one of:

=

word
(wordlist)

A single word (or quoted string).
A space-separated list of words enclosed in parentheses.

Values are command and filename expanded before being assigned. The form set var[n]
word replaces the n 'th word in a multiword value with word.

=

setenv [var [ word] ]
,
With no arguments, setenv displays all environment variables. With the var argument sets the
environment variable var to have an empty (null) value. (By convention, environment variables are normally given upper-case names.) With both var and word arguments setenv sets
the environment variable name to the value word, which must be either a single word or a
quoted string. The most commonly used environment variables, USER, TERM and PATH, are
automatically imported to and exported from the csh variables user, term, and path; there is no
need to use setenv for these. In addition, the shell sets the PWD environment variable from the
csh variable cwd whenever the latter changes.
shift [variable]
The components of argv, or variable, if supplied, are shifted to the left, discarding the first
component. It is an error for the variable not to be set, or to have a null value.
source [-h] name
Reads commands from name. source commands may be nested, but if they are nested too deeply the shell may run out of file descriptors. An error in a sourced file at any level terminates
all nested SOU1Ce commands.

Sun Release 3.2

Last change: 24 July 1986

85

CSH(I)

USER COMMANDS

-h

CSH( 1)

Place commands from the the file name on the history list without executing them.

stop [%job] ...
Stop the current or specified background job.
suspend

Stops the shell in its tracks, much as if it had been sent a stop signal with AZ. This is most
often used to stop shells started by suo

switch (string)
case label:
breaksw
default:
breaksw
endsw

Each label is successively matched, against the specified string, which is first command and
filename expanded The file metacharacters *, ? and [ ... ] may be used in the case labels,
which are variable expanded. If none of the labels match before a 'default' label is found, execution begins after the default label. Each case statement and the default statement must
appear at the beginning of a line. The command breaksw continues execution after the
endsw. Otherwise control falls through subsequent case and default statements as with C. If
no label matches and there is no default, execution continues after the endsw.

time [command]
With no argument, print a summary of time used by this C-Shell and its children. With an
optional command, execute command and print a summary of the time it uses.
umask [value]
Display the file creation mask. With value set the file creation mask. value is given in octal,
and is XORed with the permissions of 666 for files and 777 for directories to arrive at the permissions for new files. Common values include 002, giving complete access to the group, and
read (and directory search) access to others, or 022, giving read (and directory search) but not
write permission to the group and others.
unalias pattern
Discard aliases that match (filename substitution) pattern. All aliases are removed by
unalias*.
unhash

Disable the internal hash table.

unlimit [-h] [resource]
Remove a limitation on resource. If no resource is specified, then all resource limitations are
removed. See the description of the limit command for the list of resource names.
-h

Remove corresponding hard limits. Only the super-user may do this.

unset pattern
Remove variables whose names match (filename substitution) pattern. All variables are
removed by unset *; this has noticeably distasteful side-effects.
unsetenv variable
Removes variable from the environment Pattern matching, as with unset is not performed.
wait

Wait for background jobs to finish (or for an interrupt) before prompting.

while (expr)
end

86

While exp~ is true (evaluates to non-zero), repeat commands between the while and the matching end statement. break and continue may be used to terminate or continue the loop prematurely. The while and end must appear alone on their input lines. If the shell's input is a

Last change: 24 July 1986

Sun Release 3.2

CSH(1)

USER COMMANDS

CSH( 1)

terminal, it prompts for commands with a question-mark until the end command is entered and
then perfonns the commands in the loop.
%Uob] [&]

Bring the current or indicated job to the foreground With the ampersand, continue running
job in the background.
@ [var =expr ]
@ [var[n] =expr

With no arguments, display the values for all shell variables. With arguments, the variable
var, or the n'th word in the value of var, to the value that expr evaluates to. (If [n] is supplied,
both var and its n 'th component must already exist)
If the expression contains the characters >, <, & or
placed within parentheses.

I, then at least this

part of expr must be

The operators *=, +=, etc., are available as in C. The space separating the name from the
assignment operator is optional. Spaces are, however, mandatory in separating components of
expr that would otherwise be single words.
Special postfix operators, + + and -- increment or decrement name, respectively.
Environment Variables and Predefined Shell Variables

Unlike the standard shell, the C-Shell maintains a distinction between environment variables, which are
automatically exported to processes it invokes, and shell variables, which aren't. Both types of variables
are treated similarly under variable substitution. The shell sets the variables argv, cwd, home, path,
prompt, sheD, and status upon initialization. The shell copies the environment variable USER into the shell
variable user, TERM into term, and HOME into borne, and copies each back into the respective environment variable whenever the shell variables are reset. PATH and path are similarly handled. You need only
set path once in the .cshrc or .login file. The environment variable PWD is set from cwd whenever the
latter changes. The following shell variables have predefined meanings:

argv

Argument list. Contains the list of command line arguments supplied to the current invocation
of the shell. This variable determines the value of the positional parameters $1, $2, and so on.

cdpath

Contains a list of directories to be searched by the cd, chdir, and popd commands, if the directory argument each accepts is not a subdirectory of the current directory.

cwd

The full pathname of the current directory.

echo

Echo commands (after substitutions), just before execution.

fignore

A list of filename suffixes to ignore when attempting filename completion. Typically the single word' .0'.

filec

Enable filename completion, in which case the EDT character CD) and the ESC character have
, special significance when typed in at the end of a terminal input line:
EDT
ESC

Print a list of all filenames that start with the preceding string.
Replace the preceding string with the longest unambiguous extension.

hardpaths If set, pathnames in the directory stack are resolved to contain no symbolic-link components.
histchars

A two-character string. The first character replaces! as the history-substitution character. The
second replaces the carat (A) for quick substitutions.

history

The number of lines saved in the history list. A very large number may use up all of the CShell's memory. If not set, the C-Shell saves only the most recent command

home

The user's home directory. The filename expansion of - refers to the value of this variable.

ignoreeor If set, the shell ignores end-of-file from terminals. This protects against accidentally killing a
C-Shell by typing a AD.
mail

Sun Release 3.2

A list of files where the C-Shell checks for mail. If the first word of the value is a number, it

Last change: 24 July 1986

87

CSH( 1)

USER COMMANDS

CSH(1 )

specifies a mail checking interval in seconds (default 5 minutes).
nobeep

Suppresses the bell during command completion when you ask the C-Shell to extend an ambiguous filename.

noclobber Restricts output redirection so that existing files are not destroyed by accident> redirections
can only be made to new files. »redirections can only be made to existing files.
noglob

Inhibit filename substitution. This is most useful in shell scripts once filenames (if any) are
obtained and no further expansion is desired.

nonomateh
Returns the filename substitution pattern, rather than an error, if the pattern is not matched.
Malformed patterns still result in errors.
notify

If set, the shell notifies you immediately as jobs are completed, rather than waiting until just
before issuing a prompt.

path

The list of directories in which to search for commands. path is initialized from the environment variable PATH, which the C-Shell updates whenever path changes. A null word
specifies the current directory. The default is typically: (. Insr/neb Ibin /nsr/bin). If path
becomes unset only full pathnames will execute. An interactive C-Shell will normally hash the
contents of the directories listed after reading .cshrc, and whenever path is reset. If new commands are added, use the rehash command to update the table.

prompt

The string an interactive C-Shell prompts with. Noninteractive shells leave the prompt variable unset. Aliases and other commands in the .cshrc file that are only useful interactively, can
be placed after the following test: if (S?prompt
0) exit, to reduce startup time for noninteractive shells. A! in the prompt string is replaced by the current event number. The default
prompt is hostname % for mere mortals, or hostname# for the super-user.

==

savehist

The number of lines from the history list that are saved in -I.history when the user logs out.
Large values for savehist slow down the C-Shell during startup.

shell

The file in which the C-Shell resides. This is used in forking shells to interpret files that have
execute bits set, but that are not executable by the system.

status

The status returned by the most recent command. If that command terminated abnormally,
0200 is added to the status. Builtin commands that fail return exit status '1', all other builtin
commands set status to '0'.

time

Controls automatic timing of commands. Can be supplied with one or two values. The first is
the reporting threshold in CPU seconds. The second is a string of tags and text indicating
which resources to report on. A tag is a percent sign (%) followed by a single upper-case
letter (unrecognized tags print as text):
%D
Average amount of unshared data space used in Kilobytes.
%E
Elapsed (wallclock) time for the command.
%F
Page faults.
%1
Number of block input operations.
%K
Average amount of unshared stack space used in Kilobytes.
%M
Maximum real memory used during execution of the process.
%0
Number of block output operations.
%P
Total CPU time - U (user) plus S (system) - as a percentage of E
(elapsed) time.
%S
Number of seconds of CPU time consumed by the kernel on behalf of the
user's process.
%U
Number of seconds of CPU time devoted to the user's process.
%W
Number of swaps.
%X
Average amount of shared memory used in Kilobytes.
The default summary display outputs from the %U, %S, %E, %P, %X, %D, %1, %0, %F

88

Last change: 24 July 1986

Sun Release 3.2

CSH( 1)

USER COMMANDS

CSH( 1)

and % W tags, in that order.
verbose

Display each command after history substitution takes place.

DIAGNOSTICS
You have stopped jobs.
You attempted to exit the C-Shell with stopped jobs under job control. An immediate second
attempt to exit will succeed, terminating the stopped jobs.
FILES

-I.cshrc
-/.login
-I.logout
-I. history
Ibinlsh
Itmplsh.
letclpasswd

Read at beginning of execution by each shell.
Read by login shells after' .cshrc' at login.
Read by login shells at logout.
Saved history for use at next login.
Standard shell, for shell scripts not starting with a '#'.
Temporary file for' «' .
Source of home directories for ,-name' .

LIMITATIONS
Words can be no longer than 1024 characters. The system limits argument lists to 10240 characters. The
number of arguments to a command which involves filename expansion is limited to 1/6'th the number of
characters allowed in an argument list. Command substitutions may substitute no more characters than are
allowed in an argument list. To detect looping, the shell restricts the number of alias substitutions on a single line to 20.
SEE ALSO
sh(l), printenv(I), access(2), execve(2), fork(2), pipe(2), tty(4), environ(5V)

Getting Started With UNIX: Beginner's Guide
Doing More With UNIX: Beginner's Guide
BUGS

When a command is restarted from a stop, the shell prints the directory it started in if this is different from
the current directory; this can be misleading (that is, wrong) as the job may have changed directories internally.
Shell builtin functions are not stoppablelrestartable. Command sequences of the form a ; b ; c are also not
handled gracefully when stopping is attempted If you suspend b, the shell never executes c. This is especially noticeable if the expansion results from an alias. It can be avoided by placing the sequence in
parentheses to force it into a subshell.
Control over terminal output after processes are started is primitive; use the Sun Window system if you
need better output control.
Shell procedures, as with the standard shell, should be provided.
Commands within loops, prompted for by ?, are not placed in the history list.
Control structures should be parsed rather than being recognized as builtin commands. This would allow
control commands to be placed anywhere, to be combined with I, and to be used with & and ; metasyntax.

It should be possible to use the : modifiers on the output of command substitutions. There are two problems with: modifier usage on variable substitutions: not all of the modifiers are available, and only one
modifier per substitution is allowed.
Quoting conventions are contradictory and confusing.
Symbolic links can fool the shell. Setting the hardpaths variable alleviates this.

set path should remove duplicate pathnames from the patbname list. These often occur because a shell
script or a .cshrc file does something like set path=(/usr/local lusrlhosts Spath) to ensure that the named
directories are in the pathname list.

Sun Release 3.2

Last change: 24 July 1986

89

CSH(I)

USER COMMANDS

CSH( 1)

The only way to direct the standard output and standard error separately is by invoking a subshell, as follows:
tutorial% ( command> outfile) >& errorflle
Although robust enough for general use, adventures into the esoteric periphery of the C-Shell may reveal
unexpected quirks.

90

Last change: 24 July 1986

Sun Release 3.2

CSPLIT(l)

USER COMMANDS

CSPLIT( 1)

NAME

csplit - context split
SYNOPSIS

csplit [ -f prefix] [ -k] [ -s ]ftlename argl [ ... argn]
DESCRIPTION

csplit reads the file whose name is filename and separates it into n+ 1 sections, defined by the arguments
argl through argn. H the filename argument is a -, the standard input is used. By default the sections are

placed in files named xxOO through xxn. n may not be greater than 99. These sections receive the following portions of the file:

xxOO
xxOI:

From the start of filename up to (but not including) the line indicated by argl (see OPTIONS
below for an explanation of these arguments.)
From the line indicated by argl up to the line indicated by arg2.

xxn:

From the line referenced by argn to the end offile.

csplit prints the character counts for each file created, and removes any files it creates if an error occurs.
OPTIONS
-f prefix

name the created files prefix 00 through prefixn.

-k

suppress removal of created files when an error occurs.

-s

suppress printing of character counts.

The arguments argl through argn can be a combination of the following selection operators:
Irexpl

A file is to be created for the section from the current line up to (but not including) the line containing the regular expression rexp. The current line then becomes the line containing rexp.
This argument may be followed by an optional + or - some number of lines (e.g., !Page/-S).

%rexp %

This argument is the same as Irexp I, except that no file is created for the selected section.

lineno

A file is to be created from the current line up to (but not including) lineno. The current line
becomes lineno.

{num}

Repeat argument. This argument may follow any of the above arguments. H it follows a rexp
type argument, that argument is applied num more times. If it follows lineno, the file will be
split every lineno lines (num times) from that point.

Enclose all rexp type arguments that contain blanks or other characters meaningful to the shell in the
appropriate quotes. Regular expressions may not contain embedded new-lines.
EXAMPLES

This example splits the file at every 100 lines, up to 10,000 lines.
csplit -k file

100

{99}

Assuming that prog.c follows the normal C coding convention of ending routines with a } at the beginning
of the line, this example will create a file containing each separate C routine (up to 21) in prog.c.
csplit -k prog.c

'%main(%'

'/"'}/+1'

{20}

SEE ALSO

ed(l), sh(I), regexp(3)
DIAGNOSTICS

Self-explanatory except for:
arg - out of range

Sun Release 3.2

Last change: 28 March 1986

91

CSPLIT( 1)

USER COMMANDS

CSPLIT(l)

which means that the given argument did not refer to a line between the current position and the end of the
file.

92

Last change: 28 March 1986

Sun Release 3.2

CTAGS(l)

USER COMMANDS

CTAGS(l)

NAME

ctags - create a tags file
SYNOPSIS
ctags [ -aBFtuvwx] [ -f tagsfile ] file . ..
DESCRIPTION
ctags makes a tags file for ex(1) from the specified C, Pascal, FORTRAN, YACC, and LEX sources. A tags
file gives the locations of specified objects (in this case functions and typedefs) in a group of files. Each
line of the tags file contains the object name, the file in which it is defined, and an address specification for
the object definition. Functions are searched with a pattern, typedefs with a line number. Specifiers are
given in separate fields on the line, separated by blanks or tabs. Using the tags file, ex can quickly find
these objects definitions.

Normally ctags places the tag descriptions in a file called tags; this may be overridden with the -f option.
Files with names ending in .c or .h are assumed to be C source files and are searched for C routine and
macro definitions. Files with names ending in .y are assumed to be YACC source files. Files with names
ending in .1 are assumed to be LEX files. Others are first examined to see if they contain any Pascal or FORTRAN routine definitions; if not, they are processed again looking for C definitions.
The tag main is treated specially in C programs. The tag formed is created by prepending M to the name of
the file, with a trailing .c removed, if any, and leading pathname components also removed. This makes use
of ctags practical in directories with more than one program.
OPTIONS

-a

append output to an existing tags file.

-B

use backward searching patterns (1 ... ?).

-F

use forward searching patterns (/ ...1) (default).

-x

produce a list of object names, the line number and file name on which each is defined, as well as
the text of that line and prints this on the standard output. This is a simple index which can be
printed out as an off-line readable function index.

-t

create tags for typedefs.

-v

produce on the standard output an index of the form expected by vgrind(l). This listing contains
the function name, file name, and page number (assuming 64 line pages). Since the output will be
sorted into lexicographic order, it may be desired to run the output through sort -f. Sample use:
ctags -v files I sort -f > index
vgrind -x index

-w

suppress warning diagnostics.

-u

update the specified files in tags, that is, all references to them are deleted, and the new values are
appended to the file. Beware: this option is implemented in a way which is rather slow; it is usually faster to simply rebuild the tags file.

FILES

tags

output tags file

SEE ALSO
ex(1), vgrind(l), vi(l)

BUGS
Recognition of functions, subroutines and procedures for FORTRAN and Pascal is done is a very simpleminded way. No attempt is made to deal with block structure; if you have two Pascal procedures in different blocks with the same name you lose.
The method of deciding whether to look for C or Pascal and FORTRAN functions is a hack.

Sun Release 3.2

Last change: 17 July 1986

93

CTAGS( 1)

USER COMMANDS

CTAGS(1 )

Does not know about #ifdefs.
Should know about Pascal types. Relies on the input being well formed to detect typedefs. Use of-tx
shows only the last line of typedefs.

94

Last change: 17 July 1986

Sun Release 3.2

CTRACE(1)

USER COMMANDS

CTRACE(1)

NAME

ctrace - C program execution trace
SYNOPSIS
ctrace [ -r functions] [ -v functions] [ ~ ] [ -x] [ -u] [ -e] [ -I n ] [ -s ] [ -t n] [ -P] [ -b ] [ -p 's' ]
[ -r f] [file]
DESCRIPTION

ctrace allows you to follow the execution of a C program, statement by statement. The effect is similar to
executing a shell procedure with the -x option. ctrace reads the C program in file (or from standard input
if you do not specify file), inserts statements to print the text of each executable statement and the values of
all variables referenced or modified, and writes the modified program to the standard output. You must put
the output of ctrace into a temporary file because the cc(1V) command does not allow the use of a pipe.
You then compile and execute this file.
As each statement in the program executes it will be listed at the terminal, followed by the name and value
of any variables referenced or modified in the statement, followed by any output from the statement.
Loops in the trace output are detected and tracing is stopped until the loop is exited or a different sequence
of statements within the loop is executed.
A warning message is printed every 1000 times through the loop to help you detect infinite loops. The
trace output goes to the standard output so you can put it into a file for examination with an editor or the
bfs(1) or tail(1) commands.
OPTIONS
The only options you will commonly use are:
-f functions Trace only these functions.
-v functions Trace all but thesefunctions.

You may want to add to the default formats for printing variables. long and pointer variables are always
printed as signed integers. Pointers to character arrays are also printed as strings if appropriate. char,
short, and int variables are also printed as signed integers and, if appropriate, as characters. double variables are printed as floating point numbers in scientific notation. You can request that variables be printed
in additional formats, if appropriate, with these options:
~

Octal.
Hexadecimal.
Unsigned.
Floating point.

-x
-u
-e

These options are used only in special circumstances:
-I n

-s

-t n

-P

Check n consecutively executed statements for looping trace output, instead of the default
of20. Use 0 to get all the trace output from loops.
Suppress redundant trace output from simple assignment statements and string copy function calls. This option can hide a bug caused by use of the = operator in place of the ==
operator.
Trace n variables per statement instead of the default of 10 (the maximum number is 20).
The DIAGNOSTICS section explains when to use this option.
Run the C preprocessor on the input before tracing it. You can also use the -D, -I, and-U
cc (1 V) options.

These options are used to tailor the run-time trace package when the traced program will run in a non-UNIX
system environment:
-b

-p s'
J

Sun Release 3.2

Use only basic functions in the trace code, that is, those in ctype(3), print/(3S), and
string (3). These are often available even in cross-compilers for microprocessors. In particular, this option is needed when the traced program runs under an operating system that
does not have signal(3),ffiush(3S), longjmp(3), or setjmp(3).
Change the trace print function from the default of 'printf('. For example, 'fprintf(stderr,'

Last change: 11 April 1986

95

CTRACE(I)

USER COMMANDS

CTRACE(I)

would send the trace to the standard error output.
Use file/in place of the runtime.c trace function package. This lets you change the entire
print function, instead of just the name and leading arguments (see the -p option).

-r r
EXAMPLE

If the file Ic.c contains this C program:
1 #include 
/* count lines in input */
2 mainO
3{
4
int c, nl;

5
6

7
8
9

10

nl =0;
while «c = getcharO) != EOP)
if (c = '\n')
++nl;
printf("%d\n", nl);

11 }
and you enter these commands and test data:
cc lc.c
a.out
1
CfRL-D,

the program will be compiled and executed. The output of the program will be the number 2, which is not
correct because there is only one line in the test data. The error in this program is common, but subtle. If
you invoke ctrace with these commands:
ctrace lc.c >temp.c
cc ternp.c
a.out
the output will be:
2 mainO
6
nl = 0;
/* nl == 0 */
7
while «c = getcharO) != EOF)
The program is now waiting for input If you enter the same test data as before, the output will be:
/* c == 49 or '1' */
8
if (c = '\n')
/* c == 10 or '\n' */
9
++nl;
/* nl == 1 */
7
while « c = getcharO) != EOF)
/* c == 10 or '\n' */
8
if (c = '\n')
/* c == 10 or '\n' */
9
++nl;
/* nl == 2 */
/* repeating */
If you now enter an end of file character (cntl-d) the final output will be:
/* repeated <1 time */
7
while c = getcharO) ! = EOF)
/* c == -1 */
10
printfC'%d\n", nl);
/* nl == 2 *12
/* return */

«

96

Last change: 11 April 1986

Sun Release 3.2

CTRACE(I)

USER COMMANDS

CTRACE(I)

Program output is printed at the end of the trace line for the nl variable. Also note the return comment
added by ctrace at the end of the trace output. This shows the implicit return at the terminating brace in the
function.
The trace output shows that variable c is assigned the value '1' in line 7, but in line 8 it has the value '\n'.
Once your attention is drawn to this if statement, you will probably realize that you used the assignment
You can easily miss this error during code reading.
operator in place of the equal operator

=

==.

USAGE
Execution-Time Trace Control
The default operation for ctrace is to trace the entire program file, unless you use the -f or -v options to
trace specific functions. This does not give you statement by statement control of the tracing, nor does it let
you turn the tracing off and on when executing the traced program.

You can do both of these by adding ctroffO and ctronO function calls to your program to tum the tracing
off and on, respectively, at execution time. Thus, you can code arbitrarily complex criteria for trace control with if statements, and you can even conditionally include this code because ctrace defines the
CTRACE preprocessor variable. For example:
#ifdef CTRACE
if (c == '!' && i > 1000)
cttonO;
#endif
You can also call these functions from dbx(l) if you compile with the -g option. For example, to trace all
but lines 7 to 10 in the primary source file, enter:
dbx a.out
when at 7 {call ctroffO; cont; }
when at 11 { call ctronO; cont; }

run
You can also turn the trace off and on by setting the static variable tr_ct_ to 0 and 1, respectively. This is
useful if you are using a debugger that cannot call these functions directly, such as adb(I).
DIAGNOSTICS
This section contains diagnostic messages from both ctrace and cc(1 V), since the traced code often gets
some cc warning messages. You can get cc error messages in some rare cases, all of which can be
avoided.
ctrace Diagnostics

warning: some variables are not traced in this statement
Only 10 variables are traced in a statement to prevent the C compiler "out of tree space; simplify
expression" error. Use the -t option to increase this number.
warning: statement too long to trace
This statement is over 400 characters long. Make sure that you are using tabs to indent your code,
not spaces.
cannot handle preprocessor code, use -P option
This is usually caused by #ifdef/#endif preprocessor statements in the middle of a C statement, or
by a semicolon at the end of a #define preprocessor statement.

'if ... else if

sequence too long
Split the sequence by removing an else from the middle.

possible syntax error, try -P option
Use the -P option to preprocess the ctrace input, along with any appropriate -D, -I, and -U
preprocessor options. If you still get the error message, check the WARNINGS section below.

Sun Release 3.2

Last change: 11 Apri11986

97

CTRACE(I)

USER COMMANDS

CTRACE( 1)

Cc Diagnostics

warning: floating point not implemented
warning: illegal combination of pointer and integer
warning: statement not reached
warning: sizeof returns 0
Ignore these messages.
compiler takes size offunction
See the ctrace "possible syntax error" message above.
yacc stack overflow
See the ctrace '''if ... else if sequence too long" message above.
out of tree space .. simplify expression
Use the -t option to reduce the number of traced variables per statement from the default of 10.
Ignore the "ctrace: too many variables to trace" warnings you will now get.
redeclaration of signal
Either correct this declaration of signal (3), or remove it and #include .
Warnings

You will get a ctrace syntax error if you omit the semicolon at the end of the last element declaration in a
structure or union, just before the right brace (}). This is optional in some C compilers.
Defining a function with the same name as a system function may cause a syntax. error if the number of
arguments is changed. Just use a different name.
ctrace assumes that BADMAG is a preprocessor macro, and that EOP and NULL are #defined constants.
Declaring any of these to be variables, e.g. "int EOP;", will cause a syntax error.

BUGS
ctrace does not know about the components of aggregates like structures, unions, and arrays. It cannot
choose a format to print all the components of an aggregate when an assignment is made to the entire
aggregate. ctrace may choose to print the address of an aggregate or use the wrong format (e.g., %e for a
structure with two integer members) when printing the value of an aggregate.

Pointer values are always treated as pointers to character strings.
The loop trace output elimination is done separately for each file of a multi-file program. This can result in
functions called from a loop still being traced, or the elimination of trace output from one function in a file
until another in the same file is called.
FILES

runtime.c

run-time trace package

SEE ALSO

signal(3), ctype(3), ffiush(3S), longjmp(3), printf(3S), setjmp(3), string(3)

98

Last change: 11 April 1986

Sun Release 3.2

CUT ( 1)

USER COMMANDS

CUT(I)

NAME
cut - remove selected fields from each line of a file
SYNOPSIS

cut -c list [filename . .. ]
cut -f list [ -de] [ -s ] [filename . .. ]
DESCRIPTION
Use cut to cut out columns from a table or fields from each line of a file; in data base parlance, it implements the projection of a relation. The fields as specified by list can be of fixed length, i.e., character positions as on a punched card, or of variable length can vary from line to line and be marked with a field delimiter character like tab (-r option). Cut can be used as a filter; if no files are given, the standard input is
used.
OPTIONS
-clist

-f list

By character position. list is a comma-separated list of integer field numbers (in increasing order),
with an optional- to indicate ranges:
1,4,7
characters 1, 4 and 7
1-3,8 characters 1 through 3, and 8
-5,10 characters (1) through 5, and 10
3characters 3 through (last)
By field position. Instead of character positions, list specifies fields that are separated a delimiter
(normally a TAB):

1,4,7

fields 1,4 and 7

Lines with no field delimiters are normally passed through intact (to allow for subheadings).
-de

Set the field delimiter to c. The default is a TAB. SPACE, or a character with special meaning to
the shell must be quoted.

-s

Suppress lines with no delimiter characters.

EXAMPLES
cut -d: -f1,5 /etc/passwd

name=who am i
DIAGNOSTICS
line too long
bad list lor ell option

no fields
SEE ALSO
grep(1 V), paste(I).

Sun Release 3.2

mapping of user IDs to names

cut -f 1 -d" " to set name to the current login name.
A line can have no more than 1023 characters or fields.
Missing -c or -f option or incorrectly specified list. No error occurs if a line
has fewer fields than the list calls for.
The list is empty.

Last change: 28 March 1986

99

CXREF( 1)

USER COMMANDS

CXREF(l)

NAME

cxref - generate C program cross-reference
SYNOPSIS
cxrer [ -c] [ -w[num] ] [ -ofile] [ -t ]files
DESCRIPTION
cxre/ analyzes a collection of C files and attempts to build a cross-reference table. cxref utilizes a special
option of cpp to include #define'd information in its symbol table. It produces a listing on standard output
of all symbols (auto, static, and global) in each file separately, or with the -c option, in combination. Each
symbol contains an asterisk (*) before the declaring reference.
SYSTEM V DESCRIPTION
The System V version of cxre/, run as /usr/Sbinicxrer, makes the C preprocessor search for include files in
/usr/Sinclnde before searching for them in /nsr/include.
OPTIONS
In addition to the -D, -I and -U options (which are identical to their interpretation by
cc(1 V»,thefollowingoptionsare cxre/:

-c

Print a combined cross-reference of all input files.

-w[num]
Width option which formats output no wider than num (decimal) columns. This option will
default to 80 if num is not specified or is less than 51.
-0 file

Direct output to namedfile.

-s

Operate silently; does not print input file names.

-t

Format listing for 80-column width.

SEE ALSO
cc(lV)
DIAGNOSTICS
Error messages are unusually cryptic, but usually mean that you cannot compile these files, anyway.
BUGS

cxre/ considers a formal argument in a #define macro definition to be a declaration of that symbol. For
example, a program that #includes ctype.h, will contain many declarations of the variable c.

100

Last change: 10 April 1986

Sun Release 3.2

DATE(lV)

USER COMMANDS

DATE(lV)

NAME
date - display or set the date
SYNOPSIS

date [ -u] [ -a [-]sssJ1J] [yynunddhhmm[.ss] ] [ +format]
SYSTEM V SYNOPSIS

date [ -u ] [ -a [-]sssJ1J] [ nunddhhmmfyy] ] [ +format]
DESCRIPTION
DESCRIPTION
If no argument is given, or if the argument begins with +, date displays the current date and time. Otherwise, the current date is set. Only the super-user may set the date.

yy is the last two digits of the year; the first mm is the month number; dd is the day number in the month; hh
is the hour number (24 hour system); the second mm is the minute number; .ss (optional) specifies seconds.
The year, month and day may be omitted; the current values are supplied as defaults.
If the argument begins with +, the output of date is under the control of the user. The format for the output
is similar to that of the first argument to print/(3S). All output fields are of fixed size (zero padded if necessary). Each field descriptor is preceded by % and will be replaced in the output by its corresponding value.
A single % is encoded by % %. All other characters are copied to the output without change. The string is
always terminated with a new-line character.
Field Descriptors:
n
insert a new-line character
t
insert a tab character
m
month of year - 01 to 12
day of month - 01 to 31
d
last 2 digits of year - 00 to 99
y
D
date as mrnIddlyy
hour - 00 to 23
H
M
minute - 00 to 59
S
second - 00 to 59
T
time as HH:MM:SS
j
day of year - 001 to 366
w
day of week - Sunday = 0
a
abbreviated weekday - Sun to Sat
h
abbreviated month - Jan to Dec
r
time in AMIPM notation
SYSTEM V SYNOPSIS
When setting the date, the first mm is the month number; dd is the day number in the month; hh is the hour
number (24 hour system); the second mm is the minute number; yy is the last 2 digits of the year number
and is optional. The current year is the default if no year is mentioned.
OPTIONS
-u
Display the date in GMT (universal time). The system operates in GMT; date normally takes
care of the conversion to and from local standard and daylight time. -u may also be used to
set GMT time.
-a [-]sssJff Using the adjtime(2) system call, tell the system to slowly adjust the time by ssslffseconds
(fff represents fractions of a second). This adjustment can be positive or negative. The
system's clock will be sped up or slowed down until it has drifted by the number of seconds
specified.
EXAMPLES
date 10080045
would set the date to Oct 8, 12:45 AM.

Sun Release 3.2

Last change: 16 July 1983

101

USER COMMANDS

DATE(IV)

DATE(IV)

If the year were 1986, and the date were so set,
date'+DATE: %m/%dI%y%nTIM:E: %H:%M:%S'

would generate as output:
DATE: 08/01/86
TIME: 14:45:05
FILES

lusr/adm!wtmp

to record time-setting

SEE ALSO

printf(3S), utmp(5)
DIAGNOSTICS

date: Failed to set date: Not owner
if you try to change the date but are not the super-user.
date: bad format character
if the field descriptor is not recognizable.

102

Last change: 16 July 1983

Sun Release 3.2

DBX( 1)

USER COMMANDS

DBX( 1)

NAME

dbx - source-level debugger for C, FORTRAN 77 and Pascal programs
SYNOPSIS

dbx [ -r] [ -i] [ -I dir] [ -k] [ -kbd] [obffile [ corefile] ]
DESCRIPTION

dbx is a utility for source-level debugging and execution of programs written in C, FORTRAN 77 and Pascal.
It accepts the same commands as dbxtool (1), using a standard terminal interface rather than the window
system.
obffile is an object file produced by cc(1 V),j77(1) or pc (1) (or a combination of them) with the appropriate
flag (-g) specified to produce symbol information in the object file.
If no obffile is specified, use the debug command to specify the program to be debugged The object file
contains a symbol table which includes the names of all the source files translated by the compiler to create
it These files are available for perusal while using the debugger.
If a file named corefile exists in the current directory or a corefile is specified, dbx can be used to examine
the state of the program when it faulted
Debugger commands in the file .dbxinit are executed immediately after the symbolic information is read, if
that file exists in the current directory, or in the user's home directory if .dbxinit doesn't exist in the current
directory.
OPTIONS

-r

Executes obifile immediately. Parameters follow the object file name (redirection is handled properly). If the program terminates successfully, dbx exits. Otherwise, dbxreports the reason for termination and waits for user response. dbx reads from /dev/tty when -r is specified and standard
input is a file or pipe.

-i

Forces dbx to act as though standard input is a terminal or terminal emulator.

-I dir

Adds dir to the list of directories that are searched when looking for a source file. Normally dbx
looks for source files in the current directory and in the directory where obifile is located. The
directory search path can also be set with the use command.

-k

Kernel debugging.

-kbd

Debugs a program that sets the keyboard into up/down translation mode. This flag is necessary if
the program you are debugging uses up/down encoding.

USAGE

Refer to dbx in Program Debugging Tools/or the Sun Workstation.
The most useful basic commands to know about are run to run the program being debugged, where to
obtain a stack trace with line numbers, print for displaying variables, and stop for setting breakpoints.
Filenames

Filenames within dbx may include shell metacharacters. The shell used for pattern matching is determined
by the SHELL environment variable.
Expressions

dbx expressions are combinations of variables, constants, procedure calls, and operators. Hexadecimal
constants must be preceded by a 'Ox' and octal constants by a '0'. Character constants must be enclosed in
single quotes. Expressions cannot involve strings, structures, or arrays, although elements of structures or
arrays may be used

Sun Release 3.2

Last change: 23 July 1986

103

DBX(I)

USER COMMANDS

DBX(I)

Operators

+-*/div%

add, subtract, multiply, divide, integer division, and remainder
«

»

&

1left shift, right shift, bitwise AND, bitwise OR, and bitwise complement

&

*

address of operator and contents of operator

< > <= >= == != !
less than, greater than, less than or equal, greater than or equal, equal to, not equal to, and
not
&&

II

logical AND, logical OR

sizeof (cast)

size of variable or type, and type cast

• ->

Field reference, pointed-to field reference (dot works for both in dbx).

Precedence and associativity of operators are the same as in C, and parentheses can be used for grouping.
If there is no corefile file, only expressions containing constants are available. Procedure calls require an

active child process.
Scope Rules

dbx uses the variables file and func to resovle scope conflicts. Their values are updated as files and functions are entered and exited during execution. You can also change them explicitly. When func is
changed, file is updated along with it, but not vice versa.
Execution and Tracing Commands

Stop the program being debugged and enter dbx.
run [ args ] [ < infile ] [> I »outfile ]
Start executing objfile, reading in any new information from it. With no args, use the argument list from the previous run command
args
Pass args as command-line arguments to the program.
< I> I»
Redirect input or output, or append output to a file.
rerun [ args ] [ < infile ] [ > I »outfile]
Like the run command, except that when args are omitted, none are passed to the program.
cont [ at source line ] [ sig signal]
Continue execution from where it stopped.
at sourceline Start from source line
sig signal
Continue as if signal had occurred. signal may be a number or a name as with
catch.
trace [ injunction] [if condition ]
trace sourceline [ if condition ]
trace function [ if condition ]
trace expression at sourceline [ if condition ]
trace variable [infunction ] [if condition]
Display tracing information. If no argument is specified, each source line is displayed before
execution. Tracing is turned off when the function or procedure is exited.
Display tracing information only while executing the function or procedure
in function

INTERRUPT

function.

if condition
sourceline
function

Display tracing information only if condition is true.
Display the line immediately prior to executing it. Source line-numbers from
another file are written as "filename" :n.
Display the routine and source line called from, parameters passed in, and
return value.

expression at sourceline
variable

104

Display the value of expression whenever sourceline is reached.
Display the name and value whenever variable changes.

Last change: 23 July 1986

Sun Release 3.2

DBX( 1)

USER COMMANDS

DBX(l)

stop at source line [ if condition ]
stop infunction [if condition]
stop variable [ if condition ]
stop if condition
Stop execution when the sourceline is reached, function is called, variable is changed, or condition becomes true.
when infunction { command ; [ command; ] ... }
when at sOUTceline { command ; [ command; ] ... }
when condition {command ; [ command; ] ... }
Execute the dbx command(s) when function is called, sourceline is reached, or condition is
true.
status [> filename ]
Display active trace, stop and when commands, and associated command numbers.
delete all
delete cmd-no [ ,cmd-no ] ...
Remove all traces, stops and whens, or those corresponding to each dbx cmd-no (as
displayed by status).
clear [ so urce line ]
Clear all breakpoints at the current stopping point, or at sourceline .
catch [ signal [ , signal] ... ]
Display all signals currently being caught, or catch signal before it is sent to the program
being debugged A signal can be specified either by name (with the SIG prefix omitted, as
with kill(l» or number. Initially all signals are caught except SIGHUP, SIGEMT, SIGFPE,
SIGKILL, SIGALRM, SIGTSfP, SIGCONT, SIGCHLD, and SIGWINCH.
ignore [ signal [ , signal] ... ]
Display all signals currently being ignored, or stop catching signal, which may be specified
by name or number as with catch.
step [ n ]
Execute the next n source lines. If omitted, n is taken to be '1'. Steps into functions.
next [ n ]
Execute the next n source lines. If omitted, n is taken to be '1'. Steps past functions.
Naming, Printing and Displaying Data

Variables from another function or procedure with the same name as one in the current block must be
qualified as follows:

r sourcefile ']function' variable
For Pascal variables there may be more than one function or procedure name, each separated by a
backquote.
print expression [ ,expression ] ...
Print the value of each expression, which may involve function calls. Program execution
halts when a breakpoint is reached, and dbx resumes.
display [ expression [ , expression ] ... ]
Print a list of the expressions currently being displayed, or display the value of each expression whenever execution stops.
undisplay [ expression [ , expression ] ... ]
Stop displaying the value of each expression whenever execution stops. If expression is a
constant, it refers shown by the display command with no arguments.
whatis identifier
whatis type Print the declaration of the given identifier or type. types are useful to print all the members
of a structure, union, or enumerated type.
which identifier
Print the fully-qualified name of the given identifier.
where is identifier
Print the fully qualified name of all symbols matching identifier.

Sun Release 3.2

Last change: 23 July 1986

105

DBX(I)

USER COMMANDS

assign variable

DBX(I)

=expression

set variable =expression

Assign the value of expression to variable. There is no type conversion for operands of differing type.
set81fpreg=wordl word2 word3
Treat the concatenation of word1 word2 word3 as a 96-bit, IEEE floating-point value and
assign it to the MC68881 floating-point register fpreg. (Supported only on Sun-3).
califunction (parameters )
Execute the named function. Arguments are passed according to the rules for the sourcelanguage of function.
where [n] List all, or the top n, active functions on the stack.
dump [function]
Display the names and values of local variables and parameters in the current or specified
function.

up [n]
down [ n ]

Move up (towards "main") or down the call stack, one or n levels.

File Access Commands

edit [filename lfunction ]
Edit the current source file, or the given filename or the file that contains function.
file [filename ]
Print the name of the current source file, or change the current source file to filename.
fune [function I program lobjfile
Print the name of the current function, or change to the given function, program, or objfile.
Also changes the current scope.
list [ startline [ , endline ] ]
list function List the next ten lines from current source file, list from startline through endline, or and list
from five lines above, to five lines below the first line offunction.
use [ directory-list ]
Print or set the list of directories in which to search for source files.
cd [ directory ]
Change the current working directory for dbx to directory (or to the value of the HOME
environment variable).
pwd
Print the current working directory for dbx.
Ireg-ap[/]
?reg-exp [ ? ]
Search the current file for the regular expression reg-exp, from the next {previous} line to the
end (top). The matching line becomes the new current line.
Miscellaneous Commands

sh command-line
Pass the command line to the shell for execution. The SHELL environment variable determines which shell is used.
alias new-command-name character-sequence
Respond to new-command-name as though it were character-sequence. Special characters
occurring in character-sequence must be enclosed in quotation marks. Alias substitution as
with the C-Shell (csh (1» also occurs.
help [ command ]
Display a synopsis of dbx commands, or print a short message explaining command.
make
Invoke make (l) with the name of the program as its argument. Any arguments set using
dbxenv makeargs are also passed as arguments.
source filename
Read and execute dbx commands fromfilename. Useful when thefilename has been created
by redirecting an earlier status command
quit
Exit dbx.

106

Last change: 23 July 1986

Sun Release 3.2

DBX( 1)

USER COMMANDS

DBX(I)

dbxenv
dbxenv case sensitive I insensitive
dbxenv fpaasm on I off
dbxenv fpabase a[0-7] I off
dbxenv makeargs string
dbxenv stringlen num
dbxenv speed seconds
Display dbx attributes or set the named attribute:
case
Controls whether upper- and lower-case characters are treated as different
values. The default is sensitive.
fpaasm
Controls FPA instruction disassembly. The default is on.
Sets the base register for FPA instruction disassembly. The default is off.
fpabase
makeargs
Sets arguments to pass to make (1). The default is "CC=cc -g".
Set the interval between execution during tracing. The default is 0.5 seconds.
speed
stringlen
Controls the maximum number of characters printed for a "char *" variable
in a C program. The default is 512.
debug [ -k ] [ objfile [ corefile I pid ] ]
With no arguments, print the name of the current program. With arguments, stop debugging
the current program and begin debugging objfile having either corefile or the current process
ID pid.
-k
Kernel debugging.
Stop debugging of the current program, but be ready to debug another.
kill
Detach the current program (process) from dbx. dbx will be unable to access or modify its
detach
state.
proc [pid] For kernel debugging. Display which process is mapped into the user area, or map pid to the
user area.
Machine-Level Commands
tracei [ address] [if condition ]
tracei [ variable ] [at address] [ if condition ]
Trace execution of a specific machine-instruction address.
stopi [ variable ] [ if condition ]
stopi [at address] [if condition]
Set a breakpoint at a machine instruction address.
stepi
nexti
Single step as in step or next, but do a single machine instruction rather than a source line.

address ,address I [mode ]
address I [count] [mode ]
Display the contents of memory starting at the first (or current) address up to the second
address, or until count items have been displayed. The initial display mode is X. The following modes are supported:
i
the machine instruction
d
word in decimal
D
longword in decimal
o
word in octal
long word in octal
x
word in hexadecimal
X
long word in hexadecimal
b
byte in octal
c
byte as a character
s
strings as characters terminated by a null
f
single precision real number
F
double-precision real number
E
extended-precision real number

o

Sun Release 3.2

Last change: 23 July 1986

107

DBX(l)

USER COMMANDS

DBX(l)

An address can be specified as an item from the following list, or as and expression made up
of other addresses and the operators' +', '-', '*', and indirection (unary '*').
&name
symbolic address
$d[0-7]
data registers
$a [0-7]
address registers
$fp
frame pointer, equivalent to register a6
stack pointer, equivalent to register a7
$pc
program counter
$ps
program status
$fp[O-7]
MC68881 data registers
$fpc
MC68881 control register
$fps
MC68881 status register
$fpi
MC68881 instruction address register
$fpf
MC68881 flags register (unused, idle, busy)
$fpg
MC68881 floating-point signal type
double-precision interpretation of FPA registers.
$fpa[0-31]
$sfpa[0-31] single-precision interpretation of FPA registers.

ssp

address = [mode ]
Display the value of the address.
ENVIRONMENT
dbx checks the environment variable EDITOR for the name of the text editor to use with the edit command.
FILES

core
-I.dbxinit

default core file
initial commands

SEE ALSO
cc(1V), 07(1), pc(l)

Debugging Tools/or the Sun Workstation
BUGS

dbx does not correctly handle C variables that are local to compound statements. When printing these variables it often gives incorrect results.
dbx does not handle FORTRAN entry points well- it treats them as if they were independent routines.
dbx does not handle assigning to FORTRAN complex types correctly (see the assign/set command).
Some operations behave differently in dbx than in C:

dbx has two division operators - / always yields a floating-point result and div always
yields an integral result.
An array or function name does not signify the address of the array or function in dbx.
An array name signifies the entire array, and a function name signifies a call to the function with no arguments. The address of an array can be obtained by taking the address of
its first element, and the address of a function can be obtained by taking the address of its
name.

Casts do not work with FORTRAN 77 or Pascal.
Executable code incorporated into a source file using an #include preprocessor directive confuses dbx.

dbx is confused by the output of program generators such as yacc and lex.

108

Last change: 23 July 1986

Sun Release 3.2

DBXTOOL(l)

USER COMMANDS

DBXTOOL(I)

NAME

dbxtool- window- and mouse-based source-level debugger for C, FORTRAN 77, and Pascal programs
SYNOPSIS

dbxtool [ -i ] [ -I dir] [ -k] [ -kbd ] [objfile [ corefile ] ]
DESCRIPTION

dbxtool, a source-level debugger for C, Pascal and FORTRAN 77 programs, is a standard tool that runs
within the SunView environment It accepts the same commands as dbx, but provides a more convenient
user interface.

You can use the mouse to set breakpoints, examine the values of variables, control execution, peruse
source files, and so on. dbxtool has separate sub windows for viewing source code, entering commands and
other uses.
objfile is an object file produced by cc(1V),j77(1), or pc(l) (or a combination of them) with the appropriate flag (-g) specified to produce symbol information in the object file. IMPORTANT: every stage of the
compilation process, including the linking phase, must include the -g option. If no objfile is specified, you
can use the debug command to specify the program to be debugged The object file contains a symbol
table which includes the names of all the source files translated by the compiler to create it. These files are
available for perusal while using the debugger.
If a file named core exists in the current directory or a corefile is specified, dbxtool can be used to examine
the state of the program when it faulted

Debugger commands in the file .dbxinit are executed immediately after the symbolic information is read, if
that file exists in the current directory, or in the user's home directory if .dbxinit doesn't exist in the current
directory.
OPTIONS

-i

Force dbxtool to act as though standard input were a terminal.

-I dir

Add dir to the list of directories that are searched when looking for a source file. Normally
dbxtool looks for source files in the current directory and then in the directory where objfile is
located The directory search path can also be set with the use command. Multiple -I options
may be given.

-k

Kernel debugging.

-kbd

Debugs a program that sets the keyboard into up/down translation mode. This flag is necessary if
you are debugging a program that uses up/down encoding.

USAGE

Refer to dbx(l) for a summary of dbx commands, or Program Debugging Tools for the Sun Workstation
for more complete information on using dbxtool.
FILES

a.out
core

default object file
default core file

SEE ALSO

dbx(l), cc(l V), 07(1), pc(l)
Debugging Toolsfor the Sun Workstation
The SunView Application Programmer's Guide
BUGS

The bugs for dbx(l) apply to dbxtool as well.
The interaction between scrolling in the source subwindow and dbx 's regular expression search commands
is wrong. Scrolling should affect where the next search begins, but it does not.

Sun Release 3.2

Last change: 29 April 1986

109

DC(!)

USER COMMANDS

DC(l)

NAME

de - desk calculator
SYNOPSIS
de [file]
DESCRIPTION
Dc is an arbitrary precision arithmetic package. Ordinarily it operates on decimal integers, but one may
specify an input base, output base, and a number of fractional digits to be maintained. The overall structure
of de is a stacking (reverse Polish) calculator. If an argument is given, input is taken from that file until its
end, then from the standard input The following constructions are recognized:

number
The value of the number is pushed on the stack. A number is an unbroken string of the digits 0-9.
It may be preceded by an underscore _ to input a negative number. Numbers may contain decimal
points.

+ _/

*

%
The top two values on the stack are added (+), subtracted (-), multiplied (*), divided (/), remaindered (%), or exponentiated C). The two entries are popped off the stack; the result is pushed on
the stack in their place. Any fractional part of an exponent is ignored.
A

sx

The top of the stack is popped and stored into a register named x, where x may be any character. If
the s is capitalized, x is treated as a stack and the value is pushed on it.

h

The value in register x is pushed on the stack. The register x is not altered. All registers start with
zero value. If the I is capitalized, register x is treated as a stack and its top value is popped onto the
main stack.

d

The top value on the stack is duplicated.

p

The top value on the stack is printed The top value remains unchanged P interprets the top of the
stack as an ascii string, removes it, and prints it

f

All values on the stack and in registers are printed.

q

exits the program. If executing a string, the recursion level is popped by two. If q is capitalized,
the top value on the stack is popped and the string execution level is popped by that value.

x

treats the top element of the stack as a character string and executes it as a string of de commands.

X

replaces the number on the top of the stack with its scale factor.

[ ••• ]

puts the bracketed ascii string onto the top of the stack.

x

=X

The top two elements of the stack are popped and compared. Register x is executed if they obey the
stated relation.
v

replaces the top element on the stack by its square root Any existing fractional part of the argument is taken into account, but otherwise the scale factor is ignored.
interprets the rest of the line as a UNIX command.

e

All values on the stack are popped.
The top value on the stack is popped and used as the number radix for further input I pushes the
input base on the top of the stack.

110

o

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

o

pushes the output base on the top of the stack.

k

the top of the stack is popped, and that value is used as a non-negative scale factor: the appropriate
number of plac~s are printed on output, and maintained during multiplication, division, and
exponentiation. The interaction of scale factor, input base, and output base will be reasonable if all

Last change: 2 June 1983

Sun Release 3.2

DC(1 )

USER COMMANDS

DC(I)

are changed together.

z

The stack level is pushed onto the stack.

z

replaces the number on the top of the stack with its length.

?

A line of input is taken from the input source (usually the terminal) and executed.

,.

are used by be for array operations.

EXAMPLE
Print the first ten values of n!

[lal+dsa*plalO>y]sy
Osal
lyx
SEE ALSO
bc(I), which is a preprocessor for de providing infix notation and a C-like syntax which implements functions and reasonable control structures for programs.
DIAGNOSTICS
'x is unimplemented' where x is an octal number.
'stack empty' for not enough elements on the stack to do what was asked.
'Out of space' when the free list is exhausted (too many digits).
'Out of headers' for too many numbers being kept around.
'Out of pushdown' for too many items on the stack.
'Nesting Depth' for too many levels of nested execution.

Sun Release 3.2

Last change: 2 June 1983

111

DD(I)

USER COMMANDS

DD(I)

NAME

dd - convert and copy a file
SYNOPSIS
dd [option=value] ...
DESCRIPTION

dd copies a specified input file to a specified output with possible conversions. The standard input and output are used by default. The input and output block size may be specified to take advantage of raw physical I/O.
OPTION

VALUES

u=name

input file is taken from fUlme; standard input is default

of=name

output file is taken from name; standard output is default Note that tid creates an explicit output file; therefore the seek option is usually useless with explicit output except in
special cases such as using magnetic tape or raw disk files.

ibs=n

input block size n bytes (default 512).

obs=n

output block size n bytes (default 512).

bs=n

set both input and output block size, superseding ibs and obs; also, if no conversion is
specified, it is particularly efficient since no copy need be done

cbs=n

conversion buffer size

skip=n

skip n input records before starting copy

files=n

copy n input files before terminating (makes sense only when input is a magtape or similar device).

seek=n

seek n records from beginning of output file before copying. This option generally only
works with magnetic tapes and raw disk files and is otherwise usually useless if the
explicit output file was named with the of option.

count=n
conv=ascii
ebcdic
ibm
block
unblock
lcase
ucase
swab
noeTTor
sync
... , ...

copy only n input records
convert EBCDIC to ASCII
convert ASCII to EBCDIC
slightly different map of ASCII to EBCDIC
convert variable length records to fixed length
convert fixed length records to variable length
map alphabetics to lower case
map alphabetics to upper case
swap every pair of bytes
do not stop processing on an error
pad every input record to ibs
several comma-separated conversions

Where sizes are specified, a number of bytes is expected A number may end with k (kilobytes) to specify
multiplication by 1024, b (blocks of 512 bytes) to specify multiplication by 512, or w (words) to specify
multiplication by 4; a pair of numbers may be separated by x to indicate a product.
Cbs is used only if ascii, unblock, ebcdic, ibm, or block conversion is specified. In the first two cases, cbs
characters are placed into the conversion buffer, any specified character mapping is done, trailing blanks
trimmed and new-line added before sending the line to the output In the latter three cases, characters are
read into the conversion buffer, and blanks added to make up an output record of size cbs.
After completion, dd reports the number of whole and partial input and output blocks.
EXAMPLE

112

Last change: 23 September 1985

Sun Release 3.2

DD(l)

USER COMMANDS

DD(l)

To read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x:
tutorial% dd if=/dev/rmtO or=x ibs=800 cbs=80 conv=ascii,lcase
Note the use of raw magtape: dd is especially suited to I/O on the raw physical devices because it allows
reading and writing in arbitrary record sizes.
SEE ALSO
cP(l), tr(l V)
DIAGNOSTICS
f+p records in(out): numbers of full and partial records read(written)
BUGS
The ASCII/EBCDIC conversion tables are taken from the 256 character standard in the CACM Nov, 1968.
The ibm conversion, while less blessed as a standard, corresponds better to certain IBM print train conventions. There is no universal solution.
The block and unblock options cannot be combined with the ascii, ebcdic or ibm. Invalid combinations
silently ignore all but the last mutually-exclusive keyword

Sun Release 3.2

Last change: 23 September 1985

113

DEFAULTSEDIT ( 1 )

USER COMMANDS

DEFAULTSEDIT( 1)

NAME

defaultsedit,
defaults merge,
defaults from input
defaults to indentpro,
defaults to maitrc,
indentpro_ to_defaults, IOckscreen_default, tiailrc_to_defaults, scrolldefaults - window- and mouse-based
default parameters editor
SYNOPSIS

deraultsedit
DESCRIPTION

defaultsedit is a standard tool provided with the SunView environment.
defaultsedit presents a convenient user interface for inspecting and setting default parameters. It can be
viewed as a replacement for the traditional UNIX defaultsedit to manipulate options to the programs
indent, mail and mailtool, stty, and defaultsedit, as well as the menu, scrollbar, text subwindow and tty
subwindow packages and the SunView environment.

Any program or package which a user can customize by setting or changing a parameter could be written
such that it gets its options from the database manipulated through defaultsedit. For information on how to
do this see the chapter on the Defaults Database in the SunView System Programmer' s Guide.
OPTIONS

defaultsedit accepts all of the generic tool arguments discussed in suntools(1).
SUBWINDOWS

defaultsedit consists of four subwindows. From top to bottom they are:

control

contains the name of the category currently displayed, and buttons labeled SAVB, QUIT,
RESET, and EDIT ITEM. To change the category, click on the word CATEGORY with the
left mouse button, or use the menu that pops up when you click with the right mouse button.

message

a small text subwindow where messages from defaultsedit are displayed.

parameters

shows all current default parameter names with corresponding values. Clicking the left
mouse button over a parameter displays a help string in the message sub window.

edit

a small text subwindow which enables text editing of parameter values. This is useful for
very long text values, such as a long mailing list

USING DEFAULTS EDIT

SAVE

Saves the current values for all categories in your private database file in your home directory.

that is, the .defaults

QUIT

exits without saving any changes.

RESET

resets the default parameters of the current category to the values in your private database.
This is useful if you change some values, then change your mind and want to restore the original values.

EDIT ITEM Pressing the right mouse button over the EDIT ITEM button brings up a menu with three
choices: COpy ITEM, DELETE ITEM and EDIT LABEL. Only text or numeric items can
be edited. Also, note that edits made using this menu will appear only in your private
defaults database, not in the master database. The three editing operations are described
below.
COpy ITEM Selecting COpy ITEM causes the current item to be duplicated. You can then edit both the
label and the value of the the newly created item. Only items with text or numeric values
can be copied in this way. COpy ITEM is useful when you want to change the number of
instances of a certain type of item - for example, to insert a new mail alias into your
defaults database.
DELETE ITEM
Selecting DELETE ITEM will delete the current item from your private database. It cannot
be permanently deleted if the corresponding node is present in the master database.

114

Last change: 29 May 1986

Sun Release 3.2

DEFAULTSEDIT( 1)

USER COMMANDS

DEFAULTSEDIT( 1)

However, you can make it behave like an undefined node by giving it the special value

\255Undefined\255.
EDIT LABEL
Selecting EDIT LABEL allows you to edit the label of the current item. When you select
EDIT LABEL, the label of the current item changes from bold to normal face. Then you
can select the label and edit it as a normal panel text item.
FILES

-I.defaults
lusrllib/defaults/* .d
Note: A performance optirnzation may be enabled by setting the Private_only parameter in the Defaults
category. If this is set to True, only the user's private defaults file is consulted.
SEE ALSO
Windows and Window-Based Tools: Beginner's Guide

The SunView System Programmer's Guide
BUGS

Editing of choice items or categories is not supported by defaultsedit. Neither is editing of the master
defaults database - to add a new program to the master defaults database, you have to edit a master
defaults textfile.
Switching between certain categories may cause the database to be reread and over-write any changed
values. Therefore, using the "Save" button for each category changed is recommended.

Sun Release 3.2

Last change: 29 May 1986

115

DELTA ( 1)

USER COMMANDS

DELTA(I)

NAME

delta - make a delta (change) to an sees file
SYNOPSIS

lusrlsccs/delta [ -r SID] [ -s] [ -n ] [ -g list] [ -m [mrlist] ] [ -y [ comment]] [ -p ] file •••
DESCRIPTION
Delta permanently introduces into the named sees file changes that were made to the file retrieved by
get(1) (called the g-file, or generated file).

Delta makes a delta to each named sees file. If a directory is named, delta behaves as though each file in
the directory were specified as a named file, except that non-sees files (last component of the path name
does not begin with s.) and unreadable files are silently ignored. If a name of - is given, the standard input
is read (see WARNINGS); each line of the standard input is taken to be the name of an sees file to be processed.
Delta may issue prompts on the standard output depending upon certain options specified and flags (see
admin (1» that may be present in the sees file (see -m and -y options below).
OPTIONS

Options apply independently to each named file.
-r SID Uniquely identifies which delta is to be made to the sees file. The use of this option is necessary
only if two or more outstanding get's for editing (get -e) on the same sees file were done by the
same person (login name). The SID value specified with the -r option can be either the SID
specified on the get command line or the SID to be made as reported by the get command (see
get (1». A diagnostic results if the specified SID is ambiguous, or, if necessary and omitted on the
command line.

-s

Do not display the created delta's SID, number of lines inserted, deleted and unchanged in the
sees file.

-n

Retain the edited g-file which is normally removed at completion of delta processing.

-g list

Specifies a list of deltas to be ignored when the file is accessed at the change level (SID) created
by this delta. See get(l) for the definition of list.

-m [mrlist]

If the sees file has the v flag set (see admin(l», a Modification Request (MR) number must be
supplied as the reason for creating the new delta.
If -m is not used and the standard input is a terminal, the prompt MRs? is issued on the standard
output before the standard input is read; if the standard input is not a terminal, no prompt is issued.
The MRs? prompt always precedes the comments? prompt (see -y option).
MRs in a list are separated by blanks and/or tab characters. An unescaped new-line character terminates the MR list
Note that if the v flag has a value (see admin(1», it is taken to be the name of a program (or shell
procedure) which will validate the correctness of the MR numbers. If a non-zero exit status is
returned from MR number validation program, delta terminates (it is assumed that the MR
numbers were not all valid).
-y [comment]
Arbitrary text to describe the reason for making the delta. A null string is considered a valid comment.

If -y is not specified and the standard input is a terminal, the prompt comments? is issued on the
standard output before the standard input is read; if the standard input is not a terminal, no prompt
is issued. An unescaped new-line character terminates the comment text.
-p

116

Display (on the standard output) the sees file differences before and after the delta is applied in a
diff( 1) format

Last change: 6 March 1984

Sun Release 3.2

DELTA(I)

USER COMMANDS

DELTA(I)

FILES

All files of the form ?-file are explained in the Source Code Control System User's Guide. The naming
convention for these files is also described there.
g-file
p-file
q-file
x-file
z-file
d-file
Ibinldiff

Existed before the execution of delta; removed after completion of delta.
Existed before the execution of delta; may exist after completion of delta.
Created during the execution of delta; removed after completion of delta.
Created during the execution of delta; renamed to sees file after completion of delta.
Created during the execution of delta; removed during the execution of delta.
Created during the execution of delta; removed after completion of delta.
Program to compute differences between the "gotten" file and the g-file.

WARNINGS

Lines beginning with an SOH Asell character (binary 001) cannot be placed in the sees file unless the
SOH is escaped This character has special meaning to secs (see sccsfile(5» and will cause an error.
A get of many sees files, followed by a delta of those files, should be avoided when the get generates a
large amount of data Instead, multiple get/delta sequences should be used
If the standard input (-) is specified on the delta command line, the -m (if necessary) and -y options must
also be present. Omission of these options is an error.
SEE ALSO

sccs(I), admin(I), get(I), help(I), prs(l), sccsfile(5).

Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

Use help(l) for explanations.

Sun Release 3.2

Last change: 6 March 1984

117

DEROFF(l)

USER COMMANDS

DEROFF(l)

NAME

deroff - remove nroff, troff, tbl and eqn constructs
SYNOPSIS
deroff [ -w ] file •••
DESCRIPTION
Deroff reads each file in sequence and removes all nroff and troff command lines, backslash constructions,
macro definitions, eqn constructs (between' .EQ' and' .EN' lines or between delimiters), and table descriptions and writes the remainder on the standard output Deroff follows chains of included files (' .so' and
'.nx' commands); if a file has already been included, a '.so' is ignored and a '.nx' terminates execution. If
no input file is given, deroff reads from the standard input file.
OPTIONS

-w

Generate a word list, one word per line. A 'word' is a string of letters, digits, and apostrophes,
beginning with a letter; apostrophes are removed. All other characters are ignored.

SEE ALSO

troff(l), eqn(l), tbl(l)
BUGS

Deroff is not a complete troff interpreter, so it can be confused by subtle constructs. Most errors result in
too much rather than too little output.
Deroff does not work well with files that use .so to source in the standard macro package files.

118

Last change: 1 February 1985

Sun Release 3.2

DES ( 1)

USER COMMANDS

DES(l)

NAME

des - encrypt/decrypt with Data Encryption Standard
SYNOPSIS
des-e l-d [-b] [-f] [-kkey] [-s] [infile [ou¢le]]
DESCRIPTION
des encrypts and decrypts data using the NBS Data Encryption Standard algorithm. One of -e (for encrypt)

or -d (for decrypt) must be specified
The des command is provided to promote secure exchange of data in a standard fashion.
OPTIONS

-b

Select ECB (eight bytes at a time) encryption mode.

-f

Suppress warning message when software implementation is used

-k key Use the encryption key specified.

-s

Selects software implementation for the encryption algorithm.

Two standard encryption modes are supported by the des program, Cipher Block Chaining (CBC - the
default) and Electronic Code Book (ECB - specified with -b). CBC mode treats an entire file as a unit of
encryption, i.e., if insertions or deletions are made to the encrypted file then decryption will not succeed.
CBC mode also ensures that regularities in clear data do not appear in the encrypted data. ECB mode
treats each 8 bytes as units of encryptions, so if parts of the encrypted file are modified then other parts may
still be decrypted. Identical values of clear text encrypt to identical values of cipher text
The key used for the DES algorithm is obtained by prompting the user unless the -k key option is given. If
the key is an argument to the des command, it is potentially visible to users executing ps(l) or a derivative.
To minimize this possibility, des takes care to destroy the key argument immediately upon entry.
The des command attempts to use DES hardware for its job, but will use a software implementation of the
DES algorithm if the hardware is unavailable. Normally, a warning message is printed if the DES
hardware is unavailable since the software is only about lIS0th as fast However, the -f option will
suppress the warning. The -s option may be used to force use of software instead of hardware DES.
The des command reads from standard input unless infile is specified and writes to standard output unless
ou¢le is given.
The following sections give information required to implement compatible facilities in other environments.
Since the CBC and ECB modes of DES require units of 8 bytes to be encrypted, files being encrypted by
the des command have 1 to 8 bytes appended to them to cause them to be a multiple of 8 bytes. The last
byte, when decrypted, gives the number of bytes (0 to 7) which are to be saved of the last 8 bytes. The
other bytes of those appended to the input are randomized before encryption. If, when decrypting, the last
byte is not in the range of 0 to 7 then either the encrypted file has been corrupted or an incorrect key was
provided for decryption and an error message is printed.
The DES algorithm requires an 8 byte key whose low order bits are assumed to be odd-parity bits. The
ASCII key supplied by the user is zero padded to 8 bytes and the high order bits are set to be odd-parity
bits. The DES algorithm then ignores the low bit of each ASCII character, but that bit's information has
been preserved in the high bit due to the parity.
The CBC mode of operation always uses an initial value of all zeros for the initialization vector, so the first
8 bytes of a file are encrypted the same whether in CBC or ECB mode.
FILES

/dev/des?
BUGS

It would be better to use a real 56-bit key rather than an ASCTI-based 56-bit pattern. Knowing that the key
was derived from ASCII radically reduces the time necessary for a brute-force crytographic attack.

Sun Release 3.2

Last change: 23 September 1985

119

DES(l)

USER COMMANDS

DES ( 1)

RESTRICTIONS

This program is not available on software shipped outside the U.S.

120

Last change: 23 September 1985

Sun Release 3.2

DF( 1)

USER COMMANDS

DF(1)

NAME

df - report free disk space on file systems
SYNOPSIS
df [ -i] [ -t type ] [filesystem ... ] [filename ... ]
DESCRIPTION
df displays the amount of disk space occupied by currently mounted file systems, the amount of used and
available space, and how much of the file system's total capacity has been used. Used without arguments,
dfreports on all mounted file systems, producing something like:

tutorial% df
Filesystem kbytes
Idev/ipOa
7445
Idev/ipOg
42277

used avail capacity
4714 1986 70%
35291 2758 93%

Mounted on
I

lusr

Note that used+avail is less than the amount of space in the file system (kbytes); this is because the system
reserves a fraction of the space in the file system to allow its file system allocation routines to work well.
The amount reserved is typically about 10%; this may be adjusted using tunefs. When all the space on a
file system except for this reserve is in use, only the super-user can allocate new files and data blocks to
existing files. When a file system is overallocated in this way, df may report that the file system is more
than 100% utilized.
If arguments to df are disk partitions (for example, /devlipOa) or UNIX path names, df produces a report on
the file system containing the named file. Thus "df ." shows the amount of space on the file system containing the current directory.
OPTIONS

-i

Report the number of used and free inodes.

-t type Report on filesystems of a given type (for example, nfs or 4.2).

FILES

letc/mtab

list of currently mounted filesystems

SEE ALSO
du(1V), mtab(5), quot(8), tunefs(8)

Sun Release 3.2

Last change: 23 September 1985

121

DIFF( 1)

USER COMMANDS

DIFF( 1)

NAME

diff - show differences between the contents of files or directories
SYNOPSIS

diff [-biwt] [-e[#] l-e I-f I-n I-b] filename! filename2
difT [ -biwt] [ -Dstring] filename! filename2
difT [ -biwt] [ -e[#] l-e I-f I-n I-b] [ -I] [ -r] [ -s] [ -Sname] dir! dir2
DESCRIPTION
diff is a differential file comparator. When run on regular files, and when comparing text files that differ
during directory comparison (see the notes below on comparing directories), difftells what lines must be
changed in the files to bring them into agreement. Except in rare circumstances, diJ! finds a smallest
sufficient set of differences. If neither filename! nor filename2 is a directory, either may be given as -, in
which case the standard input is used. If filename! is a directory, a file in that directory whose filename is
the same as the filename offilename2 is used (and vice versa).

There are several options for output format; the default output format contains lines of these forms:
nl a n3,n4
nl,n2 dnJ
nl ,n2 c nJ ,n4

These lines resemble ed commands to convert filename! intofilename2. The numbers after the letters pertain to filename2. In fact, by exchanging a for d and reading backward one may ascertain equally how to
convertfilename2 intofilenamel. As in ed, identical pairs, where n! = n2 or n3 = n4, are abbreviated as a
single number.
Following each of these lines come all the lines that are affected in the first file flagged by <, then all the
lines that are affected in the second file flagged by>.
If both arguments are directories, diff sorts the contents of the directories by name, and then runs the regular file diJ! program as described above on text files which are different Binary files which differ, common
subdirectories, and files which appear in only one directory are listed.
OPTIONS

-b

ignore trailing blanks (spaces and tabs) and treat all other strings of blanks as equivalent.

-w

ignore all blanks (spaces and tabs); e.g., "if ( a == b )" will compare equal to "if(a==b)" .

-i

ignore the case of letters; e.g., "A" will compare equal to "a".

-t

expand tabs in output lines. Normal or -e output adds character(s) to the front of each line which
may screw up the indentation of the original source lines and make the output listing difficult to
intetpret This option will preserve the original source's indentation.

The following four options are mutually exclusive:
-e[#]

produces a listing of differences with lines of context. The default is to present 3 lines of context
and may be changed, (to 10, for example), by -elO. With -e the output format is modified
slightly: output begins with identification of the files involved and their creation dates, then each
change is separated by a line with a dozen *s. The lines removed fromfilenamel are marked with
- ; those added to filename2 are marked +. Lines which are changed from one file to the other are
marked in both files with! .
Changes which lie within  lines of each other are grouped together on output (This is a
change from the previous "diff -c" but the resulting output is usually much easier to intetpret.)

-e

122

produce a script of 8, c, and d commands for the editor ed, which will recreate filename2 from
filenamel.
In connection with -e, the following shell program may help maintain multiple versions of a file.
Only an ancestral file ($1) and a chain of version-ta-version ed scripts ($2,$3, ... ) made by diff
need be on hand. A 'latest version' appears on the standard output

Last change: 23 September 1985

Sun Release 3.2

DIFF( 1)

USER COMMANDS

DIFF( 1)

(shift; cat $*; echo '1,$p')I ed - $1
Extra commands are added to the output when comparing directories with --e, so that the result is
a sh script for converting text files which are common to the two directories from their state in
dir1 to their state in dir2.
-r

produce a script similar to that of --e, not useful with ed, which is in the opposite order.

-0

produce a script similar to that of -e, but in the opposite order and with a count of changed lines
on each insert or delete command.

-b

does a fast, half-hearted job. It works only when changed stretches are short and well separated,
but does work on files of unlimited length.

Options for the second form of diff are as follows:
-Dstring
create a merged version of filename] and filename2 on the standard output, with C preprocessor
controls included so that a compilation of the result without defining string is equivalent to compilingfilenamel, while defining string will yield filename2 .

Options when comparing directories are:
-I

long output format; each text file diff is piped through pr to paginate it, other differences are
remembered and summarized after all text file differences are reported.

-r

apply diff recursively to common subdirectories encountered.

-s

report files which are the same, which are otherwise not mentioned. -

-Sname

starts a directory diffin the middle, beginning with file name.
FILES

Itmpld?????
lusr/lib/difth for -b
Ibin/diff for directory diffs
lusrlbinlpr
SEE ALSO

cmp(I), comm(I), cpp(I), diff3(IV), ed(l)
DIAGNOSTICS

Exit status is 0 for no differences, 1 for some differences, 2 for trouble.
BUGS

Editing scripts produced under the --e or -r option are naive about creating lines consisting of a single'.'.
When comparing directories with the -b, -w, or -i options specified, diff first compares the files (as in
cmp), and then runs the regular diff algorithm if they are not equal. This may cause a small amount of
spurious output if the files then turn out to be identical because the only differences are insignificant blank
string or case differences.
The -D option ignores existing preprocessor controls in the source files, and can generate #irders's with
overlapping scope. The output should be checked by hand, or run through cc -E and then diffed with the
original source files. Discrpancies revealed should be corrected before compilation.
WARNINGS
Missing newline at end offile X

indicates that the last line of file X did not have a new-line. If the lines are different, they will be
flagged and output, although the output will seem to indicate they are the same.

Sun Release 3.2

Last change: 23 September 1985

123

USER COMMANDS

DIFF3( IV)

DIFF3( IV)

NAME

diff3 - 3-way differential file comparison
SYNOPSIS
difT3 [ -exEX3 ] file 1 file2 file3
SYSTEM V SYNOPSIS

lusrlSbinldifT3 [ -ex3 ] filel file2 file3
DESCRIPTION
diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes:

all three files differ
==== 1

filel is different

====2

file2 is different

====3

file3 is different

The types of differences between a given range within the given files is indicated in one of these ways:

f:nl a

Text is to be appended after line number nl in file f, where f = 1, 2, or 3.

f:nl,n2c Text is to be changed in the range line nl to line n2. IT nl = n2, the range may be abbreviated to
nl.
The original contents of the range follows immediately after a c indication. When the contents of two files
are identical, the contents of the lower-numbered file is suppressed.
OPTIONS
The options to diff3 instruct it to produce a script for the editor ed, rather than a list of differences. This
script will incorporate some or all of the differences between file2 and file3 into filel. This script will not
include a w or q command at the end, so that it will not write out the changed file.

-e

Produce a script that will incorporate all changes betweenfile2 andfile3, i.e. the changes that normally would be fiagged "====" and "====3".

-x

Produce a script that will incorporate only changes flagged "====".

-3

Produce a script that will incorporate only changes fiagged "====3".

-E

Produce a script that will incorporate aU changes between file2 and file3, but treat overlapping
changes (i.e., changes that would be flagged with "====" in the normal listing) differently. The
overlapping lines from both files will be inserted by the edit script, bracketed by "«««" and
"»»»" lines.

-x

Produce a script that will incorporate only changes flagged ====, but treat these changes in the
manner of the -E option.

For example, suppose lines 7-8 are changed in both filel and file2. Applying the edit script generated by
the command
difO -E filel file2 file3
to file 1 results in the file:
lines 1-6
of file 1

«««< filel
lines 7-8
of file 1
lines 7-8
offile3
»»»> file3

124

Last change: 17 July 1986

Sun Release 3.2

DIFF3( tV)

USER COMMANDS

DIFF3( tV)

rest of filel
SYSTEM V OPTIONS
The System V version of diff3 does not support the -E and -x options. The script produced by the -e, -x,
and -3 options does include a wand q command at the end, so that it will write out the changedfile.
EXAMPLES
The following command will incorporate all the changes between file2 and file3 into filel , and print the
resulting file to the standard output If the System V version of difj3 , is used, filel will be replaced with the
resulting file.

(diff3 -e filet file2 file3; echo '1,$p') I ed - filel
FILES

Itmpld3?????
lusrllibldiff3
lusrl5libldifj3prog
SEE ALSO
diff(l)

BUGS
Text lines that consist of a single. will defeat -e.

Sun Release 3.2

Lastchange: 17 July 1986

125

DIFFMK( I)

USER COMMANDS

DIFFMK(I)

NAME

diffmk: - mark differences between document files
SYNOPSIS

difTmk oldfile changedfile markedfile
DESCRIPTION
diffmk compares two versions of a file and creates a third file that includes "change mark" commands for
troff(I). name} and name2 are the old and new versions of the file. diffmk generates name3, which, contains the text from name2 with troff(l) "change mark" requests (.me) inserted where changedfile differs
from oldfile. When name3 is formatted, changed or inserted text is shown by I at the right margin of each
line. The position of deleted text is shown by a single *.

diffmk can also be used to produce listings of C (or other) programs with changes marked. A typical command line for such use is:
diffrnk old.c new.c tmp; nroff reqs tmp I pr
where the file reqs contains the commands:
.pl 1
.II 77
.nf
.eo
.nc
The .ll request might specify a different line length, depending on the nature of the program being printed.
The .eo and .De requests are probably needed only for C programs.
If the characters
them.

I and * are inappropriate,

you might run marked/tie through sed(lV) to globally change

SEE ALSO
diff(I), nroff(I), sed(IV)

BUGS
Aesthetic considerations may dictate manual adjustment of some output. File differences involving only
formatting requests may produce undesirable output, i.e., replacing .sp by .sp 2 will produce a "change
mark" on the preceding or following line of output.

126

Last change: 9 April 1986

Sun Release 3.2

DIRCMP(lV)

USER COMMANDS

DIRCMP(lV)

NAME

dircmp - directory comparison
SYNOPSIS

lusrlSbinldircmp [ -d ] [ -S ] [ -wn ] dirl dir2
DESCRIPTION
Note:

OPTIONS
-d

Optional Software (System V Option). Refer to Installing UNIX on the Sun Workstation for information on how to install this command. dircmp examines dir1 and dir2 and generates various
tabulated information about the contents of the directories. Listings of files that are unique to each
directory are generated for all the options. If no option is entered, a list is output indicating
whether the filenames common to both directories have the same contents.
Compare the contents of files with the same name in both directories and output a list telling what
must be changed in the two files to bring them into agreement. The list format is described in
diff(I).

-s

Suppress messages about identical files.

-wn

Change the width of the output line to n characters. The default width is 72.

SEE ALSO
cmp(I), diff( 1)

Sun Release 3.2

Last change: 17 July 1986

127

DOMAINNAME ( 1 )

USER COMMANDS

DOMAINNAME ( 1 )

NAME

domainname - set or display name of current domain system
SYNOPSIS

domainname [ nameo/domain ]
DESCRIPTION
Without an argument, domainname displays the name of the current domain. Only the super-user can set
the domainname by giving an argument; this is usually done in the startup script letclrc.local. Currently,
domains are only used by the yellow pages, to refer collectively to a group of hosts.
SEE ALSO
ypinit(8)

128

Last change: 23 September 1985

Sun Release 3.2

DU( IV)

USER COMMANDS

DU( IV)

NAME

du - summarize disk usage
SYNOPSIS

du [ -s] [ -a ] [ name 1
SYSTEM V SYNOPSIS

du [ -s] [ -a ] [ -r ] [ name 1
DESCRIPTION
du gives the number of kilobytes contained in all files and, recursively, directories within each specified
directory or file name. If name is missing, • (the current directory) is used.

A file which has multiple links to it is only counted once.
SYSTEM V DESCRIPTION
The System V version of du gives the number of 512-byte blocks rather than the number of kilobytes.
OPTIONS

-s

Only display the grand total for each of the specified name s.

-a

Generate an entry for each file.

Entries are generated only for each directory in the absence of options.
SYSTEM V OPTIONS
-r
The System V version of du is normally silent about directories that cannot be read, files that cannot be opened, etc. The -r option will cause du to generate messages in such instances.
EXAMPLE
Here is an example of using du in a directory. We used the pwd command to identify the directory, then
used du to show the usage of all the subdirectories in that directory. The grand total for the directory is the
last entry in the display:
%pwd

lusrlhenry/misc
%du

5
33

44
217
401

144
80
388
93
15
1211
%

Jjokes
Jsquash
Jtech.papers/lpr.document
Jtech.papers/new.manager
Jtech.papers
Jmemos
Jletters
Jwindow
Jmessages
Juseful.news

SEE ALSO
df(I), quot(8)

BUGS
Filename arguments that are not directory names are ignored, unless you use -a .
If there are too many distinct linked files, du will count the excess files more than once.

Sun Release 3.2

Last change: 10 April 1986

129

ECHO ( IV)

USER COMMANDS

ECHO ( IV)

NAME

echo - echo arguments
SYNOPSIS

echo [ -n ] [argument ••• ]
SYSTEM V SYNOPSIS

echo argument •••
DESCRIPTION
echo writes its arguments on the standard output. Arguments must be separated by spaces or tabs, and terminated by a newline.

echo is useful for producing diagnostics in shell programs and for writing constant data on pipes. If you
are using the Bourne Shell (sh (1», you can send diagnostics to the standard error file by typing:
echo ••• 1>&
SYSTEM V DESCRIPTION
Note: If lusrl5bin is ahead of lusrlbin in the Bourne shell's search path, its built-in echo command mimics the System V version of echo as described here.

echo also understands C-like escape conventions; beware of conflicts with the shell's use of \:

\b

\c
\f
\n
\r
\t
\v
\\

\n

backspace
print line without new-line
form-feed
new-line
carriage return
tab
vertical tab
backslash
the 8-bit character whose ASCII code is the 1-,2- or 3-digit octal number n, which must
start with a zero.

OPTIONS
-0

Don't add the newline to the output.

SEE ALSO
sh(l)

130

Last change: 16 April 1986

Sun Release 3.2

ED( 1)

USER COMMANDS

ED(1 )

NAME

ed - text editor
SYNOPSIS
ed [ - ] [ -x] [filename ]
DESCRIPTION
ed is the basic line editor in the UNIX system. Although superseded by ex and vi for most purposes, ed is
still used by system utilities such as sees.
You can tell ed to perform various operations on the lines you specify. (see Line Addressing, below, for a
discussion of how to·form line-addresses for ed). You can print (display) lines, change lines, insert new
lines into the buffer, delete existing lines, you can move or copy lines to a different place in the buffer, or
you can substitute character strings within lines. (See List of Operations, below, for a guide. Also, see
Regular Expressions for string-matching metacharacters.)

ed does not operate directly on the contents of a file - when editing a file, ed reads the contents of the file
into a buffer or seratehpad. All changes made during an editing session are made on the contents of the
buffer. The copy must be 'saved' or 'written' - using the w (write) command - to save changes.
The command-line shown in the synopsis above invokes ed. If filename is given, ed reads a copy of
filename into its buffer so that it can be edited (simulates an e operation onfilename).

ed commands have a simple and regular structure: commands consist of an optional line-address, or two
optional line-addresses separated by a comma, then a single letter operation, optionally followed by some
other parameter:
[line-address [,line-address ] ] operation [parameter]
For example, '1,10p' means 'print (display) lines 1 through 10' (two line-addresses), '5a' means 'append
after line 5' (one line-address), and d means 'delete the current line' (no line-address with the current line
used as default). Parameter varies for each operation - for the move and transfer operations, for example, it is the line that the addressed lines are to be moved or transferred after. These operations actually
have three line-addresses. For reading and writing a file, parameter specifies the name of the file that is to
be read.

ed is extremely terse in its interaction with the user -

ed's normal response to just about any problem is
simply a question mark? You get this response when, for instance, ed can't find a specified line in the
buffer, or if a search for a regular expression fails in a substitute (s) operation.

OPTIONS
Don't display character counts normally given by the e, r, and w operations the standard input is an editor script.
-x

can be used when

Simulate an x operation on the named file before reading it into the buffer, to handle encryption.

LINE ADDRESSING
The format of ed operations above shows that an operation can be preceded by one or two line-addresses,
both of which are optional. If only one line-address is specified, operations are performed on that specific
line. If two line-addresses are supplied, ed operates on the inclusive range of lines between them.
Line-addresses are usually separated from each other by a comma 1,10p
prints (displays) lines 1 thru 10.

for instance:

Line addresses may also be separated by a semicolon. Whereas the starting position for line-addresses
separated by a comma is the same place in the buffer, when a line-address is followed by a semicolon, the
current line is set to the line-address preceding the semicolon before any subsequent line-addresses are
interpreted. For example:
IDomaine Chandon! ;//p
sets the current line to the first occurrence of the string 'Domaine Chandon' before starting the search for
the second occurrence. This feature can be used to determine the starting line for forward and backward

Sun Release 3.2

Last change: 5 December 1985

131

ED( 1)

USER COMMANDS

ED(I)

searches ('I', '?').
Lines can be accessed (addressed, in ed terminology) in several ways, but the most easily understood way
of addressing lines is by line number. Line numbers in ed are relative to the start of the buffer. In practice,
addressing lines by number proves to be the most awkward to use, so ed provides other mechanisms for
line-addressing. Note that the line numbers associated with lines in the buffer are not physically present
with the text of the lines - they are just an addressing mechanism.
While ed is working on the buffer, it keeps track of the line on which you last performed some operation.
This line is called the 'current line'. As described below, you can indicate the current line by typing a
period character (.).
If you don't specify a line for an operation to operate on, most ed operations work on the line addressed by
the current line.

When ed starts working on a file, the current line is positioned at the last line in the buffer. Thereafter, the
current line usually changes when any operation is performed. In general, the current line sits at the last
line affected by whatever ed operation you used. For instance, if you print lines 1 through 10 of the buffer,
after the lines are displayed, the current line will be positioned at line 10.
Line-addresses are constructed from elements as shown in the list below. Some special characters are used
as a shorthand for certain line-addresses:
('dot') addresses the current line.

$

addresses the last line of the buffer.

nnn

A decimal number nnn addresses the nnn -th line of the buffer.

'x

addresses the line marked with the name x, which must be a lower-case letter. Mark lines with the
k operation described below.

Iregular expressionl
A regular expression enclosed in slashes 'I' searches forward from the current line and stops at
the first line containing a string that matches the regular expression. If necessary, the search
wraps around to the beginning of the buffer.
?regular expression?
A regular expression enclosed in question marks'?, searches backward from the current line and
stops at the first line containing a string that matches the regular expression. If necessary the
search wraps around to the end of the buffer.
address±nnn
An address followed by a plus sign '+' or a minus sign '-' followed by a decimal number
specifies that line-address plus or minus the indicated number of lines. Plus is assumed if no signs
are given.
±address
An address beginning with '+' or '-' is taken relative to the current line; in other words, '-5' is
understood to mean '.-5'.
address±
An address ending with '+' or '-', adds or subtracts 1. As a consequence of this rule and the previous rule, the line-address '-' refers to the line before the current line. Moreover, trailing' +' and
'-' characters have cumulative effect, so '--' refers to the current line less 2.
To maintain compatibility with earlier versions of ed, the character 'A' in line-addresses is
equivalent to '-'.
ed operations do not necessarily use line-addresses; they may use one or two. Operations which don't use
line-addresses regard the presence of a line-address as an error. Operations which accept one or two lineaddresses assume default line-addresses if these are not specified. If more line-addresses are given than
such an operation requires, the last one or two (depending on what is accepted) are used. The second line-

132

Last change: 5 December 1985

Sun Release 3.2

ED(I)

USER COMMANDS

address of any two-address sequence must be greater than the first line-address must follow the first line in the buffer.

ED(1 )

that is, the second line

LIST OF OPERATIONS
ed operates in one of two major modes: command mode and text input mode. ed always starts up in commandmode.

While you are typing commands at ed, you are in command mode. Some commands - a for append, c for
change, and i for insert - provide for adding new text to the buffer. While ed is accepting new text, you
are in text input mode. You exit from text input mode by typing a period '.' alone at the beginning of a
line. ed then reverts to command mode. For example, here is a very short illustration of command mode
versus text mode:
tutorial% ed winelist
(tell ed to edit a file called winelist)
42
(ed states there are 42 characters in the file)
l,$p
(in command mode-tell ed to print all lines)
1978 Chateau Chunder
1979 Redeye Canyon
a
(in command mode-tell ed to append text)
(text input mode-add a new line)
1980 Doomsday Special
(period ends text input mode)
(back
in command mode- print last line entered)
P
1980 Doomsday Special
w
(command mode - write the file)
(ed displays the number of characters written)
65
q
(command mode-quit the edit session)
(back in the Shell)
tutorial%

If you interrupt ed, it displays '?interrupted' and returns to command mode.

a Append Text.
Reads the text entered in input mode and appends it to the buffer after the addressed line. a
accepts one line-address - default line-address is the current line. The new current line is the last
line input, or at the addressed line if no text is entered Address '0' is a valid place to append text,
in which case text is placed at the beginning of the buffer.
c

Change Lines.
Deletes the addressed lines, then accepts input text which replaces these lines. c accepts two
line-addresses - default line-address is the current line. The current line is left on the last line
input, or at the line preceding the deleted lines if no text is entered

d

Delete Lines.
Delete the addressed lines from the buffer. d accepts two line-addresses - default line-address is
the current line. The line originally after the last line deleted becomes the current line; if the lines
deleted were originally at the end, the new last line becomes the current line.

e filename Edit a file.
Deletes the entire contents of the buffer, and then reads in the named file. e sets the current line to
the last line of the buffer, and reports the number of characters read into the buffer. e remembers
filename for possible use as a default file name in a subsequent r or w operations. If no filename is
given, the remembered filename is used. e displays a ? if the buffer has not been written out since
the last change made - a second e operation says you really mean it.

Efilename
Same as e, but will silently allow you to quit an editing session without warning you if you have
not written your file. e, on the other hand, reminds you to save your changes if you have altered
the buffer at all.
f filename Display Remembered Filename.
Display the currently 'remembered filename'. If filename is given, the currently 'remembered

Sun Release 3.2

Last change: 5 December 1985

133

ED(I)

USER COMMANDS

ED(I)

filename' is changed to filename .

glregular expression/operation list
This is the global operation: perform operation list on all lines in the range of line-addresses containing regular expression. g accepts two line-addresses - default is all lines in the buffer. Also
see the v operation, which inverts the sense of regular expression.
If your operation list actually takes up more than a single line, you must end every line except the
last (the true 'end' of the global operation) with an escape character, '\'. For example, if you want
to substitute 'jimjams' for 'frarnrnis', then append several lines of text to every line containing the
string 'widget' and print those lines, you would type this sequence:
g/widgetls/frarnrnisljimjarnsl\
a\
new line of text\
another new line of text\
\
P
Note that the a, i, and c operations, which put ed in input mode, are permitted in the operation list;
the final • terminating input may be omitted if it is the last line of the operation list. The g and v
operations are not permitted in the operation list.

.

Insert Text
Insert lines of text into the buffer before the addressed line. i accepts one line-address - default
line-address is the current line. The current line is placed at the last line input; if no text is input, the
current line is left at the line before the addressed line. i differs from a only in the placement of the
text.

j

kx

Join Lines.
Joins the addressed lines into a single line; intermediate newlines simply disappear. j accepts two
line-addresses - default is the current line and the following line. The current line is placed at the
resulting line.
Mark Line.
Marks the addressed line with name x (the name must be a lower-case letter). The line-address form
'x then addresses this line. k accepts one line-address - default line-address is the current line.

I Display Non-printing Characters.
Displays non-graphic characters in the addressed lines such that they are displayed in two-digit octal,
and long lines are folded. I accepts two line-addresses - default line-address is the current line. I
may be placed on the same line after any non-I/O operation.

maddress Move lines.
Reposition the addressed lines after the line-addressed by address. m accepts two line-addresses to
specify the range of lines to be moved - default line-address is the current line. The last of the
moved lines becomes the current line.
p

P
q

Q

134

Print (display) Lines.
Displays the addressed lines. p accepts two line-addresses - default line-address is the current line.
The current line is placed at the last line printed. p may be placed on the same line after any non-I/O
operation.
Synonym for p.
Quit Edit Session.
Exit from the editing session. Note, however, that the buffer is not automatically written out (do a
'w' to write if you want to save your changes). ed warns you once if you haven't saved your filea second q says you really mean it
Same as q, but you don't get any warning if you haven't previously written out the buffer.

Last change: 5 December 1985

Sun Release 3.2

ED(l)

USER COMMANDS

ED(l)

r filename Read from file.
Reads the contents of filename into the buffer after the addressed line. If filename is not given, the
'remembered filename', if any, is used (see e and I). r accepts one line-address - default lineaddress is $. If line-address '0' is used, r reads the file in at the beginning of the buffer. If the read
is successful, r displays the number of characters read in. The current line is left at the last line read
in from the file.

s/regular expression/replacement string lor,
s/regular expression/replacement string Ig
Substitute the replacement string for the first occurrence of regular expression on each line where
the regular expression occurs. In the first form of the s operation, only the first occurrence of the
matched string on each line is replaced. If you use the g (global) suffix, all occurrences of the regular expression are replaced in the line. Keep the g suffix of the s operation distinct from the g operation itself - they are completely different. s accepts two line-addresses to delimit the range of lines
within which the substitutions should be done - default line-address is the current line. The current
line is left at the last line substituted.
Special Characters:
Any punctuation character may be used instead of 'I' to delimit the regular expression and
the replacement string.
An ampersand' &' appearing in the replacement string is replaced by the string matching
the regular expression. The special meaning of '&' in this context may be suppressed by
preceding it by '\'.
The characters \n where n is a digit, are replaced by the text-matched by the n-th regular
subexpression enclosed between '\(' and '\)'. When nested, parenthesized subexpressions
are present, n is determined by counting occurrences of '\(' starting from the left. Lines
may be split by substituting new-line characters into them. The new-line in the replacement
string must be escaped by preceding it by '\'.
taddress Transfer Lines.
Transfers a copy of the addressed lines to after line address. transfer is like move, but it makes
copies of the lines, leaving the original text where it was. t accepts two line-addresses preceeding
the operation letter - default line-address is default. The current line is left on the last line of the
copy. '0' is a legal line-address for the destination.
u

Undo. Undo previous substitute.
undo undoes the effect of the the last substitute operation, providing that the current line has not
been moved since the substitute operation.

v/regular expressiOn/operation list
Like a negative of the global operation, g: perform operation list on all lines except those containing
regular expression. v accepts two line-addresses - default is all lines in the file.
w

Write Lines.
Write the addressed lines from the buffer into the file specified by the 'remembered filename'. w
accepts two line-addresses - default is all lines in the file. The current line is unchanged. If the
write is successful, ed displays the number of characters written.

w filename

Write Lines.
Write the addressed lines into filename. Filename is created if it does not already exist. Filename
becomes the 'remembered filename' (see the e and r operations). w accepts two line-addresses default is all lines in the file. The current line is unchanged. If the write is successful, ed displays
the number of characters written.

W filename
Same as w, but appends the addressed lines to the named file instead of overwriting the file. W
accepts two line-addresses - default is all lines in the file.
x

Encrypt File.

Sun Release 3.2

Last change: 5 December 1985

135

ED(I)

USER COMMANDS

ED(I)

When x is used, ed demands a key string from the standard input. Later r, e, and w operations will
encrypt and decrypt the text with this key by the algorithm of crypt. An explicitly empty key turns
off encryption.

= Display Line Number.

Display the line number of the addressed line. = accepts one line-address - default line-address is
$. The current line is unchanged by this operation.

!

The remainder of the line after the '!' is sent to sh to be interpreted as a shell command. The current
line is unchanged.
address

Display the addressed line. If you type a line-address and type RETURN, ed displays the addressed
line. If you simply type RETURN, the line following the current line is displayed (equivalent to
'.+lp'). This is useful for stepping through text
REGULAR EXPRESSIONS
ed supports a limited form of regular expression notation. A regular expression (also known as a pattern)

specifies a set of strings of characters - such as 'any string containing digits 5 through 9' or 'only lines
containing uppercase letters'. A member of this set of strings is said to be matched by the regular expression. Regular expressions or patterns are used to address lines in the buffer (see Line Addressing, above),
and also for selecting strings to be substituted in the s (substitute) operation described previously.
An empty regular expression, indicated by two regular expression delimiters in a row, stands for a copy of
the last regular expression encountered.
Any given regular expression matches the the longest among the leftmost matches in a line.
In the following specification for regular expressions, the notation

c stands for any single ordinary charac-

ter, where a character is anything except a newline character.

c

any ordinary character except a special character matches itself. Special characters are the delimiters that actually surround the regular expression, plus \ (the escape character), [ (the opening
bracket for a character class as described below), • (period which matches any single character),
and sometimes the * (closure) and $ characters. If you want a literal occurrence of one of these
special characters you must escape them with the \ character.
A

at the very start of the regular expression constrains the match to the beginning of the line. A
match of this type is called an 'anchored match' because it is 'anchored' to a specific place in the
line. The character loses its special meaning if it appears in any position other than at the very
start of the regular expression.
A

$

at the very end of the regular expression constrains the match to the end of the line. A match of
this type is called an 'anchored match' because it is 'anchored' to a specific place in the line. The
$ character loses its special meaning if it appears in any position other than at the very end of the
regular expression.
(period) matches any single character except a newline character.

[string] A string of characters enclosed in brackets matches anyone of the characters in the brackets. For
example, [abcxyz] matches any single character from the set 'abcxyz'. If the first character inside
the bracket is a A, the string matches any character not inside the brackets. For instance,
[,,456787] matches any character except '45678'. You can use a shorthand notation to refer to an
inclusive range of characters: a-b. Such a bracketed string of characters is known as a character

class.

136

xy

When two regular expressions are concatenated, they match the leftmost and then the longest possible string that can be divided with the first part of the string matching the first regular expression,
followed by the second string matching the second regular expression.

*

Any regular expression followed by

* matches

a sequence of 0 or more matches of the regular

Last change: 5 December 1985

Sun Release 3.2

ED(I)

USER COMMANDS

ED(I)

expression. Such a pattern is called a closure. For example: [a-z] [ a-z ]. matches any string
of one or more lower case letters.
\( regular expression \)
The regular expression within the \( and \) brackets essentially 'remembers' whatever the regular
expression matches. This provides a mechanism for extracting parts of strings. There can be up
to nine such partial matches in a string. Parenthesized regular expressions can be nested.

\n

where n is in the range 1 thru 9, matches a copy of the string that the bracketed regular expression
beginning with the nth \( matched, as described in the previous paragraph on matching parts of
strings. When nested, parenthesized subexpressions are present, n is determined by counting
occurrences of \( starting from the left

Regular expressions are used in line-addresses to specify lines and in one operation (see s for substitute
above) to specify a portion of a line which is to be replaced. If it is desired to use one of the regular
expression metacharacters as an ordinary character, that character may be preceded by '\'. This also
applies to the character bounding the regular expression (often '/') and to '\' itself.
FILES

Ittnple*
edhup: work is saved here if telephone hangs up
SEE ALSO

crypt(l)
ex(l)
sed(IV)
vi(l)

encode and decode
extended line editor (part of vi)
stream editor
visual (display) editor

Editing Text Files on the Sun Workstation.

BUGS
The I operation mishandles DEL.
The undo operation removes marks from affected lines.
Because 0 is an illegal line-address for a w operation, it is not possible to create an empty file with ed. Use
cat (1 V) to create an empty file.
RESTRICTIONS

Some size limitations: 512 characters per line, 256 characters per global command list, 64 characters per
file name, and 128K characters in the temporary file. Since each line uses two bytes of memory, the limit
on the number of lines should not be exceeded in practice.
When reading a file, ed discards ASCII NUL characters and all charac.ters after the last newline. ed refuses to
read files containing non-ASCII characters.
The encryption facilities of ed are not available on software shipped outside the U.S.

Sun Release 3.2

Last change: 5 December 1985

137

ED(IV)

USER COMMANDS

EO( IV)

NAME

ed, red - line editor
SYSTEM V SYNOPSIS
ed [ - ] [ -p string] [ -x] [filename]
SYSTEM V DESCRIPTION
Ed is the standard System V line editor. If the filename argument is given, ed reads the named file into the

buffer for editing.
Ed operates on a copy of the file it is editing; changes made to the copy have no effect on the file until a w
(write) command is given. The copy being edited resides in a temporary file called the buffer. There is
only one buffer.
Red is a restricted version of ed. It will only allow editing of files in the current directory, and prohibits
executing shell commands with the! command Attempts to bypass these restrictions result in an error
message (restricted shell).
OPTIONS

Suppress printing of character counts (bye, r, and w commands), diagnostics (bye and q commands), and the ! prompt (after a! command).
-p string
Specify a prompt string.

-x

Edit an encrypted file (see crypt(l) for details.

USAGE
Command Structure
ed commands have a simple and regular structure: zero, one, or two addresses are followed by a singlecharacter command, which may be followed by parameters for that command.

[address [,address ]]command[parameter]

A single address specifies a single line in the buffer. A pair specifies an inclusive range. Commands that
requires an address uses certain addresses by default (typically the address of the current line).
In general, only one command can appear on a line. Certain commands allow you to insert or add text,
which is placed in the appropriate location in the buffer. While accepting text, ed is said to be in input
mode. In this mode, no commands are recognized; all input is added or inserted into the buffer. To exit
input mode, type a period ( .) by itself on a line.
Addresses

Generally speaking, the current line is the last line affected by a command. Explicit addresses are constructes as follows:
Addresses the current line.

138

S

Addresses the last line of the buffer.

n

A decimal number n addresses the n 'th line in the buffer.

'x

addresses the line marked with the mark character x, which must be a lower-case letter. (Lines
are marked with the k command).

IREI

An RE is a regular expression, as described below. When enclosed by slashes, it addresses the
first line found by searching for a string that it matches. The search proceeds forward from the line
following the current line. If necessary, the search wraps around to the beginning of the buffer
and continues up to and including the current line, so that the entire buffer is searched

?RE?

An RE enclosed in question marks addresses the first line containing a match found by searching
backward from the line preceding the current line. If necessary, the search wraps around to the
end of the buffer and continues up to and including the current line.

Last change: 25 July 1986

Sun Release 3.2

ED( IV)

USER COMMANDS

ED( IV)

addr+n
addr-n An address followed by a plus sign (+) or a minus sign (-), followed by a decimal number,

specifies that base address plus or minus the indicated number of lines. (The plus sign may be
omitted) If addr is omitted, the current line is used as the base. For instance, 31-3 addresses the
28'th line in the buffer.
If an address ends with + or -, then '1' is added to or subtracted from the base address, respectively. The address - refers to the line preceding the current line. (To maintain compatibility with
earlier versions of the editor, the character in addresses is equivalent to -.) Trailing + and characters have a cumulative effect, so - refers to the current line, less 2.
A

For convenience, a comma (,) stands for the address pair 1,$, while a semicolon (;) stands for the
pair .,$.
Regular Expressions
Ed supports a limited form of "regular expression" notation, which can be used in an address to specify
lines by their contents. A regular expression (RE) specifies a set of character strings to match. These
strings are built up from the following "single-character" RE's:
c

Any ordinary character not listed below. An ordinary character matches itself.

\

Backslash. When followed by a special character, the RE matches the special character itself.
Period (or "dot"). Matches any single character.
As the leftmost character, a carat (or circumflex) constrains the RE to the leftmost segment of a
line.

$

As the rightmost character, a dollar-sign (or currency symbol) constrains the RE to the rightmost
segment of a line.

The construction ARE $

*

When it follows any RE that matches a single-character, an asterisk (or "star") matches a string
composed of zero or more occurrences of the RE.

d

The delimiting character for the RE.

[c .. . J

A nonempty string of characters, enclosed in square brackets, matches any single character in the
string. When the first character of the string is a carat (), then the RE matches any character
except those in the remainder of the string. A carat in any other position is taken as an ordinary
character. The right square bracket doesn't terminate the enclosed string if it is the first character
(after an initial A, if any).

[1-rJ

The minus sign, between two characters, indicates a range of consecutive ASCII characters to
match. For instance, the range [0-9] is equivalent to the string [0123456789]. The - is treated as
an ordinary character if it occurs first (or first after an initial A) or last in the string.

d

The character used to delimit an RE is special for that RE (for example, see how I is used in the g
command, below).

The following rules and special characters allow for constructing RE's from single-character RE's:
The concatenation of RE's matches the concatenation of text strings, each of which is matched by
a component RE.
*

A one-character RE, followed by an asterisk (*) matches zero or more occurrences of the onecharacter RE. If there is a choice, the longest leftmost string that permits a match is chosen.

\{m\}

\{m,\}
\{m,n\} A one-character RE followed by \{m\}, \{m,\}, or \{m,n\} is an RE that matches a range of
occurrences of the one-character RE. The values of m and n must be nonnegative integers less
than 256; \{m\} matches exactly m occurrences; \{m,\} matches at least m occurrences; \{m,n\}

Sun Release 3.2

Last change: 25 July 1986

139

ED(IV)

USER COMMANDS

ED( IV)

matches any number of occurrences between m and n inclusive. Whenever a choice exists, the RE
matches as many occurrences as possible.
\(...\)

An RE enclosed between the character sequences \( and \) matches whatever the unadorned RE
matches. The expression \n matches the same string of characters as was matched by an expression enclosed between \( and \) earlier in the same RE. Here n is a digit; the subexpression
specified is that beginning with the n-th occurrence of \( counting from the left. For example, the
expression A\(.*\)\I$ matches a line consisting of two repeated appearances of the same string.
constrains the entire RE to match the entire line.

II

The null RE (II) is equivalent to the last RE encountered.

Commands

Commands may require zero, one, or two addresses. Commands that require no addresses regard the presence of an address as an error. Commands that accept one or two addresses assume default addresses when
an insufficient number of addresses is given; if more addresses are given than such a command requires,
the last one(s) are used.
Typically, addresses are separated from each other by a comma (,). They may also be separated by a semicolon (;). In the latter case, the current line (.) is set to the first address, and only then is the second
address calculated. This feature can be used to determine the starting line for forward and backward
searches. The second address of any two-address sequence must correspond to a line that follows, in the
buffer, the line corresponding to the first address.
In the following list of ed commands, the default addresses are shown in parentheses. The parentheses are
not part of the address; they show that the given addresses are the default
It is generally illegal for more than one command to appear on a line. However, any command (except e, r,
r, or w) may be suffixed by I, D, or p in which case the current line is either listed, numbered or printed,
respectively).
(·)a

text
Read the given text and append it after the addressed line; • is left at the last inserted line, or, if
there were none, at the addressed line. Address 0 is legal for this command: it causes the
"appended" text to be placed at the beginning of the buffer. The maximum number of characters
that may be entered from a terminal is 256 per line (including the NEWLINE
character).
(·)c

text
The change command deletes the addressed lines, then accepts input text that replaces those lines;
• is left at the last line input, or, if there were none, at the first line that was not deleted.

140

(·'·)d

The delete command deletes the addressed lines from the buffer. The line after the last line
deleted becomes the current line; if the lines deleted were originally at the end of the buffer, the
new last line becomes the current line.

e file

The edit command causes the entire contents of the buffer to be deleted, and then the named file to
be read in; • is set to the last line of the buffer. If no filename is given, the currently-remembered
filename, if any, is used (see the r command). The number of characters read is typed; file is
remembered for possible use as a default filename in subsequent e, r, and w commands. Iffile is
replaced by!, the rest of the line is taken to be a shell (sh(l» command from which output is read.
Such a shell command is not remembered as the current filename. See also DIAGNOSl'ICS below.

E file

The Edit command is like e, except that the editor does not check to see if any changes have been
made to the buffer since the last w command.

rfile

Iffile is given, the/ile command changes the currently-remembered filename tofile; otherwise, it
prints the currently-remembered filename.

Last change: 25 July 1986

Sun Release 3.2

ED( tV)

USER COMMANDS

ED( IV)

( I, $) glREIcommand-list

In the global command, the first step is to mark every line that matches the given RE. Then, for
every such line, the given command-list is executed with. initially set to that line. A single command or the first of a list of commands appears on the same line as the global command. All lines
of a multiline list, except the last line, must end with a \; a, i, and c commands and associated
input are permitted. The. terminating input mode may be omitted if it would be the last line of the
command-list. An empty command-list is equivalent to the p command. The g, G, v, and V commands are not permitted in the command-list. See also BUGS.
(1,$)GIREI
In the interactive Global command, the first step is to mark every line that matches the given RE.
Then, every such line is printed, • is changed to that line, and anyone command (other than one of
the a, c, i, g, G, v, and V commands) can be typed in for execution. After the execution of that
command, the next marked line is printed, and so on; a NEWLINE acts as a null command; an &
causes the reexecution of the most recent command executed within the current invocation of G.
Note that the commands input as part of the execution of the G command may address and affect
any lines in the buffer. The G command can be terminated by an interrupt signal (ASCII DEL or
BREAK).

h

The help command gives a short error message that explains the reason for the most recent? diagnostic.

H

The Help command alternates between automatic diagnostic message, or the normal mode of
diagnositcs on request It will also explain the previous ? if there was one.

( ·)i

text
The insert command inserts the given text before the addressed line; • is left at the last inserted
line, or, if there were none, at the addressed line. This command differs from the a command in
the placement of the input text Address 0 is not legal for this command. The maximum number
of characters that may be entered from a terminal is 256 per line (including the NEWLINE character).
(., .+1) j

The join command joins contiguous lines by removing the appropriate NEWLINE characters. If
exactly one address is given, this command does nothing.
The mark command marks the addressed line with name c, which must be a lower-case letter.
The address 'c then addresses this line; • is unchanged.

(.,.) I

The list command prints the addressed lines in an unambiguous way: a few nonprinting characters,
such as TAB and BACKSPACE are represented by (hopefully) mnemonic overstrikes. All other
nonprinting characters are printed in octal, and long lines are folded An I command may be
appended to any command other than e, f, r, or w.

(·'·)ma

The move command repositions the addressed line(s) after the line addressed by a. Address 0 is
legal for a and causes the addressed line(s) to be moved to the beginning of the file. It is an error
if address a falls within the range of moved lines; • is left at the last line moved.
(.,.) n

The number command prints the addressed lines, preceding each line by its line number and a
TAB character; • is left at the last line printed The n command may be appended to any command
other than e, f, r, or w.

(. ,.) p

The print command prints the addressed lines; • is left at the last line printed. The p command
may be appended to any command other than e, f, r, or w. For example, dp deletes the current
line and prints the new current line.

P

The editor prompts with a * for all subsequent commands. The P command alternately turns this
mode on and off; it is initially off.

Sun Release 3.2

Last change: 25 July 1986

141

ED(IV)

USER COMMANDS

ED(IV)

q

The quit command. ed exits. No automatic write of a file is done, but if changes have been made
since the last time the buffer was written, ed warns you (unless the - option is in effect) by printing a ? diagnostic. A second q exits, destroying the buffer's contents.

Q

The editor exits without checking for changes since the last w command.

($)r file

The read command reads in the given file after the addressed line. If no file is named, the
currently-remembered filename, if any, is used (see e and r commands). The currentlyremembered filename is not changed unless file is the very first filename mentioned since ed was
invoked. Address 0 is legal for r and causes the file to be read at the beginning of the buffer. If
the read is successful, the number of characters read is typed; • is set to the last line read in. If file
is replaced by!, the rest of the line is taken to be a shell (sh(I» command whose output is to be
read. For example, $r !Is appends current directory to the end of the file being edited. A shell
command is not remembered as the current filename.
(·'·)slRElreplacementl[gln]
The substitute command searches each addressed line for an occurrence of the specified RE. In
each line for which a match is found, all (non-overlapped) matched strings are replaced by the
replacement if the global replacement indicator g appears after the command. If the global indicator does not appear, only the first occurrence of the matched string is replaced If a number n
appears after the command, only the n'th occurrence of the matched string on each addressed line
is replaced. It is an error for the substitution to fail on all addressed lines. Any character other
than SPACE or NEWLINE can be used instead of I to delimit the RE and the replacement string. •
is left at the last line on which a substitution occurred.

An ampersand ( & ) appearing in the replacement is replaced by the string matching the RE on the
current line. The special meaning of & in this context may be suppressed by preceding it by \. As
a more general feature, the characters \n, where n is a digit, are replaced by the text matched by
the n'th regular subexpression of the specified RE enclosed between \( and \). When nested
parenthesized subexpressions are present, n is determined by counting occurrences of \( starting
from the left When the character % is the only character in the replacement, the replacement
used in the most recent substitute command is used as the replacement in the current substitute
command The % loses its special meaning when it is in a replacement string of more than one
character or is preceded by a backslash.
A line may be split by substituting a NEWLINE character into it The NEWliNE in the replacement must be escaped by preceding it by \. Such substitution cannot be done as part of a g or v
command-list
(·,·)t

a
This command acts just like the m command, except that a copy of the addressed lines is placed
after address a (which may be '0'); • is left at the last line of the copy.

u

The undo command nullifies the effect of the most recent command that modified anything in the
buffer, namely the most recent a, c, d, g, i, j, m, r, S, t, v, G, or V command.

(1,$)v/RElcommand-list
This command is the same as the global command g except that the command-list is executed with
• initially set to every line that does not match the RE.
(1,$)VIREI

This command is the same as the interactive global command G except that the lines that are
marked during the first step are those that do not match the RE.
(1 ,$)w file
The write command writes the addressed lines into the named file. If the file does not exist, it is
created with mode 666 (readable and writable by everyone), unless your umask setting (see
sh(l» dictates otherwise. The currently-remembered filename is not changed unless file is the
very first filename mentioned since ed was invoked If no filename is given, the currently-

142

Last change: 25 July 1986

Sun Release 3.2

ED( IV)

USER COMMANDS

ED( IV)

remembered filename, if any, is used (see e and/commands); • is unchanged. If the command is
successful, the number of characters written is typed If file is replaced by!, the rest of the line is
taken to be a shell (sh(l» command for which the standard input is the addressed lines. Such a
shell command is not remembered as the current filename.

x

A key string is demanded from the standard input Subsequent e, r, and w commands encrypt and
decrypt the text with this key by the algorithm of crypt(l). An explicitly empty key turns off
encryption.

The line number of the addressed line is typed; • is unchanged by this command.

!shell-command
The remainder of the line after the! is sent to the UNIX system shell (sh(l» to be interpreted as a
command Within the text of that command, the unescaped character % is replaced with the
remembered filename; if a ! appears as the first character of the shell command, it is replaced with
the text of the previous shell command. Thus,!! will repeat the last shell command. If any expansion is performed, the expanded line is echoed; • is unchanged.
(.+1)

NEWLINE

An address, alone on a line, prints the addressed line. A NEWLINE alone is equivalent to .+lp,
which is useful for stepping forward through the buffer.

If an interrupt signal (ASCII DEL or BREAK) is sent, ed prints a ? and returns to its command level.
File Format Specification Support
Both ed and red support the/spec(4) formatting capability. After including a format specification as the
first line of filename and invoking ed with your terminal in stty -tabs or stty tab3 mode (see stty( 1V), the
tab stops specified are used when displaying lines. For example, if the first line of a file contained:

<:15,10,15 s72:>
tab stops would be set at columns 5, 10, and 15, and a maximum line length of 72 would be imposed.
While inserting text, however, tab characters are expanded to every eighth column.
LIMITATIONS
The following limitations apply:

512 characters per line.
256 characters per global command-list
64 characters per filename.
128K characters in the buffer.
The limit on the number of lines depends on the amount of user memory:
each line takes 1 word.
When reading a file, ed discards ASCII NUL characters and all characters after the last NEWLINE. Files (like
a.out) that contain characters not in the ASCII set (bit 8 on) cannot be edited by ed.
If the closing delimiter of an RE or of a replacement string (such as I) would be the last character before a
NEWLINE, that delimiter may be omitted, in which case the addressed line is printed. The following pairs
of commands are equivalent:
sis 1/s2
sIs 1/s2/p
glsl
glsl/p

?sl

?sl?

FILES
/tmp/e#

ed.hup
DIAGNOSTICS
?

?file

Sun Release 3.2

temporary; # is the process number.
work is saved here if the terminal is hung up.
For command errors.
For an inaccessible file (use the help and Help commands for detailed explanations).

Last change: 25 July 1986

143

ED( IV)

USER COMMANDS

ED(IV)

If changes have been made in the buffer since the last w command that wrote the entire buffer, ed warns
the user if an attempt is made to destroyed's buffer via the e or q commands. It prints ? and allows one to
continue editing. A second e or q command at this point will take effect. The - command-line option inhibits this feature.
SEE ALSO
ed( 1), crypt( 1), grep( 1V), sed( 1V), sh( 1), stty( 1V), fspec(4), regexp( 5)
CAVEATS AND BUGS
A ! command cannot be subject to a g or a v command.

The ! command and the ! escape from the e, r, and w commands cannot be used if the the editor is invoked
from a restricted shell (see sh(I».
The sequence \n in an RE does not match a NEWLINE character.
The I command mishandles DEL.
Files encrypted directly with the crypt(l) command with the null key cannot be edited.
Characters are masked to 7 bits on input.
If the editor input is coming from a command file, the editor exits at the first failure of a command in that
file.

144

Last change: 25 July 1986

Sun Release 3.2

ENV(l)

USER COMMANDS

ENV(l)

NAME

env - obtain or alter environment variables for command execution
SYNOPSIS

env [ - ] [ name =value . .. ] [ command ]
DESCRIPTION

env obtains the current environment, modifies it according to its arguments, and executes the command
with the modified environment that results.
OPTIONS

Ignore the environment that would otherwise be inherited from the current shell. Restricts the
environment for command to that specified by the arguments.
name=value
Set the environment variable name to value and add it to the environment
If no command is specified, the resulting environment is displayed.
SEE ALSO

sh(l), exec(2), profile(4), environ(5V)

Sun Release 3.2

Last change: 21 February 1986

145

EQN( 1)

USER COMMANDS

EQN(l )

NAME

eqn, neqn, checkeq - typeset mathematics
SYNOPSIS
eqn [ -dxy] [ -pn] [ -sn] [ -fn] [filename] ...
neqn [filename ] ...
checkeq [filename] ...
DESCRIPTION
Eqn (and neqn) are language processor~ to assist in describing equations. Eqn is a preprocessor for troff(l)
and is intended for devices that can print troffs output. Neqn is a preprocessor for nroff(l) and is intended
for use with terminals. Usage is almost always:
tutorial% eqnfile ... 1 troff
tutorial% neqnfile ... 1 nrotT

If no file s are specified, eqn and neqn read from the standard input. A line beginning with '.EQ' marks the
start of an equation; the end of an equation is marked by a line beginning with' .EN'. Neither of these lines
is altered, so they may be defined in macro packages to get centering, numbering, etc. It is also possible to
set two characters as 'delimiters'; subsequent text between delimiters is also treated as eqn input.

Checkeq reports missing or unbalanced delimiters and .EQ/.EN pairs.
OPTIONS

-dxy

Set equation delimiters set to characters x and y with the command-line argument. The more
common way to do this is with 'delim xy' between .EQ and .EN. The left and right delimiters
may be identical. Delimiters are turned off by 'delim off' appearing in the text. All text that is
neither between delimiters nor between .EQ and .EN is passed through untouched.

-p n

Reduce subscripts and superscripts by n point sizes from the previous size. In the absence of the
-p option, subscripts and superscripts are reduced by 3 point sizes from the previous size.

-sn

Change point size to n globally in the document. The point size can also be changed globally in
the body of the document by using the gsize directive.

-fn

Change font to n globally in the document. The font can also be changed globally in the body of
the document by using the gfont directive.

EQN LANGUAGE
Tokens within eqn are separated by spaces, tabs, newlines, braces, double quotes, tildes or circumflexes.
Braces {} are used for grouping; generally speaking, anywhere a single character like x could appear, a
complicated construction enclosed in braces may be used instead. Tilde C) represents a full space in the
output, circumflex C) half as much.

Subscripts and superscripts are produced with the keywords sub and sup. Thus x sub i makes
x1 y1
sup 2 produces a?, and e sup (x sup 2 + y sup 2) gives e +

Xi'

a sub i

Fractions are made with over: a over b yields ~.
sqrt makes square roots: lover sqrt {ax sup 2 +hx+c} results in...j

1
.
ax 2+bx+c
n

The keywords from and to introduce lower and upper limits on arbitrary things: lim Lxi is made with lim
n-';OO

0

from {n- > inf} sum from 0 to n x sub i.
Left and right brackets, braces, etc., of the right height are made with left and right: left [ x sup 2 + y sup 2

over alpha right 1 -=-1 produces

r'+f]

= 1.

The right clause is optional. Legal characters after left

and right are braces, brackets, bars, c and f for ceiling and floor, and "" for nothing at all (useful for a
right-side-only bracket).

146

Last change: 1 February 1985

Sun Release 3.2

EQN( 1)

USER COMMANDS

EQN (1)

a
Vertical piles of things are made with pile, lpile, cpile, and rpile: pile {a above b above c} produces b.
c

There can be an arbitrary number of elements in a pile. lpile left-justifies, pile and cpile center, with different vertical spacing, and rpile right justifies.
Xi

Matrices are made with matrix: matrix { lcol (x sub i above y sub 2) ccol ( 1 above 2) } produces

Y2

1

2.

In addition, there is rcol for a right-justified column.
Diacritical marks are made with dot, dotdot, hat, tilde, bar, vec, dyad, and under: x dot = f(t) bar is
x=! (t), y dotdot bar -=- n under is = n, and x vec -=-y dyad is x=)1.

y

Sizes and font can be changed with size n or size ±n, roman, italic, bold, and font n. Size and fonts can
be changed globally in a document by gsize n and gfont n, or by the command-line arguments -sn and -fn.
Successive display arguments can be lined up. Place mark before the desired lineup point in the first equation; place lineup at the place that is to line up vertically in subsequent equations.
Shorthands may be defined or existing keywords redefined with define:
define thing % replacement %
defines a new token called thing which will be replaced by replacement whenever it appears thereafter.
The % may be any character that does not occur in replacement.
Keywords like sum (~), int (f), in! (00), and shorthands like >= (~), -> (~), and != (*) are recognized.
Greek letters are spelled out in the desired case, as in alpha or GAMMA. Mathematical words like sin, cos,
log are made Roman automatically. troff( 1) four -character escapes like \(bu (.) can be used anywhere.
are passed through untouched; this permits keywords to be entered
Strings enclosed in double quotes
as text, and can be used to communicate with troffwhen all else fails.
II ••• "

SEE ALSO

Formatting Documents on the Sun Workstation
troff(l), tbl(I), ms(7), eqnchar(7)
BUGS

To embolden digits, parens, etc., it is necessary to quote them, as in 'bold "12.3'''.

Sun Release 3.2

Last Change: 1 February 1985

147

ERROR ( 1)

USER COMMANDS

ERROR ( 1)

NAME

error - analyze and disperse compiler error messages
SYNOPSIS

error [ -n] [ -s ] [ -q ] [ -v ] [ -t suffixlist] [ -I ignore/tie] [name]
DESCRIPTION

Error analyzes error messages produced by a number of compilers and language processors. It replaces
the painful, traditional methods of scribbling abbreviations of errors on paper, and permits error messages
and source code to be viewed simultaneously.
Error looks at error messages, either from the specified file name or from the standard input, and:

• Determines which language processor produced each error message,
• Determines the file name and line number of the erroneous line, and,
• Inserts the error message into the source file immediately preceding the erroneous line.
Error messages which can't be categorized by language processor or content are not inserted into any file,
but are sent to the standard output. Error touches source files only after all input has been read.
Options are explained later on in this manual entry.
Error is intended to be run with its standard input connected via a pipe to the error message source. Some
language processors put error messages on their standard error file; others put their messages on the standard output. Hence, both error sources should be piped together into error. For example, when using the
csh syntax,
tutorial% make -s lint I & error -q -v

will analyze all the error messages produced by whatever programs make runs when making lint.
Error knows about the error messages produced by: make, cc, cpp, ccom, as, ld, lint, pi, pc, and [77. For
all languages except Pascal, error messages are restricted to one line. Some error messages refer to more
than one line in more than one file, in which case error duplicates the error message and inserts it at all of
the places referenced.
Error does one of six things with error messages.
synchronize
Some language processors produce short errors describing which file they are processing. Error
uses these to determine the file name for languages that don't include the file name in each error
message. These synchronization messages are consumed entirely by error.
discard Error messages from lint that refer to one of the two lint libraries, lusrlliblllib-lc and lusrlliblllibport are discarded, to prevent accidently touching these libraries. Again, these error messages are
consumed entirely by error.
nullify

Error messages from lint can be nullified if they refer to a specific function, which is known to
generate diagnostics which are not interesting. Nullified error messages are not inserted into the
source file, but are written to the standard output. The names of functions to ignore are taken from
either the file named .errorrc in the user's home directory, or from the file named by the -I
option. If the file does not exist, no error messages are nullified. If the file does exist, there must
be one function name per line.

not file specific
Error messages that can't be intuited are grouped together, and written to the standard output
before any files are touched. They are not inserted into any source file.
file specific
Error messages that refer to a specific file but to no specific line are written to the standard output
when that file is touched.
true errors

148

Last change: 13 March 1984

Sun Release 3.2

ERROR ( 1)

USER COMMANDS

ERROR ( 1)

Error messages that can be intuited are candidates for insertion into the file to which they refer.
Only true error messages are inserted into source files. Other error messages are consumed entirely by
error or are written to the standard output. Error inserts the error messages into the source file on the line
preceeding the line number in the error message. Each error message is turned into a one line comment for
the language, and is internally flagged with the string '###' at the beginning of the error, and '%%%' at the
end of the error. This makes pattern searching for errors easier with an editor, and allows the messages to
be easily removed. In addition, each error message contains the source line number for the line the message refers to. A reasonably formatted source program can be recompiled with the error messages still in
it, without having the error messages themselves cause future errors. For poorly formatted source programs in free format languages, such as C or Pascal, it is possible to insert a comment into another comment, which can wreak havoc with a future compilation. To avoid this, format the source program so there
are no language statements on the same line as the end of a comment.
OPTIONS

-n

Do not touch any files; all error messages are sent to the standard output.

-q

Error asks whether the file should be touched. A 'y' or 'n' to the question'ais necessary to continue.
Absence of the -q option implies that all referenced files (except those refering to discarded error
messages) are to be touched.

-v

After all files have been touched, overlay the visual editor vi with it set up to edit all files touched,
and positioned in the first touched file at the first error. If vi can't be found, try ex or ed from standard places.

Take the following argument as a suffix list. Files whose suffices do not appear in the suffix list are
not touched. The suffix list is dot seperated, and '*' wildcards work. Thus the suffix list:
" .c.y.f*.h"
allows error to touch files ending with' .c', '.y', 'J*' and' .h'.

-t

-s

Print out statistics regarding the error categorization. Not too useful.

Error catches interrupt and terminate signals, and if in the insertion phase, will orderly terminate what it is
doing.
FILES
-I.errorrc
Idev/tty

function names to ignore for lint error messages
user's teletype

BUGS

Opens the teletype directly to do user querying.
Source files with links make a new copy of the file with only one link to it.
Changing a language processor's format of error messages may cause error to not understand the error
message.
Error, since it is purely mechanical, will not filter out subsequent errors caused by 'floodgating' initiated
by one syntactically trivial error. Humans are still much better at discarding these related errors.

Pascal error messages belong after the lines affected (error puts them before). The alignment of the' I '
marking the point of error is also dis turbed by error.
Error was designed for work on CRT's at reasonably high speed. It is less pleasant on slow speed terminals, and has never been used on hardcopy tenninals.

Sun Release 3.2

Last change: 13 March 1984

149

EX(I)

USER COMMANDS

EX(l)

NAME

ex, edit, e - text editor
SYNOPSIS
ex [ - ] [ -R ] [ -r ] [ -t tag] [ +command] [ -v] [ -x ] [ -wnnn ] [ -I ] file . ..
edit [ options]
DESCRIPTION
ex, a line editor, is the root of a family of editors that includes edit, ex, and vi (the display editor). In most
cases vi is preferred for interactive use.
OPTIONS

supress all interactive feedback to the user -

useful for processing ex scripts in shell files.

-R

Read only. Do not overwrite the original file.

-r

recover the indicatedfiles after a system crash.

-t tag

edit the file containing the tag tag. A tags database must first be created using the ctags(l) command.

+ command
start the editing session by executing command.
-v

start up in display editing state using vi(l). You can achieve the same effect by simply typing the
vi command itself.

-x

prompt for a key to be used in encrypting the file being edited.

-wnnn set the default window (number of lines on your terminal) to nnn- this is useful if you are dialling into the system over a slow 'phone line.
-I

set up for editing LISP programs.

FILES

/usr/lib/ex? ?strings
/usr/lib/ex? ?recover
/usrnib/ex??preserve
/etcltermcap
-/.exrc
/tmplExnnnnn
/tmplRxnnnnn

/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), ed(I), grep(IV), sed(IV), grep(I), vi(I), termcap(5), environ(5V)

Editing Text Files on the Sun Workstation
BUGS

The undo command causes all marks to be lost on lines changed and then restored if the marked lines were
changed.

Undo never clears the buffer modified condition.
The z 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 '-' option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn if text is placed in named buffers and not used before exiting the editor.

150

Last change: 29 May 1986

Sun Release 3.2

USER COMMANDS

EX(l)

EX(l )

Null characters are discarded in input files t and cannot appear in resultant files.
The editor checks the first five lines of the text file for commands of the form "ex:command" or
"vi:command.1t This feature can result in unexpected behavior, and is not recommended in any case.
RESTRICTIONS
The encryption facilities of ex are not available on software shipped outside the U.S.

Sun Release 3.2

Last change: 29 May 1986

151

EXPAND ( 1)

USER COMMANDS

EXPAND ( 1)

NAME

expand, unexpand - expand tabs to spaces, and vice versa
SYNOPSIS

expand [ -tabstop ] [ -tab1 ,tab2, . . .,tabn] [filename ... ]
unexpand [ -a ] [filename... ]
DESCRIPTION

expand copies the named files (or the standard input) to the standard output, with tabs changed into spaces
(blanks). Backspace characters are preserved into the output and decrement the column count for tab calculations. expand is useful for pre-processing character files (before sorting, looking at specific columns,
etc.) that contain tabs.
Unexpand copies the named files (or the standard input) to the standard output, putting tabs back into the
data. By default, only leading spaces (blanks) and tabs are converted to strings of tabs, but this can be
overridden by the -a option (see the options section below).
EXPAND OPTIONS

-tabstop
Specified as a single argument sets tabs tabstop spaces apart instead of the default 8.

-tab1 ,tab2, ... ,tabn
Set tabs at the columns specified by tabl •••
UNEXPAND OPTIONS

-a

152

Insert tabs when replacing a run of two or more spaces would produce a smaller output file.

Lastchange: 17 July 1986

Sun Release 3.2

EXPR( IV)

USER COMMANDS

EXPR( IV)

NAME

expr - evaluate arguments as an expression
SYNOPSIS
expr arg ...
DESCRIPTION
expr evaluates expressions as specified by its arguments. After evaluation, the result is written on the standard output. Each token of the expression is a separate argument, so terms of the expression must be
separated by blanks. Characters special to the shell must be escaped. Note that 0 is returned to indicate a
zero value, rather than the null string. Strings containing blanks or other special characters should be
quoted. Internally, integers are treated as 32-bit, 2s complement numbers.

The operators and keywords are listed below. Characters that need to be escaped are preceded by \. The
list is in order of increasing precedence, with equal precedence operators grouped within {} symbols.

expr \ I expr
returns the first expr if it is neither null nor 0, otherwise returns the second expr.
expr \& expr
returns the first expr if neither expr is null or 0, otherwise returns O.
expr { =, \>, \>=, \<, \<=, != } expr
returns the result of an integer comparison if both arguments are integers, otherwise returns the
result of a lexical comparison.
expr { +, - } expr
addition or subtraction of integer-valued arguments.
expr { \*, /, % } expr
multiplication, division, or remainder of the integer-valued arguments.
expr: expr
match string regular-expression
The two forms of the matching operator above are synonymous. The matching operators : and
match compare the first argument with the second argument which must be a regular expression.
Regular expression syntax is the same as that of ed(I), except that all patterns are "anchored"
(i.e., begin with A) and, therefore, A is not a special character, in that context. Normally, the
matching operator returns the number of characters matched (0 on failure). Alternatively, the
\( •.. \) pattern symbols can be used to return a portion of the first argument.
substr string integer-l integer-2
extracts the subtring of string starting at position integer-l and of length integer-2 characters. If
integer-l has a value greater'than the length of string, expr returns a null string. If you try to
extract more characters than there are in string, expr returns all the remaining characters from
string. Beware of using negative values for either integer-lor integer-2 as expr tends to run forever in these cases.
index string character-list
reports the first position in string at which anyone of the characters in character-list matches a
character in string.
length string
returns the length (that is, the number of characters) of string.
SYSTEM V DESCRIPTION
Integer-valued arguments may be preceded by a unary minus sign.

The operators substr, index, and length are not supported.
EXAMPLES

Sun Release 3.2

Last change: 26 March 1984

153

EXPR( IV)

1.

USER COMMANDS

EXPR( IV)

a=' expr $a + l'
adds 1 to the shell variable a.

2.

# 'For $a equal to either "/usr/abc/file" or just "file" ,
expr $a : ' .*/\(.*\), \ I $a
returns the last segment of a path name (i.e., file). Watch out for I alone as an argument:
expr will take it as the division operator (see BUGS below).

3.

# A better representation of example 2.
expr //$a : ' .*/\(.*\)'
The addition of the II characters eliminates any ambiguity about the division operator and
simplifies the whole expression.

4.

expr $VAR :

'.*'

returns the number of characters in $VAR.
SEE ALSO

ed(I), sh(I), test(l)
EXIT CODE
Expr returns the following exit codes:

o

if the expression is neither null nor 0
if the expression is null or 0
for invalid expressions.

1
2
DIAGNOSTICS

syntax error
non-numeric argument

for operator/operand errors
if arithmetic is attempted on such a string

BUGS

After argument processing by the shell, expr cannot tell the difference between an operator and an operand
except by the value. If $a is an =, the command:
expr $a

= ,-,

looks like:
expr

=

as the arguments are passed to expr (and they will all be taken as the = operator). The following works:
expr X$a = X=
Note that the match, substr, length, and index operators cannot themselves be used as ordinary strings.
That is, the expression:
tutorial% expr index expurgatorious length
syntax error
tutorial%
generates the 'syntax error' message as shown instead of the value I as you might expect.

154

Last change: 26 March 1984

Sun Release 3.2

EYACC(l)

USER COMMANDS

EYACC( 1)

NAl\1E

eyacc - modified yacc allowing much improved error recovery
SYNOPSIS

eyacc [ -v] [grammar]
DESCRIPTION

Eyacc is a version of yacc(1), that produces tables used by the Pascal system and its error recovery routines. Eyacc fully enumerates test actions in its parser when an error token is in the look -ahead set. This
prevents the parser from making undesirable reductions when an error occurs before the error is detected.
The table format is different in eyacc than it was in the old yacc, as minor changes had been made for
efficiency reasons.
SEE ALSO

yacc(l)
Practical LR Error Recovery by Susan L. Graham, Charles B. Haley and W. N. Joy; SIGPLAN Conference
on Compiler Construction, August 1979.

BUGS
Pc and its error recovery routines should be made into a library of routines for the new yacc.

Sun Release 3.2

Last change: 25 April 1983

155

F77 ( 1)

USER COMMANDS

F77 (1 )

NAME
f77 - FORTRAN 77 compiler
SYNOPSIS

f77 [ -66 ] [ -a ] [ -align _block] [ -c ] [ -c ] [-dryrun ] [ -Dname [=def] ] [float_option]
[ -fstore ] [ -F] [ -g] [ -help] [ -i2 ] [ -i4 ]
[-Ipathname] [-llib] [-Ldir] [-m4] [-N[qxscn]nnn]
outftle ] [ -onetrip ] [ -0] [ -p ] [ -pg] [ -pipe] [ -P ] [ -Qoption prog opt]
[ -Qpath pathname ] [ -Qproduce sourcetype ] [ -s ] [-temp=dir] [ -time]
[ -u ] [ -u] [ -v ] [ -w [66]] sourcefile ...
[ -0

DESCRIPTION

[77 is the FORTRAN 77 compiler, which translates programs written in the FORTRAN 77 programming
language into executable load modules or into relocatable binary programs for subsequent linking with
Id(l). In addition to the many flag arguments (options),j77 accepts several types of files. Filenames ending in .f are taken to be FORTRAN 77 source programs; they are compiled, and each object program is left
in the file (in the current directory) whose name is that of the source with .0 substituted for .f. Filenames
ending in .F are also taken to be FORTRAN 77 source programs, but they are preprocessed by the C preprocessor (equivalent to a cc -E command) before they are compiled by the[77 compiler.
Filenames ending in .r are taken to be Ratfor source programs; these are first transformed by the ratfor(l)
preprocessor, then compiled by [77.
Filenames ending in .c or .s are taken to be C or assembly source programs and are compiled or assembled,
producing .0 files.
Filenames ending in .il are taken to be in-line expansion code template files; these are used to expand calls
to selected routines in-line when the -0 option is in effect.
OPTIONS

See Id(1) for link-time options.

-66

Report non-FORTRAN 66 constructs as errors

-a

Insert code to count how many times each basic block is executed. Creates a .d file for
every .f file compiled. The.d file accumulates execution data for the corresponding
source file. The tcov(l) utility can then be run on the source file to generate a line-byline execution profile of the program.

-align _block

Cause the global symbol whose FORTRAN name is block to be page-aligned: its size is
insreased to a whole number of pages, and its first byte is placed at the beginning of a
page.

-c

Suppress linking with Id(l) and produce a .0 file for each source file. A single object file
can be named explicitly using the -0 option.

-C

Compile code to check that subscripts are within the declared array bounds.

-dryrun

Show but do not execute the commands constructed by the compilation driver.

-Dname [=def] Define a symbol name to the C preprocessor (cpp(l». Equivalent to a #define directive
in the source. If no def is given, name is defined as '1' ( .F suffix files only).

Floating-point code generation option. Can be one of:
-f68881
Generate in-line code for the Motorola MC68881 floating-point coprocessor
(supported only on Sun-3 systems).

156

-ffpa

Generate in-line code for the Sun Floating-Point Accelerator (supported only on
Sun-3 systems).

-fsky

Generate in-line code for the Sky floating-point processor (supported only on
Sun-2 systems).

Last change: 8 April 1986

Sun Release 3.2

F77 ( 1)

USER COMMANDS

-fsoft

F77 (1)

Generate software floating-point calls (this is the default).

-fswitch
Generate run-time-switched floating-point calls. The compiled object code is
linked at runtime to routines that support one of the above types of floating-point
code. This was the default in previous releases. Only for use with programs
that are floating-point intensive and which must be portable to machines with
various floating-point options.
-fstore

Insure that expressions allocated to extended precision registers are rounded to storage
precision whenever an assignment occurs in the source code. Only has effect when
-f68881 or -ffpa, and -0 or -P are specified.

-F

Apply the C preprocessor to .F files and the Ratfor preprocessor to .r files. Put the result
in corresponding jfiles, but do not compile them. No linking is done.

-g

Produce additional symbol table information for dbx(l) and pass the -Ig flag to ld(l).

-help

Display helpful information aboutj77.

-i2

Make the default size of integer and logical constants and variables two bytes.

-i4

Make the default size of integer and logical constants and variables four bytes (this is the
default).

-Ipathname

Add pathname to the list of directories in which to search for #include files with relative
filenames (not beginning with I). The preprocessor first searches for #include files in the
directory containing sourcefile, then in directories named -with -I options (if any), and
finally in lusrlincludelj77 (applies to processing of .F suffix files only).

-llib

Link with object library lib (for ld(I».

-Ldir

Add dir to the list of directories containing object-library routines (for linking using
ld(1».

-m4

Apply the M4 preprocessor to each .r file before transforming it with the Ratfor preprocessor.

-N[qxscn]nnn

Make static tables in the compiler bigger. 177 complains if tables overflow and suggests
you apply one or more of these flags. These flags have the following meanings:
q
Maximum number of equivalenced variables. Default is 150.
x
Maximum number of external names (common block, subroutine, and function
names). Default is 200.
s
Maximum number of statement numbers. Default is 401.
c
Maximum depth of nesting for control statements (for example, DO loops).
Default is 20.
n
Maximum number of identifiers. Default is 1009.
Multiple -N options increase sizes of multiple tables.

-ooutfile

Name the output file out/tie. outfile must have the appropriate suffix for the type of file to
be produced by the compilation (see FILES, below). outfile cannot be the same as
sourcefile (the compiler will not overwrite the source file).

-onetrip

Compile DO loops so that they are performed at least once if reached. FORTRAN 77 DO
loops are not performed at all if the upper limit is smaller than the lower limit.

-0

Optimize the object code. This invokes both the global intermediate code optimizer and
the object code optimizer.

-p

Prepare the object code to collect data for profiling with prof(l). Invokes a run-time
recording mechanism that produces a mon.out file (at normal termination).

-pg

Prepare the object code to collect data for profiling with gprof(l). Invokes a run-time

Sun Release 3.2

Last change: 8 April 1986

157

F77 (1)

USER COMMANDS

F77 (1)

recording mechanism that produces a gmon.out file (at normal termination).
-pipe

-p

Use pipes, rather than intermediate files between compilation stages. Very cpu-intensive.
Partial optimization. Does a restricted set of global optimizations. Do not use -P unless

-0 results in excessive compilation time.
-Qoption pro g opt
Pass the option opt to the program pro g. The option must be appropriate to that program
and may begin with a minus sign. prog can be one of: as, c2, cg, cpp, f77passl, iropt,
inline, Id, m4, or ratfor.
-Qpath pathname
Insert directory pathname into the compilation search path (to use alternate versions of
programs invoked during compilation).
-Qproduce source type
Produce source code of the type sourcetype. sourcetype can be one of:
.f
Source file from ratfor(I) .
•0
Object file from as (l).
.s
Assembler source (from[77passl , inline c2 or cg ).

-S

Compile the named programs, and leave the assembly language output on corresponding
files suffixed .s (no .0 file is created).

-temp=dir

Set directory for temporary files to be dir.

-time

Report execution times for the various compilation passes.

-u

Make the default type of a variable 'undefined' rather than using the FORTRAN default
rules.

-u

Do not convert upper case letters to lower case. The default is to convert upper case
letters to lower case, except within character string constants.

-v

Verbose. Print the version number of the compiler and the name of each program it executes.

-w[66]

Suppress all warning messages. -w66 supresses only FORTRAN 66 compatibility warnings.

Other arguments are taken to be either linker option arguments, or j77 -compatible object programs, typically produced by an earlier run, or libraries of[77 -compatible routines. These programs, together with the
results of any compilations specified, are linked (in the order given) to produce an executable program in
the file specified by the -0 option, or in a file named a .out if the -0 option is not specified.
ENVIRONMENT
FLOAT OPTION When no floating-point option is specified, the compiler uses the value of this environment variable (if set). Recognized values are: f68881, ffpa, fsky, fswitch and fsoft.

FILES

a.out
file.a
file .c
file.d
file .f
file.F
file .il
file.o
file.p
file.r
file.s
file.S

158

executable output file
library of object files
C source file
tcov(l) test coverage input file
FORTRAN 77 source file
FORTRAN 77 source file for cpp(1)
inline expansion file
object file
Pascal source file
Ratfor source file
assembler source file
assembler source for cpp (1)

Last change: 8 April 1986

Sun Release 3.2

F77 ( 1)

USER COMMANDS

file .tcov
/lib/bin/ratjor
llib/c2
/lib/cg
/lib/compile
Ilib/cpp
llib/crtO.o
/lib/Fcrtl.o
llib/gcrtO.o
/libllibc .a
/lib/mcrtO.o
Ilib/M crtl.o
/lib/Scrtl.o
Ilib/Wcrtl.o
/ usrlincl ude/f17
/usrllib!fl7passl
/usr/Ub/libc y.a
/usrllibllibF77.a
/usrllib/inline
/usrllibllibI77.a
/usrllib/libm.a
/usrllib/ libpfc.a
/usrllib/ libU77.a
/tmp/*
mon.out
gmon.out

F77 (1)

output from tcov(I)
Ratfor preprocessor
optional optimizer
FORTRAN 77 code generator
compiler command-line processing driver
macro preprocessor
runtime startoff
startup code for -fsoft option
startoff for gprof-profiling
standard library, see intro(3)
startoff for profiling
startup code for -f68881 option
startup code for -fsky option
startup code for -ffpa option
directory searched by the FORTRAN 77 include statement
FORTRAN 77 parser
profiling library, see intro(3)
FORTRAN 77 library
inline expander of library calls
FORTRAN 77 library
math library
startup code for combined Pascal and FORTRAN 77 programs
FORTRAN 77 library
compiler temporary files
file produced for analysis by prof(I)
file produced for analysis by gprof(I)

SEE ALSO

cc( 1V), gprof( 1), Id( 1), prof( 1), ratfor( 1)
FORTRAN Programmer's Guide
Floating-Point Programmer's Guide for the Sun Workstation
DIAGNOSTICS

The diagnostics produced by [17 itself are intended to be self-explanatory. Occasional messages may be
produced by the linker.

Sun Release 3.2

Last change: 8 April 1986

159

FILE ( 1)

USER COMMANDS

FILE(1)

NAME

file - determine file type
SYNOPSIS

file [ -Lc] [ -f ffile ] [ -m mfile ] filename . ..
DESCRIPTION
file performs a series of tests on each filename in an attempt to determine what it contains. If the contents
of a file appear to be ASCII text,file examines the first 512 bytes and tries to guess its language.

file uses the file letclmagic to identify files that have some sort of magic number, that is, any file containing
a numeric or string constant that indicates its type.
OPTIONS
-f

-m
-L
-c

Get a list of filenames to identify fromffile.
Use mfile as the name of an alternate magic number file.
If a file is a symbolic link, test the file the lin~ references rather than the link itself.

Check for format errors in the magic number file. For reasons of efficiency, this validation is not
normally carried out. No file type-checking is done under -c.

EXAMPLE

The example illustrates the use of file on all the files in a specific user's directory:
%pwd
lusrlblort/mise
% file *
mc68020 demand paged executable
code:
c program text
code.c:
counts:
ascii text
roff, nroff, or eqn input text
doc:
empty. file: empty
libz:
archive random library
memos:
directory
symbolic link to /usr/project
project:
executable shell script
script:
titles:
ascii text
cpio archive
s5.stuff:
%

SEE ALSO

magic(5)

BUGS
file often makes mistakes. In particular, it often suggests that command files are C programs.

Does not recognize Pascal or LISP.

160

Last change: 29 April 1986

Sun Release 3.2

FIND ( 1)

USER COMMANDS

FIND ( I}

NAME

find - find files
SYNOPSIS
find pathname-list expression
DESCRIPTION
find recursively descends the directory hierarchy for each pathname in the pathname-list, seeking files that
match a boolean (logical) expression written in the primaries given below. In the descriptions, the argument n is used as a decimal integer where +n means more than n, -n means less than n, and n means

exactly n.

-fstype type

True if the filesystem to which the the file belongs is of type type, where type is typically
4.2 or nfs.

-name filename True if the filename argument matches the current file name. Shell argument syntax can
be used if escaped (watch out for [, ? and *).

-perm onum

True if the file permission" flags exactly match the octal number onum (see chmod(1V)}.
If onum is prefixed by a minus sign, more flag bits (017777, see chmod(l V)) become
significant and the flags are compared: (fiags&onum)==onum.

-prune

Always yields true. Has the side effect of pruning the search tree at the file. That is, if
the "current path name is a directory, find will not descend into that directory.

-type c

True if the type of the file is c, where c is one of:
b

for block special file,

c

for character special file,

d

for directory,

f

for plain file,

p

for named pipe (FIFO),
for symbolic link, or

s

for socket.

-links n

True if the file has n links.

-user uname

True if the file belongs to the user uname. If uname is numeric and does not appear as a
login name in the /etc/passwd database, it is taken as a user ID.

-nouser

True if the file belongs to a user not in the /etc/passwd database.

-group gname

True if the file belongs to group gname. If gname is numeric and does not appear as a
login name in the /etc/group database, it is taken as a group ID.

-nogroup

True if the file belongs to a group not in the /etc/group database.

-size n

True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is
in characters.

-inurn n

True if the file has inode number n.

-atirne n

True if the file has been accessed in n days. Note that the access time of directories in
path-name-list is changed by find itself.

-mtirne n

True if the file has been modified in n days.

-ctime n

True if the file has been changed in In days. "Changed" means either that the file has
been modified or some attribute of the file (its owner, its group, the number of links to it,
etc.) has been changed.

-exec command True if the executed command returns a zero value as exit status. The end of command
must be punctuated by an escaped semicolon. A command argument {} is replaced by

Sun Release 3.2

Last change: 20 June 1986

161

FIND ( 1)

USER COMMANDS

FIND ( 1)

the current pathname.
-ok command

Like -exec except that the generated command is written on the standard output, then the
standard input is read and the command executed only upon response y.

-print

Always true; the current pathname is printed.

-Is

Always true; causes current pathnameto be printed together with its associated statistics.
These include (respectively) inode number, size in kilobytes (1024 bytes), protection
mode, number of hard links, user, group, size in bytes, and modification time. If the file
is a special file the size field will instead contain the major and minor device numbers. If
the file is a symbolic link the pathname of the linked-to file is printed preceded by "->".
The format is identical to that of "Is -gilds" (note however that formatting is done internally, without executing the Is program).

-cpio device

Always true; write the current file on device in cpio(4) format (5120-byte records).

-ncpio device

Always true; write the current file on device in cpio -c format (5120-byte records).

-newer file

True if the current file has been modified more recently than the argumentfile.

-xdev

Always true; causes find not to traverse down into a file system different from the one on
which current argument pathname resides.

-depth

Always true; causes descent of the directory hierarchy to be done so that all entries in a
directory are acted on before the directory itself. This can be useful when find is used
with cpio(l) to transfer files that are contained in directories without write permission.

( expression)

True if the parenthesized expression is true (parentheses are special to the shell and must
be escaped).

!primary

True if the primary is false ('!' is the unary not operator).

primary1 [ -a] primary2
True if both primary1 and primary2 are true. The -a is not required. It is implied by the
juxtaposition of two primaries.
primary1

-0

primary2
True if either primary1 or primary2 is true (' -0' is the or operator).

EXAMPLE
In our local development system, we keep a file called TIMESTAMP in all the manual page directories.
Here is how to find all entries that have been updated since TIMESTAMP was created:
angel% find lusr/man/man2 -newer lusr/man/man2ITIMEST AMP -print
lusr/man/man2
lusr/man/man21 socket.2
lusr/man/man2/mmap.2

angel%
To find all the files called intro.ms starting from the current directory:
angel% find. -name intro.ms -print
.Imanuals/assembler/intro.ms
.Imanuals/sun.core/intro.ms
.Imanuals/driver.tutlintro.ms
.Imanuals/sys.manager/uucp.impl/intro.mss
.Isupplements/general.works/unix.introduction/intro.mss
.Isupplements/programming.tools/sccs/intro.mss
angel%
To recursively print all files names in the current directory and below, but skipping
angel% find. -name sees -prune -0 -print
angel%

162

Last change: 20 June 1986

secs directories:

Sun Release 3.2

FIND ( 1)

USER COMMANDS

FIND ( 1)

To recursively print all files names in the current directory and below, skipping the contents of sees directories, but printing out the sees directory name:
angel% find. -print -name sees -prune
angel%
To remove files beneath your home directory named 'a.out' or '*.0' that have not been accessed for a week
and that aren't mounted using NFS:
angel% cd
angel% find. \( -name a.out -0 -name '*.0' \) -atime +7 -exec rm {} \; -0 -fstype nfs -prune
FILES

letc/passwd
/etc/group
SEE ALSO

chmod(1 V), cpio(1), sh(1), test(1 V), cpio(5), fs(5)

Sun Release 3.2

Last change: 20 June 1986

163

FINGER ( 1)

USER COMMANDS

FINGER ( 1)

NAME

finger - display information about users
SYNOPSIS
finger [ options] username ...
DESCRIPTION
finger displays information about each named user, including his or her:
login name,
full name,
terminal name (prepended with a '*' if write-permission is denied),
idle time,
login time,
office location, and
phone number
if known.
A

username
may be a first and last name, or an account name.
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.
Information is presented in a multi-line format, and may
include the user's home directory and login shell, any plan
contained in the file
.plan
in the user's home directory, and a project on which they are
working described in the file
.project
(also in that directory).
Ifa
username
argument contains an at-sign, "@", then a connection
is attempted to the machine named after the at-sign, and the remote
finger daemon is queried.
OPTIONS
-m

Match arguments only on username.

-I

Force long output format.

-p

Suppress printing of the .plan files

-s

Force short output format.

FILES

letc!utmp

who is logged in

letc!passwd

for users names

lusrladmllastlog

last login times

-I.plan

plans

7.project

projects

SEE ALSO
w(I), who(l), whois(l)

164

Last change: April 29, 1985

Sun Release 3.2

FINGER ( 1)

USER COMMANDS

FINGER(l)

BUGS

Only the first line of the .project file is printed.

Sun Release 3.2

Last change: April 29, 1985

165

FMT( 1)

USER COMMANDS

FMT( 1)

NAME

fmt - simple text formatter
SYNOPSIS
fmt [ -width] [ -c ] [input-file ..• ]
DESCRIPTION
Imt is a simple text formatter. It joins and fills input lines to produce output lines of up to 72 characters by

default. Imt concatenates the input-files listed as arguments. If none are given,lmt accepts text from the
standard input.
Blank lines are preserved in the output, as is spacing between words.
Normally, if the left-hand margin of a line is indented, that indention is preserved in the output. Input lines
with differing indention aren't normally joined.
Imt is meant to format mail messages before sending, but may also be useful for other simple tasks. For
instance, while in the vi text editor, the command:
!}fmt
reformats a paragraph, making the lines reasonably even in length.
Imt does not fill lines beginning with. or From: for compatibility with nroff(1) and rnail(1).
OPTIONS

-width Fill output lines to up to width columns wide.

-c

Crown margin mode (useful for tagged paragraphs). Imt preserves the indention of the first two
lines in each paragraph. The left margin of the third and subsequent lines is aligned with that of
the second.

SEE ALSO

nroff(l), mail(l)

166

Last change: 17 February 1986

S un Release 3.2

FOLD ( 1)

USER COMMANDS

FOLD ( 1)

NAME

fold - fold long lines for finite width output device
SYNOPSIS

fold [ -width] [ file ••• ]
DESCRIPTION

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 usingfold.
SEE ALSO

expand(l)
BUGS

Folding may not work correctly if underlining is present

Sun Release 3.2

Last change: 27 April 1983

167

FONTEDIT ( 1 )

USER COMMANDS

FONTEDIT ( 1 )

NAME

fontedit - a vfont screen-font editor
SYNOPSIS

fontedit [-W[generic_tool_arg]] [font_name]
DESCRIPTION

fontedit is an editor for fixed-width fonts in vfont format whose characters are no taller than 24 pixels
(larger characters will not fit completely onto the screen). For a description of vfont format, see vfont(5).
OPTIONS

-Wgeneric_too 1_arg
fontedit accepts any generic tool argument as described in suntools(l). Otherwise, you can manipulate the tool via the Tool Manager Menu.
COMMANDS

To edit a font, type 'fontedit'. Afont_name may be supplied on the command line or may be typed into the
option sub window once the program has started. If it exists, the font_name file must be in vfont format.
When the program starts, it displays a single large window containing four subwindows. From top to bottom, the four sub windows are:
1)

The top subwindow, a message subwindow, displays messages, prompts, and warnings.

2)

The second suhwindow from the top, an option subwindow, allows you to set global parameters for
the entire font and specify operations for editing any single character. The options are:
(Load)

Load in the font specified in the file name field. The program will warn you if you try to
read over a modified font.

(Store)

Store the current font onto disk with the name in file name field.

(Quit)

Quit the program; warns you if you have modified the font.

Font name:
The name of the font
Max Width and Max Height:
The size, in pixels, of the largest character in the font. If you edit an existing font, these
parameters are set automatically; you must set them if you are creating a new font.
Changing either of these values for an existing font may alter the glyph of some characters of the font. If the glyph size of a character is larger than the new max size, then that
character is clipped to the new size (its bottom and right edges are moved in). However, if
a glyph's size is smaller than the new size, the glyph is left alone.
Caps Height and X-Height:
The distance, in pixels, between the top of a capital and lowercase letter and the baseline.
When an existing font is edited, the values of Caps Height and X-Height are estimated
by!ontedit, and may require some adjustment
Baseline:

The number of pixels from the top (i.e., the upper left corner) of the character to the baseline. For an existing font, the value of the largest baseline distance is used. For a new font,
each character will have the same baseline distance. If this value is changed, then the
baseline distance for all characters in the font will be the new value.

(Apply)

Apply the current values of Max Width, Max Height, Caps Height, X-Height, and
Baseline to the font. That is, changes made to these values do not take effect until Apply
is selected.

Operation:
This is a list of drawing and editing operations that you can perform on a character. For
drawing, the left mouse button draws in black, and the middle draws in white. Operations
are:

168

Last change: 10 October 1985

Sun Release 3.2

FONTEDIT ( 1 )

USER COMMANDS

FONTEDIT ( 1 )

Single Pt

Press a mouse button down and a grey cell will appear; move the mouse and
the cell will follow it. Releasing the the button will draw.

Pt Wipe

Pressing a button down will draw and moving with the button down will continue drawing until the button is released.

Line

Button down marks the end point of a line; moving with the button down
rubber bands a line; releasing button draws the line.

Reet

Like Line except draws a rectangle.

Cut

Button down marks one end of rectangle, and moving rubber bands the outline of the rectangle. Button up places the contents of the rectangle into a
buffer and then "cuts" (draws in white) the rectangular region from the
character. The Paste operation (below) gets the data from the buffer.

Copy

Like Cut except that the region is just copied; no change is made to the character.

Paste

Button down displays a rectangle the size of the region in the buffer. Moving
with the button down moves the rectangle. Button up pastes the contents of
the buffer into the character.
The contents of the paste buffer cannot be transferred between tools.
In Copy or Cut mode, holding down the shift key while pressing the left or
middle mouse button will perform a Paste action. For best results, after placing a region in the buffer, press down the shi(t key and hold it down, then
press down the mouse button. Release the mouse key to paste the region and
then release the shift key.

3)

The third subwindow echoes the characters in the current font as they are typed. Note that the cursor
must be in this window in order to see the characters. Your character delete key will delete the echoed
characters.

4)

The bottom subwindow, the editing subwindow, displays eight smaller squares at its top; these are
called edit buttons. The top section of each of these buttons contains a line of text in the form nnn: c,
where nnn is the hexadecimal number of the character and c is the standard ASCII character
corresponding to that number. In the lower section of the button the character of the current font, if it
exists, is displayed. Clicking once over an editing button selects its character for editing.
Just below this row of buttons is a box with the characters "0 9 A Z a z" in it. This box is called a
slider. The slider allows you to scroll around in the font and select which section of the font you want
displayed in the edit buttons. The black rectangle near" a" is an indicator which shows the section of
the font that is displayed in the buttons above. To move the indicator, select it by pressing the left or
middle mouse button down over the indicator and then move the mouse to the left or right with the
button down; the indicator will slide along with the cursor. Releasjng the button selects the new section of the font. A faster method of moving about in the font is to just press down and release the
mouse button above the area you want without bothering to drag the indicator. Another method of
scrolling through the characters of the font is to press a key on the keyboard when the cursor is in the
bottom window; that character is the first one displayed in the edit buttons.

EDITING CHARACTERS:

To edit a character, click once over the edit button where the character is displayed. When you do this, an
edit pad will appear in the bottom subwindow.
The edit pad consists of an editing area bordered by scales, a proof area, and 3 command buttons. The editing area is Max Width by Max Height when the pad opens, and displays a magnified view of the selected
character. Black squares indicate foreground pixels. The editing area is surrounded by scales which show
the current Caps Height, X-Height and Baseline in reverse video.

Sun Release 3.2

Last change: 10 October 1985

169

FONTEDIT ( 1 )

USER COMMANDS

FONTEDIT ( 1 )

Just outside the scales, on the top, right side, and bottom of the pad, are three small boxes with the capital
letters "R", "B", and "A" in them. These boxes are movable sliders that change the right edge, bottom edge,
and x-axis advance of the character respectively. In a fixed-width font, these values are usually the same
for all characters; however, in a variable-width font these controls can be used to set these properties for
each character.
To the right of the pad is the proof area where the character is displayed at normal (that is, screen) resolution and three buttons. The three buttons are:
Undo

Clicking the left or middle mouse button undoes the last operation.

Store

Stores the current representation of the character in the font.

Quit

Closes the edit pad.

In the bottom subwindow, the right mouse button displays a menu of operations. These operations are the
same as those in the option subwindow discussed above; you can select the current operation by either
picking the operation in the option subwindow or by selecting the appropriate menu with the left button of
the mouse. When the cursor is in the other subwindows, the left button displays the standard tool menu.
FILES

Iusr/liblfonts!fixedwidthfonts

Sun-supplied screen fonts

SEE ALSO

suntools(l), vfont (5), vswap(l)

BUGS
Results are unpredictable with variable-width fonts. The baseline should be greater than 0 or else the font
cannot be read in by fontedit or by suntools(I).

170

Last change: 10 October 1985

Sun Release 3.2

FPR( 1)

USER COMMANDS

FPR( 1)

NAME

fpr - print FORTRAN file
SYNOPSIS

fpr
DESCRIPTION
Ipr transforms files formatted according to FORTRAN's carriage control conventions into files formatted
according to UNIX line printer conventions.

Fpr copies its input onto its output, replacing the carriage control characters with characters that will produce the intended effects when printed using lpr(l). The first character of each line determines the vertical
spacing as follows:
(blank) one line

o

two lines

1

to first line of next page

+

no advance

A blank line (that is, an empty line) is treated as if its first character is a blank. A blank that appears as a
carriage control character is deleted. A zero is changed to a newline. A one is changed to a form feed. The
effects of a "+" are simulated using backspaces.
Note that Ipr is known as asa in UNIX System V.
EXAMPLES
a.out I fpr Ilpr

fpr < f77.output Ilpr
BUGS

Results are undefined for input lines longer than 170 characters.

Sun Release 3.2

Last change: 24 October 1983

171

FROM ( 1)

USER COMMANDS

FROM(l)

NAME

from - who is my mail from?
SYNOPSIS
from [ -ssender ] [user]
DESCRIPTION
From prints out the mail header lines in your mailbox file to show you who your mail is from. If user is
specified, then user's mailbox is examined instead of your own.
OPTIONS

-ssender
Only display headers for mail sent by sender.
FILES

lusrlspooVmaill*
SEE ALSO
biff(l), mail(l), prmail(l)

172

Last change: 27 April 1983

Sun Release 3.2

FSPLIT( 1)

USER COMMANDS

FSPLIT( 1)

NAME

fsplit - split a multi-routine FORTRAN file into individual files
SYNOPSIS

fsplit [ -e efile ] ... [file]
DESCRIPTION
F split takes as input either a file or standard input containing FORTRAN source code. It attempts to split

the input into separate routine files of the form namef, where name is the name of the program unit (function, subroutine, block data or program). The name for unnamed block data subprograms has the form
blkdtaNNNf where NNN is three digits and a file of this name does not already exist. For unnamed main
programs the name has the form mainNNNf. If there is an error in classifying a program unit, or if name f
already exists, the program unit will be put in a file of the form zzzNNNJwhere zzzNNNJdoes not already
exist.
Normally each subprogram unit is split into a separate file. When the -e option is used, only the specified
subprogram units are split into separate files. E.g.:
fsplit -e readit -e doit progJ
will split readit and doit into separate files.
DIAGNOSTICS
If names specified via the -e option are not found, a diagnostic is written to standard error.
BUGS

Fsplit assumes the subprogram name is on the first noncomment line of the subprogram unit. Nonstandard
source formats may confuse [split.

It is hard to use -e for unnamed main programs and block data subprograms since you must predict the
created file name.

Sun Release 3.2

Last change: 24 August 1983

173

FTP( lC)

USER COMMANDS

FTP(IC)

NAME

ftp - file transfer program
SYNOPSIS

rtp [ -v] [ -d] [ -i] [ -n ] [ -g ] [ -t] [host]
DESCRIPTION
ftp is the user interface to the ARPANET standard File Transfer Protocol. ftp transfers files to and from a

remote network site.
The client host with whichftp is to communicate may be specified on the command line. If this is done,/tp
immediately attempts to establish a connection to an FTP server on that host; otherwise, ftp enters its command interpreter and awaits instructions from the user. When ftp is awaiting commands from the user, it
displays the prompt "ftp>".
OPTIONS

Options may be specified at the command line, or to the command interpreter.
-v

show all responses from the remote server, as well as report on data transfer statistics. This is
turned on by default ifftp is running interactively with its input coming from the user's terminal.

-0

do not attempt "auto-login" upon initial connection. If auto-login is enabled, ftp checks the
.netrc file in the user's home directory for an entry describing an account on the remote machine.
If no entry exists, ftp uses the login name on the local machine as the user identity on the remote
machine, and prompts for a password and, optionally, an account with which to login.

-i

turn off interactive prompting during multiple file transfers.

-g

disable filename "globbing."

-d

enable debugging.

-t

enable packet tracing (unimplemented).

COMMANDS
! [command]

Run command as a shell command on the local machine. If no command is given, invoke an
interactive shell.

append local-file [ remote-file]
Append a local file to a file on the remote machine. If remote-file is left unspecified, the local file
name is used in naming the remote file. File transfer uses the current settings for' 'representation
type", "file structure", and "transfer mode".
ascii

Set the "representation type" to "network ASCII". This is the default type.

bell

Arrange that a bell be sounded after each file transfer command is completed.

binary Set the "representation type" to "image".
bye

Terminate the FTP session with the remote server and exitftp.

cd remote-directory
Change the working directory on the remote machine to remote-directory.

close

Terminate the FTP session with the remote server, and return to the command interpreter.

delete remote-file
Delete the file remote-file on the remote machine.
debug [ debug-value]
Toggle debugging mode. If an optional debug-value is specified it is used to set the debugging
level. When debugging is on, ftp prints each command sent to the remote machine, preceded by
the string" -->".
dir [ remote-directory] [ local-file]

174

Last change: 17 February 1986

S un Release 3.2

FTP( IC)

USER COMMANDS

FTP( IC)

Print a listing of the directory contents in the directory, remote-directory, and, optionally, placing
the output in local-file. If no directory is specified, the current working directory on the remote
machine is used. If no local file is specified, or local-file is -, output comes to the terminal.

form [format-name]
Set the carriage control format subtype of the "representation type" to format-name. The only
validformat-name is non-print, which corresponds to the default "non-print" subtype.
get remote-file [ local-file ]
Retrieve the remote-file and store it on the local machine. If the local file name is not specified, it
is given the same name it has on the remote machine. The current settings for "representation
type", "file structure" , and "transfer mode" are used while transferring the file.
glob

Toggle filename expansion, or "globbing", for mdelete, mget and mput. If globbing is turned off,
filenames are taken literally.
Globbing for mput is done as in csh (1). For mdelete and mget, each remote file name is
expanded separately on the remote machine, and the lists are not merged.
Expansion of a directory name is likely to be radically different from expansion of the name of an
ordinary file: the exact result depends on the remote operating system and FTP server, and can be
previewed by doing 'mls remote-files -' .

mget and mput are not meant to transfer entire directory subtrees of files. You can do this by
transferring a tar (1) archive of the subtree (using a "representation type" of "image" as set by
the binary command).
hash

Toggle hash-sign (#) printing for each data block transferred. The size of a data block is 1024
bytes.

help [ command]
Print an informative message about the meaning of command. If no argument is given,ftp prints a
list of the known commands.
led [ directory ]
Change the working directory on the local machine. If no directory is specified, the user's home
directory is used.
Is [ remote-directory] [local-file]
Print an abbreviated listing of the contents of a directory on the remote machine. If remotedirectory is left unspecified, the current working directory is used. If no local file is specified, or if
local-file is -, the output is sent to the terminal.

mdelete [ remote-files ]
Delete the remote-files on the remote machine.
mdir remote-files local-file
Like dir, except multiple remote files may be specified.
mget remote-files
Expand the remote-files on the remote machine and do a get for each file name thus produced.
See glob for details on the filename expansion. Files are transferred into the local working directory, which can be changed with 'led directory'; new local directories can be created with
'! mkdir directory'.
mkdir directory-name
Make a directory on the remote machine.
mls remote-files local-file
Like Is, except multiple remote files may be specified.

mode [ mode-name ]
Set the "transfer mode"

Sun Release 3.2

to mode-name. The only valid mode-name is stream, which

Last change: 17 February 1986

175

FTP( lC)

USER COMMANDS

FTP( lC)

corresponds to the default "stream" mode.
mput local-files
Expand wild cards in the list of local files given as arguments and do a put for each file in the
resulting list. See glob for details of filename expansion.
open host [port]
Establish a connection to the specified host FTP server. An optional port number may be supplied, in which case,ftp will attempt to contact an FTP server at that port. If the auto-login option
is on (default),ftp will also attempt to automatically log the user in to the FTP server (see below).
prompt Toggle interactive prompting. Interactive prompting occurs during multiple file transfers to allow
the user to selectively retrieve or store files. By default, prompting is turned on. If prompting is
turned off, any mget or mput will transfer all files, and any mdelete will delete all files.
put local-file [ remote-file ]
Store a local file on the remote machine. If remote-file is left unspecified, the local file name is
used in naming the remote file. File transfer uses the current settings for "representation type",
"file structure" , and "transfer mode" .
pwd

Print the name of the current working directory on the remote machine.

quit

A synonym for bye.

quote argl arg2 ...
Send the arguments specified, verbatim, to the remote FTP server. A single FfP reply code is
expected in return.
recv remote-file [ local-file]
A synonym for get.
remotehelp [command-name ]
Request help from the remote FfP server. If a command-name is specified it is supplied to the
server as well.
rename from to
Rename the file from on the remote machine to have the name to.
rmdir directory-name
Delete a directory on the remote machine.
send local-file [ rerrwte-file ]
A synonym for put.
sendport
Toggle the use of PORT commands. By default,ftp will attempt to use a PORT command when
establishing a connection for each data transfer. If the PORT command fails, ftp will use the
default data port. When the use of PORT commands is disabled, no attempt will be made to use
PORT commands for each data transfer. This is useful for certain FTP implementations which
ignore PORT commands but incorrectly indicate they've been accepted.
status

Show the current status offtp.

struct [ struct-name ]
Set the "file structure" to struct-name. The only valid struct-name is file, which corresponds to
the default' 'file" structure.
tenex

Set the "representation type" to that needed to talk to TENEX machines.

trace

Toggle packet tracing (unimplemented).

type [ type-name]
Set the "representation type" to type-name. The valid type-name s are ascii for "network
ASCII", binary or image for "image", and tenex for "local byte size" with a byte size of 8

176

Last change: 17 February 1986

Sun Release 3.2

FTP( lC)

USER COMMANDS

FfP( lC)

(used to talk to TENEX machines). If no type is specified, the current type is printed. The default
type is "network ASCII' , .
user user-name [password] [ account]
Identify yourself to the remote FfP server. If the password is not specified and the server requires
it, ftp will prompt the user for it (after disabling local echo). If an account field is not specified,
and the FTP server requires it, the user will be prompted for it. Unlessftp is invoked with "autologin" disabled, this process is done automatically on initial connection to the FTP server.
verbose Toggle verbose mode. In verbose mode, all responses from the FTP server are displayed to the
user. In addition, if verbose mode is on, when a file transfer completes, statistics regarding the
efficiency of the transfer are reported. By default, verbose mode is on ifftp's commands are coming from a terminal, and off otherwise.

? [command]
A synonym for help.
Command arguments which have embedded spaces may be quoted with quote (") marks.
If any command argument which is not indicated as being optional is not specified, ftp will prompt for that
argument.
FILE NAMING CONVENTIONS

Local files specified as arguments toftp commands are processed according to the following rules.
1)

If the file name "-" is specified, the standard input (for reading) or standard output (for writing) is

used.
2)

If the first character of the file name is "I", the remainder of the argument is interpreted as a shell

command. ftp then forks a shell, using popen(3S) with the argument supplied, and reads (writes)
from the standard output (standard input) of that shell. If the shell command includes spaces, the
argument must be quoted; e.g. ""I Is -It"". A particularly useful example of this mechanism is:
"dir Imore".
3)

Failing the above checks, if "globbing" is enabled, local file names are expanded according to the
rules used in the csh(l); c.f. the glob command.

Note that remote file names are not processed, but are passed just as they are typed, except for the mdelete,
mdir, mget, and mls commands, where they are expanded according to the rules of the remote host's
operating system, if any.
FILE TRANSFER PARAMETERS

The FTP specification specifies many parameters which may affect a file transfer.
The "representation type" may be one of "network ASCII", "EBCDIC", "image", or "local byte size"
with a specified byte size (for PDP-lO's and PDP-20's mostly). The "network ASCII" and "EBCDIC"
types have a further subtype which specifies whether vertical format control (new lines, form feeds, etc.) are
to be passed through ("non-print"), provided in TELNET format ("TELNET format controls"), or provided in ASA (FORTRAN) ("carriage control (ASA)") format. ftp supports the "network ASCII" (subtype "non-print" only) and "image" types, plus "local byte size" with a byte size of 8 for communicating with TENEX machines.
The "file structure" may be one of "file" (no record structure), "record", or "page". ftp supports only
the default value, which is "file".
The "transfer mode" may be one of "stream", "block", or "compressed". ftp supports only the default
value, which is "stream".
SEE ALSO

rcp(IC), ftpd(8C), netrc(5)

Sun Release 3.2

Last change: 17 February 1986

177

FTP(IC)

USER COMMANDS

FTP( lC)

BUGS

Many FTP server implementations do not support experimental operations such as print working directory.
V AX sites running the BBN FTP server appear to ignore the PORT command while indicating complicity;
this locks up all file transfers.

178

Last change: 17 February 1986

Sun Release 3.2

GCORE( 1)

USER COMMANDS

GCORE( 1)

NAME

gcore - get core images of running processes
SYNOPSIS

gcore process-id ...
DESCRIPTION
gcore creates a core image of each specified process. Such an image can be used with adb or dbx.

For best results, stop the process before running gcore to avoid confusion from paging activity.
FILES

core.

core images

SEE ALSO

kill(l), csh(l), adb(l), dbx(l)

Sun Release 3.2

Last change: 3 December 1985

179

GET ( 1)

USER COMMANDS

GET ( 1)

NAl\1E

get - get a version of an SCCS file
SYNOPSIS
lusrlsccs/get [ -rSID ] [ -c cutoff] [ -i list] [ -x list] [ -a seq-no. ] [ -k ] [ -e ] [ -I [p] ]
[ -p ] [ -m ] [ -n ] [ -s ] [ -b ] [ -g ] [ -Gnewname ] [ -t ] filename ...
DESCRIPTION
get generates an ASCII text file from each named secs file according to the specified option. Arguments
may be specified in any order, options apply to all named sees files. If a directory is named, get behaves

as though each file in the directory were specified as a named file, except that non-SCeS files (last component of the path name does not begin with s.) and unreadable files are silently ignored. If a name of - is
given, the standard input is read; each line of the standard input is taken to be the name of an sees file to
be processed. Again, non-SeeS files and unreadable files are silently ignored.
The generated text is normally written into a file called the g-file whose name is derived from the sees file
name by simply removing the leading s.; (see also FILES, below).
OPTIONS

Options are explained below as though only one sees file is to be processed, but the effects of any option
argument applies independently to each named file.
-r SID The Sees IDentification string (SID) of the version (delta) of an sees file to be retrieved. Table
1 below shows, for the most useful cases, what version of an sees file is retrieved (as well as the
SID of the version to be eventually created by delta if the -e option is also used), as a function of
the SID specified.
-ccutofJ
Cutoff date-time, in the form: YY[ MM[ DD[ HH[ MM[ ss ]] ] ] ]

No changes (deltas) to the sees file which were created after the specified cutoff date-time are
included in the generated ASCII text file. Units omitted from the date-time default to their maximum possible values; that is, -c7502 is equivalent to -c750228235959. Any number of nonnumeric characters may separate the various 2 digit pieces of the cutoff date-time. This feature
allows one to specify a cutofJ date in the form: -c77/2/2 9:22:25. Note that this implies that one
may use the %E% and %U% identification keywords.
-e

This get is for editing or making a change (delta) to the sees file via a subsequent use of delta. A
lusrlsccs/get -e applied to a particular version (SID) of the sees file prevents further
lusrlsccs/get -e commands on the same SID until delta is run or the j (joint edit) flag is set in the
sees file (see admin(I)). Concurrent use of lusrlsccs/get -e for different SIDs is always
allowed.
If the g-file generated by a lusrlsccs/get -e is accidentally ruined in the process of editing it, it
may be regenerated by re-running a get with the -k option in place of the -e option.

sees file protection specified via the ceiling, floor, and authorized user list stored in the sees file
(see admin(l)) are enforced when the -e option is used.
-b

U sed with the -e option to indicate that the new delta should have an SID in a new branch as
shown in Table 1. This option is ignored if the b flag is not present in the file (see admin(I)) or if
the retrieved delta is not a leaf delta. (A leaf delta is one that has no successors on the sees file
tree.)
Note: A branch delta may always be created from a non-leaf delta.

-i list

A list of deltas to be included (forced to be applied) in the creation of the generated file. The list
has the following syntax:
 ::=  I  , 
 ::= SID I SID - SID
SID, the sees Identification of a delta, may be in any form shown in the 'SID Specified' column of

180

Last change: 8 April 1986

Sun Release 3.2

GET ( 1)

USER COMMANDS

GET ( 1)

Table 1. Partial SIDs are interpreted as shown in the 'SID Retrieved' column of Table 1.
-x list

A list of deltas to be excluded (forced not to be applied) in the creation of the generated file. See
the -i option for the list format.

-k

Suppress replacement of identification keywords (see below) in the retrieved text by their value.
The -k option is implied by the -e option.

-I [p ]

Write a delta summary into an l-file. If -Ip is used, the delta summary is written on the standard
output and the l-file is not created. See FILES for the format of the I-file.

-p

Write the text retrieved from the sees file to the standard output. Nag-file is created. All output
which normally goes to the standard output goes to the standard error file instead, unless the -s
option is used, in which case it disappears.

-s

Suppress all output normally written on the standard output. However, fatal error messages
(which always go to the standard error file) remain unaffected.

-m

Precede each text line retrieved from the sees file with the SID of the delta that inserted the text
line in the sees file. The format is: SID, followed by a horizontal tab, followed by the text line.

-n

Precede each generated text line with the %M% identification keyword value (see below). The
format is: %M% value, followed by a horizontal tab, followed by the text line. When both the -m
and -n options are used, the format is: %M% value, followed by a horizontal tab, followed by the
-m option generated format.

-g

Do not actually retrieve text from the sees file. It is primarily used to generate an I-file, or to verify the existence of a particular SID.

-t

Access the most recently created ('top') delta in a given release (for example, -rI), or release and
level (for example, -rl.2).

-Gnewname
If a get is allowed on filename (filename is not writable by anyone) place the version that get produces in a file called newname.

-a seq-no.
The delta sequence number of the sees file delta (version) to be retrieved (see sccsfile(5)). This
option is used by the comb command; it is not a generally useful option, and users should not use
it. If both the -r and -a options are specified, the -a option is used. Care should be taken when
using the -a option in conj unction with the -e option, as the SID of the delta to be created may not
be what one expects. The -r option can be used with the -a and -e options to control the naming
of the SID of the delta to be created.
For each file processed, get responds (on the standard output) with the SID being accessed and with the
number of lines retrieved from the sees file.
If the --e option is used, the SID of the delta to be made appears after the SID accessed and before the
number of lines generated. If there is more than one named file or if a directory or standard input is named,
each file name is printed (preceded by a new-line) before it is processed. If the -i option is used included
deltas are listed following the notation 'Included'; if the -x option is used, excluded deltas are listed following the notation 'Excluded'.

Sun Release 3.2

Last change: 8 April 1986

181

GET ( 1)

USER COMMANDS

GET(1 )

TABLE 1. Determination of sees Identification String
SID*
Specified
none:j:

-b Option
Usedt
no

Other
Conditions
R defaults to mR

SID
Retrieved
mR.rnL

SID of Delta
to be Created
mR.(rnL+l)

none:j:
R

yes
no

R defaults to mR
R>mR

mR.rnL
mR.rnL

mR.mL.(mB+l).1
R.l***

R

no

R=mR

mR.rnL

mR.(mL+1)

yes

R>mR

mR.rnL

mR.mL.(mB + 1).1

yes

R=mR

mR.mL

mR.mL.(mB+1).1

R

R R
andR exists
No trunk succ.

R.L

yes

No trunk succ.

R.L

R.L.(mB+l).1

R.L

R.L.(mB+l).l

R.L.B

no

Trunksucc.
in release ~ R
No branch succ.

R.L.B.mS

R.L.B.(mS+l)

R.L.B
R.L.B.S

yes
no

No branch succ.
No branch succ.

R.L.B.mS
R.L.B.S

R.L.(mB+l).1
R.L.B.(S+l)

R.L.B.S

yes

No branch succ.

R.L.B.S

R.L.(mB+l).1

Branch succ.

R.L.B.S

R.L.(mB+1).1

R.L

R.L.B.S
*

**
* **
I
t
:j:

'R', 'L', 'B', and'S' are the 'release', 'level', 'branch', and 'sequence' components of the SID,
respectively; 'm' means 'maximum'. Thus, for example, 'R.mL' means 'the maximum level
number within release R'; 'R.L.(mB+l).I' means 'the first sequence number on the new branch
(that is, maximum branch number plus one) of level L within release R'. Note that if the SID
specified is of the form 'R.L', 'R.L.B', or 'R.L.B.S', each of the specified components must exist
'hR' is the highest existing release that is lower than the specified, nonexistent, release R.
Forces creation of theflrst delta in a new release.
Successor.
The -b option is effective only if the b flag (see admin(1» is present in the file. An entry ofmeans 'irrelevant'.
This case applies if the d (default SID) flag is not present in the file. If the d flag is present in the
file, the SID obtained from the d flag is interpreted as if it had been specified on the command line.
Thus, one of the other cases in this table applies.

IDENTIFICATION KEYWORDS
Identifying information is inserted into the text retrieved from the sees file by replacing identification keywords with their value wherever they occur. The following keywords may be used in the text stored in an
sees file:

Keyword Value
%M% Module name: either the value of the m flag in the file (see admin(1», or if absent, the name of
the sees file with the leading s. removed.
%1%
sees identification (SID) (%R%.%L%.%B%.%S%) of the retrieved text
% R % Release.
%L% Level.

182

Last change: 8 Apri11986

Sun Release 3.2

GET ( 1)

USER COMMANDS

GET ( 1)

%B%
%S%
%D%
%H%
%T%
%E%
%G%
%U%
%Y%
%F%
%P%
%Q%
%C%

Branch.
Sequence.
Current date (YY/MMlDD).
Current date (MM/DD/YY).
Current time (HH:MM:SS).
Date newest applied delta was created (YY/MM/DD).
Date newest applied delta was created (MMlDD/YY).
Time newest applied delta was created (HH:MM:SS).
Module type: value of the t flag in the sees file (see admin(l».
sees file name.
Fully qualified sees file name.
The value of the q flag in the file (see admin(l».
Current line number. This keyword is intended for identifying messages output by the program
such as 'this shouldn't have happened' type errors. It is not intended to be used on every line to
provide sequence numbers.
%Z% The 4-character string @(#) recognizable by what.
%W% A shorthand notation for constructing what strings for UNIX program files. %W% =
%Z%%M%%I%
%A% Another shorthand notation for constructing what strings for non-UNIX program files. %A% =
%Z%%Y% %M% %I%%Z%

FILES

Several auxiliary files may be created by get, These files are known generically as the g-file, i-file, p-file,
and z-file. The letter before the hyphen is called the tag. An auxiliary file name is formed from the sees
file name: the last component of all sees file names must be of the form s.moduie-name, the auxiliary files
are named by replacing the leading s with the tag. The g-file is an exception to this scheme: the g-file is
named by removing the s. prefix. For example, s.xyz.c, the auxiliary file names would be xyz.c, I.xyz.c,
p.xyz.c, and z.xyz.c, respectively.
The g-file, which contains the generated text, is created in the current directory (unless the -p option is
used). A g-file is created in all cases, whether or not any lines of text were generated by the get. It is
owned by the real user. If the -k option is used or implied its mode is 644; otherwise its mode is 444.
Only the real user need have write permission in the current directory.
The i-file contains a table showing which deltas were applied in generating the retrieved text. The I-file is
created in the current directory if the -I option is used; its mode is 444 and it is owned by the real user.
Only the real user need have write permission in the current directory.
Lines in the l-file have the following format:
a.
b.
c.

d.
e.
f.
g.
h.

i.

A blank character if the delta was applied;
* otherwise.
A blank character if the delta was applied or wasn't applied and ignored;
* if the delta wasn't applied and wasn't ignored.
A code indicating a 'special' reason why the delta was or was not applied:
'I': Included.
'X': Excluded.
'C': Cut off (by a -c option).
Blank.
sees identification (SID).
Tab character.
Date and time (in the form YY/MMIDD HH:MM:SS) of creation.
Blank.
Login name of person who created delta.

The comments and MR data follow on subsequent lines, indented one horizontal tab character. A
blank line terminates each entry.

Sun Release 3.2

Last change: 8 April 1986

183

GET ( 1)

USER COMMANDS

GET(1)

The p-file passes information resulting from a lusrlsccslget -e along to delta. Its contents are also used to
prevent a subsequent execution of a lusrlsccs/get -e for the same SID until delta is executed or the joint
edit flag, j, (see admin(l» is set in the sees file. The p-file is created in the directory containing the sees
file and the effective user must have write permission in that directory. Its mode is 644 and it is owned by
the effective user. The format of the p-file is: the gotten SID, followed by a blank, followed by the SID that
the new delta will have when it is made, followed by a blank, followed by the login name of the real user,
followed by a blank, followed by the date-time the get was executed, followed by a blank and the -i option
if it was present, followed by a blank and the -x option if it was present, followed by a new-line. There
can be an arbitrary number of lines in the p-file at any time; no two lines can have the same new delta SID.
The z-file serves as a lock-out mechanism against simultaneous updates. Its contents are the binary (2
bytes) process ID of the command (that is, get) that created it The z-file is created in the directory containing the sees file for the duration of get. The same protection restrictions as those for the p-file apply for
the z-file. The z-file is created mode 444.
SEE ALSO

sccs(1), admin(l), delta(1), help(1), prs(1), what(1), sccsfile(5)
Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

Use help for explanations.
BUGS

If the effective user has write permission (either explicitly or implicitly) in the directory containing the
sees files, but the real user doesn't, only one file may be named when the -e option is used.

184

Last change: 8 April 1986

Sun Release 3.2

GET_SELECTION ( 1 )

USER COMMANDS

GET_SELECTION ( 1 )

NAME

get_selection - copy the contents of a SunView selection to the standard output
SYNOPSIS
get_selection [ rank] [t seconds] [ D ]
DESCRIPTION

get_selection prints the contents of the indicated selection on standard out. A selection is a collection of
objects (e.g. characters) picked with the mouse in the SunView window system.
OPTIONS

rank

indicates which selection is to be printed:
1: primary; 2: secondary; 3: the shelf.
The default is primary.

t seconds
indicates how many seconds to wait for the holder of a selection to respond to a request before
giving up. The default is currently 6 seconds.
D

debugging: inquire through a special debugging service for the selection, rather than accessing the
standard service. Useful only for debugging window applications which are clients of the selection library.

EXAMPLE
The following line in a SunView root menu file provides a menu command to print the primary selection
on the user's default printer:
"Print It"
csh -c "get_selection 1 Ilpr"
SEE ALSO

Editing and the Text Facility, in Windows and Window-Based Tools, Beginner's Guide

Sun Release 3.2

Last change: 29 April 1986

185

GETOPT( 1)

USER COMMANDS

GETOPT(I)

NAME

getopt - parse command options in shell scripts
SYNOPSIS

set -

'getopt optstring $*'

DESCRIPTION
getopt is used to break up options in command lines for easy parsing by shell scripts, and to check for legal
options. optstring is a string of option letters to recognize, (see getopt(3C»). If a letter is followed by a

colon, the option is expected to have an argument - which mayor may not be separated by white space.
(The - following set indicates that the Bourne shell is to pass arguments beginning with a dash as parameters to the script.)
If - appears on the command line that invokes the script, getopt uses it to delimit the end of options it is to
parse (see example below). If used explicitly, getopt will recognize it; otherwise, getopt will generate it at
the first arugment it encounters that has no -. In either case, getopt places it at the end of the options. The
positional parameters ($1 $2 optstring is broken out and preceded by a -, along with the argument (if any)
for each.
EXAMPLE

The following code fragment shows how one might process the arguments for a command that can take the
options a or b, as well as the option 0, which requires an argument:
:j#:! /bin/sh
set "get opt abo: $*'
if [ $? ! = 0 ]
then
echo $USAGE
exit 2
fi
for i in $*
do
case $i in
FLAG=$i; shift;;
-a I -b)
-0)
OARG=$2; shift 2;;
shift; break;;
-)
esac
done

This code will accept any of the following command lines as equivalent:

cmd -a -0 arg f1 f2
cmd -aoarg f1 f2
cmd -oarg -a f1 f2
cmd -a -oarg f1 f2
DIAGNOSTICS
getopt prints an error message on the standard error when it encounters an option letter not included in optstring.
SEE ALSO

sh(I), csh(I), getopt(3C)

186

Last change: 28 March 1986

Sun Release 3.2

GFXTOOL(l)

USER COMMANDS

GFXTOOL(l)

NAME

gfxtool- Run graphics programs in the SunWindows environment
SYNOPSIS

gfxtool [ -C] [program [arguments]]
OPTIONS

-C

Redirect system console output to this instance of gfxtool.

gfxtool also accepts all of the generic tool arguments; see suntools(l) for a list of these arguments.
If a pro gram argument is present, gfxtool runs it. If there are no arguments, gfxtool runs the program
corresponding to your SHELL environment variable. If this environment variable is not available, then
gfxtool runs Ibinlsh.
DESCRIPTION
gfxtool is a standard tool provided with Sun Windows. It allows you to run graphics programs that don't

overwrite the terminal emulator from which they run.
gfxtool has two subwindows: a terminal sub window and an empty subwindow. The terminal subwindow
contains a running shell,just like the shelltool (see shelltool(1». Programs invoked in the terminal subwindow can run in the empty subwindow. You can move the boundary between these two sub windows as
described in suntools(1) under The Tool Manager. If you wish, you can make gfxtool your console by
entering a first argument of -C.

Normally you can use the mouse and keyboard anywhere in the empty subwindow to access Tool Manager
functions. However, some graphics programs which run in this window may take over inputs directed to it.
For example, SunCore uses the mouse and keyboard for its own input. When you run such tools, access
the Tool Manager menu from the tool boundaries or namestripe.
SEE ALSO

suntools(l), shelltool(1), gfx_ demos (6)
FILES
-I.ttyswrc
lusr/binl gfxtool
lusr/binlsuntools
lusr/demol*
lusrlsrc/sun/suntooVgfxtool.c

BUGS

If more than 256 characters are input to a tenninal emulator subwindow without an intervening newline,
the tenninal emulator may hang. If this occurs, display the Tool Manager Menu; the "TTY Hung?" submenu there has one item, "Flush input", that you can invoke to correct the problem.

Sun Release 3.2

Last change: 29 March 1985

187

GPROF( 1)

USER COMMANDS

GPROF( 1)

NAME

gprof - display call-graph profile data
SYNOPSIS

gprof [ -a ] [ -b ] [ -c] [ -e name] [ -E name] [ -f name] [ -F name] [ -s ] [ -z ]
[ object-file [profile-file .. . ] ]
DESCRIPTION

GproJ produces an execution profile of C, Pascal, or FORTRAN 77 programs. The effect of called routines
is incorporated in the profile of each caller. The profile data is taken from the call graph profile file
(gmon.out default) which is created by programs compiled with the -pg option of cc, pc, and [17. That
option also links in versions of the library routines which are compiled for profiling. The symbol table in
the named object file (a.out by default) is read and correlated with the call graph profile file. If more than
one profile file is specified, the gprof output shows the sum of the profile information in the given profile
files.
First, execution times for each routines are propagated along the edges of the call graph. Cycles are
discovered, and calls into a cycle are made to share the time of the cycle. The first listing shows the functions sorted according to the time they represent, including the time of their call graph descendants. Below
each function entry is shown its (direct) call-graph children, and how their times are propagated to this
function. A similar display above the function shows how this function's time and the time of its descendants is propagated to its (direct) call-graph parents.
Cycles are also shown, with an entry for the cycle (!s a whole and a listing of the members of the cycle and
their contributions to the time and call counts of the cycle.
Next, a flat profile is given, similar to that provided by prof(I). This listing gives the total execution times
and call counts for each of the functions in the program, sorted by decreasing time. Finally, an index showing the correspondence between function names and call-graph profile index numbers.
Beware of quantization errors. The granularity of the sampling is shown, but remains statistical at best. It
is assumed that the time for each execution of a function can be expressed by the total time for the function
divided by the number of times the function is called. Thus the time propagated along the call-graph arcs
to parents of that function is directly proportional to the number of times that arc is traversed.
The profiled program must call exit(2) or return normally for the profiling information to be saved in the
gmon.out file.
OPTIONS

-a

suppress printing statically declared functions. If this option is given, all relevant information
about the static function (for instance, time samples, calls to other functions, calls from other functions) belongs to the function loaded just before the static function in the a .out file.

-b

Brief. Suppress descriptions of each field in the profile.

-c

the static call-graph of the program is discovered by a heuristic which examines the text space of
the object file. Static-only parents or children are indicated with call counts of O.

-ename
suppress printing the graph profile entry for routine name and all its descendants (unless they have
other ancestors that aren't suppressed). More than one -e option may be given. Only one name
may be given with each -e option.

-Ename
suppress printing the graph profile entry for routine name (and its descendants) as -e, above, and
also exclude the time spent in name (and its descendants) from the total and percentage time computations. More than one -E option may be given. For example, -E mcount -E mcleanup is the
default.
-fname
print the graph profile entry only for routine name and its descendants. More than one -f option

188

Last change: 22 April 1986

Sun Release 3.2

GPROF( 1)

USER COMMANDS

GPROF( 1)

may be given. Only one name may be given with each -f option.

Sun Release 3.2

Last change: 22 April 1986

189

GPROF( 1)

USER COMMANDS

GPROF( 1)

-F name
print the graph profile entry only for routine name and its descendants (as -f, above) and also use
only the times of the printed routines in total time and percentage computations. More than one
-F option may be given. Only one name may be given with each -F option. The -F option overrides the - E option.

-s

produce a profile file grrwn.sum which represents the sum of the profile information in all the
specified profile files. This summary profile file may be given to subsequent executions of gprof
(probably also with a -s) option to accumulate profile data across several runs of an a.out file.

-z

display routines which have zero usage (as indicated by call counts and accumulated time). This
is useful in conjunction with the -c option for discovering which routines were never called.

FILES

a.out
gmon.out
gmon.sum

the namelist and text space
dynamic call-graph and profile
summarized dynamic call-graph and profile

SEE ALSO

monitor(3), profil(2), cc(I), prof(1)
Graham, S.L., Kessler, P.B., McKusick, M.K., 'gprof: A Call Graph Execution Profiler', Proceedings of
the SIGPLAN '82 Symposium on Compiler Construction, SIGPLAN Notices, Vol. 17, No.6, pp. 120-126,
June 1982.
BUGS

Parents which are not themselves profiled will have the time of their profiled children propagated to them,
but they will appear to be spontaneously invoked in the call-graph listing, and will not have their time propagated further. Similarly, signal catchers, even though profiled, will appear to be spontaneous (although
for more obscure reasons). Any profiled children of signal catchers should have their times propagated
properly, unless the signal catcher was invoked during the execution of the profiling routine, in which case
all is lost.

190

Last change: 22 April 1986

Sun Release 3.2

GRAPH ( 1G)

USER COMMANDS

GRAPH ( IG)

NAME

graph - draw a graph
SYNOPSIS
graph [ -a spacing [start]] [-b] [-c string] [ -g gridstyle] [-I label]
[ -m connectmode ] [ -s] [-x [ 1 ] lower [ upper [ spacing] ] ]
[ -y [I] lower [upper [spacing]]] [ -hfraction] [-w fraction] [-r fraction]
[ -ufraction] [-t] ...
DESCRIPTION

Graph with no options takes pairs of numbers from the standard input as abscissas and ordinates of a
graph. Successive points are connected by straight lines. The graph is encoded on the standard output for
display by the plot(1G) filters.
If the coordinates of a point are followed by a nonnumeric string, that string is printed as a label beginning
on the point. Labels may be surrounded with quotes
in which case they may be empty or contain
blanks and numbers; labels never contain newlines.
tI • • • " ,

A legend indicating grid range is produced with a grid unless the -s option is present.
OPTIONS
Each option is recognized as a separate argument.

-a spacing [start]
Supply abscissas automatically (they are missing from the input); spacing is the spacing (default
1). start is the starting point for automatic abscissas (default 0 or lower limit given by -x).
-b

Break (disconnect) the graph after each label in the input.

-c string

String is the default label for each point
-g gridstyle

Gridstyle is the grid style: 0 no grid, 1 frame with ticks, 2 full grid (default).
-I

label is label for graph.

-m connectmode
is mode (style) of connecting lines: 0 disconnected, 1 connected (default). Some devices give distinguishable line styles for other small integers.

-s

Save screen, don't erase before plotting.

-x [ 1 ] lower [ upper [ spacing] ]

If 1 is present, x axis is logarithmic. lowerandupper are lower (and upper) x limits. spacing, if
present, is grid spacing on x axis. Normally these quantities are determined automatically.
-y [ 1 ] lower [ upper [ spacing] ]
If 1 is present, y axis is logarithmic. lowerandupper are lower (and upper) y limits. spacing, if
present, is grid spacing on y axis. Normally these quantities are determined automatically.

-hfraction
is fraction of space for height.
-wfraction
is fraction of space for width.
-r fraction
is fraction of space to move right before plotting.

-ufraction
is fraction of space to move up before plotting.
-t

Sun Release 3.2

Transpose horizontal and vertical axes. (Option -x now applies to the vertical axis.)

Last change: 1 June 1983

191

GRAPH ( 1G)

USER COMMANDS

GRAPH(1G)

If a specified lower limit exceeds the upper limit, the axis is reversed.
SEE ALSO

spline(1G), plot(1G)
BUGS

Graph stores all points internally and drops those for which there isn't room.
Segments that run out of bounds are dropped, not windowed.
Logarithmic axes may not be reversed.

192

Last change: 1 June 1983

Sun Release 3.2

GREP( IV)

USER COMMANDS

GREP( IV)

NAME

grep, egrep, fgrep - search a file for a pattern
SYNOPSIS

grep [ -v] [ -c ] [ -I] [ -n ] [ -b ] [ -i] [ -s ] [ -b] [ -w] [ -e ] expression [file . .. ]
egrep [ -v] [ -c ] [ -I] [ -n] [ -b ] [ -i ] [ -s ] [ -b] [ -e expression] [ -f file]
[ expression] [file ... ]

fgrep [ -v ] [ -x ] [ -c ] [ -I] [ -n ] [ -b ] [ -i] [ -s ] [ -b ]
[ -e string] [ -f file] [ string] [file . .. ]
SYSTEM V SYNOPSIS

grep [ -v] [ -c ] [ -I] [ -n ] [ -b ] [ -i] [ -s ] expression [file ... ]
DESCRIPTION
Commands of the grep family search the inputfiles (standard input default) for lines matching a pattern.
Normally, each line found is copied to the standard output. Grep patterns are limited regular expressions in
the style of ed(I). Egrep patterns are full regular expressions including alternation. Fgrep patterns are
fixed strings - no regular expression metacharacters are supported.

In general, egrep is the fastest of these programs.
Take care when using the characters $, *, [, ", I, (, ), and \ in the expression, as these characters are also
meaningful to the Shell. It is safest to enclose the entire expression argument in single quotes' ... '.
When any of the grep utilities is applied to more than one input file, the name of the file is displayed
preceding each line which matches the pattern. The filename is not displayed when processing a single file,
so if you actually want the filename to appear, use !dey/null as a second file in the list.
OPTIONS
-v

Invert the search to only display lines that do not match.

-x

Display only those lines which match exactly ifgrep only).

that is, only lines which match in their entirety

-c

Display a count of matching lines rather than displaying the lines which match.

-I

List only the names of files with matching lines (once) separated by newlines.

-n

Precede each line by its relative line number in the file.

-b

Precede each line by the block number on which it was found. This is sometimes useful in locating disk block numbers by context.

-i

Ignore the case of letters in making comparisons identical.

-s

Work silently, that is, display nothing except error messages. This is useful for checking the error
status.

-b

DOJ1ot display filenames.

-w

search for the expression as a word as if surrounded by \< and \>. grep only.

that is, upper and lower case are considered

-e expression
Same as a simple expression argument, but useful when the expression begins with a-.
-f file

Take the regular expression (egrep) or a list of strings separated by newlines ifgrep) from file .

SYSTEM V OPTIONS
The System V version of grep does not recognize the -b, -W, or -e options. The -s option indicates that
error messages for nonexistent or unreadable files should be suppressed, not that all messages should be
suppressed.

Sun Release 3.2

Last change: 8 July 1986

193

GREP( IV)

USER COMMANDS

GREP( IV)

REGULAR EXPRESSIONS
The following one-character regular expressions match a single character:

c

An ordinary character (not one of the special characters discussed below) is a one-character regular expression that matches that character.

\c

A backs lash (\) followed by any special character is a one-character regular expression that
matches the special character itself. The special characters are:
a.

., *, [, and \ (period, asterisk, left square bracket, and backslash, respectively), which are
always special, except when they appear within square brackets ([ ]).

b.

'" (caret or circumflex), which is special at the beginning of an entire regular expression, or
when it immediately follows the left of a pair of square brackets ([ D.

c.

$ (currency symbol), which is special at the end of an entire regular expression.

A period (.) is a one-character regular expression that matches any character except newline.

[string]
A non-empty string of characters enclosed in square brackets is a one-character regular expression
that matches anyone character in that string. If, however, the first character of the string is a
circumflex C), the one-character regular expression matches any character except newline and the
remaining characters in the string. The '" has this special meaning only if it occurs first in the
string. The minus (-) may be used to indicate a range of consecutive ASCII characters; for example, [0-9] is equivalent to [0123456789]. The - loses this special meaning if it occurs first (after
an initial A, if any) or last in the string. The right square bracket (D does not terminate such a
string when it is the first character within it (after an initial A, if any); e.g., []a-f] matches either a
right square bracket (]) or one of the letters a through f inclusive. The four characters ., *, [, and \
stand for themselves within such a string of characters.
The following rules may be used to construct regular expressions:
*

A one-character regular expression followed by an asterisk (*) is a regular expression that
matches zero or more occurrences of the one-character regular expression. If there is any choice,
the longest leftmost string that permits a match is chosen.

\(

A regular expression enclosed between the character sequences \( and \) matches whatever the
unadorned regular expression matches. (grep only).

\n

The expression \n matches the same string of characters as was matched by an expression
enclosed between \( and \) earlier in the same regular expression. Here n is a digit; the subexpression specified is that beginning with the n-th occurrence of \( counting from the left. For
example, the expression "'\(.*\)\1$ matches a line consisting of two repeated appearances of the
same string.

concatenation
The concatenation of regular expressions is a regular expression that matches the concatenation of
the strings matched by each component of the regular expression.

\<

The sequence \< in a regular expression constrains the one-character regular expression immediately following it only to match something at the beginning of a "word"; that is, either at the
beginning of a line, or just before a letter, digit, or underline and after a character not one of these.

\>

The sequence \> in a regular expression constrains the one-character regular expression immediately following it only to match something at the end of a "word"; that is, either at the end of a
line, or just before a character which is neither a letter, digit, nor underline.
A circumflex C) at the beginning of an entire regular expression constrains that regular expression
to match an initial segment of a line.

$

194

A currency symbol ($) at the end of an entire regular expression constrains that regular expression
to match afinal segment of a line.

Last change: 8 July 1986

Sun Release 3.2

GREP( IV)

USER COMMANDS

GREP( IV)

The construction "entire regular expression$ constrains the entire regular expression to match the entire
line.

egrep accepts regular expressions of the same sort grep does, except for \(, \), \n, \<, and \>, with the addition of:
*

A regular expression (not just a one-character regular expression) followed by an asterisk (*) is a
regular expression that matches zero or more occurrences of the one-character regular expression.
If there is any choice, the longest leftmost string that permits a match is chosen.

+

A regular expression followed by a plus sign (+) is a regular expression that matches one or more
occurrences of the one-character regular expression. If there is any choice, the longest leftmost
string that permits a match is chosen.

?

A regular expression followed by a question mark (?) is a regular expression that matches zero or
one occurrences of the one-character regular expression. If there is any choice, the longest left-

most string that permits a match is chosen.
Alternation: two regular expressions separated by I or newline match either a match for the first or
a match for the second.

o

A regular expression enclosed in parentheses matches a match for the regular expression.

The order of precedence of operators at the same parenthesis level is [ ] (character classes), then * + ? (closures), then concatenation, then I (alternation) and newline.
SYSTEM V REGULAR EXPRESSIONS
The System V version of grep does not accept \< or \> in a regular expression, and accepts the following
additional item in a regular expression:
\{m\}
\{m,\}

\{m,n\} A regular expression followed by \{m\}, \{m,\}, or \{m,n\} matches a range of occurrences of the
regular expression. The values of m and n must be non-negative integers less than 256; \{m\}
matches exactly m occurrences; \{m,\} matches at least m occurrences; \{m,n\} matches any
number of occurrences between m and n inclusive. Whenever a choice exists, the regular expression matches as many occurrences as possible.
EXAMPLES
Search a file for a fixed string usingfgrep:
tutorial% fgrep intro lusr/manlman3/*.3*
Look for character classes using grep:
tutorial% grep '[1-8]([CJMSNX])' lusr/man/manl/*.l
Look for alternative patterns using egrep:
tutorial% egrep '(SallyIFred) (SmithIJonesIParker)' telephone.Iist
To get the filename displayed when only processing a single file, use Idev/null as the second file in the list:
tutorial% grep 'Sally Parker' telephone.Iist Idev/null
SEE ALSO
visual display-oriented editor based on ex(l)
vi(l)
line-oriented text editor based on ed( 1)
ex(l)
primitive line-oriented text editor
ed(l)
stream editor
sed(1 V)
pattern scanning and text processing language
awk(l)
Bourne Shell
sh(l)
DIAGNOSTICS
Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors or inaccessible files.
BUGS
Lines are limited to 1024 characters by·grep; longer lines are truncated.

Sun Release 3.2

Last change: 8 July 1986

195

GREP( 1V)

USER COMMANDS

GREP( 1V)

If there is a line with embedded nulls, grep will only match up to the first null; if it matches, it will print the
entire line.
The combination of -I and -v options does not produce a list of files in which a regular expression is not
found. To get such a list, use the C-Shell construct:
foreach file (*)
if ('grep "re" $file I wc -1' == 0) echo $file
end
Ideally there should be only one grep.

196

Last change: 8 July 1986

Sun Release 3.2

GROUPS(l)

USER COMMANDS

GROUPS(l)

NAME

groups - show group memberships
SYNOPSIS

groups
DESCRIPTION
Groups displays the groups to which you belong. Each user belongs to a group specified in the password
file fetclpasswd and possibly to other groups as specified in the file fetc/group. If you do not own a file but
belong to the group which it is owned by then you are granted group access to the file.

When a new file is created it is given the group of the containing directory.
SEE ALSO
setgroups(2)
FILES

letclpasswd, fetcfgroup

Sun Release 3.2

Last change: 20 June 1983

197

HEAD ( 1)

USER COMMANDS

. HEAD(I)

NAME

head - display first few lines of specified files
SYNOPSIS

head [ -n ] [filename . . .J
DESCRIPTION
head copies the first n lines of each filename to the standard output. If no filename is given, head copies
lines from the standard input. The default value of n is 10 lines.

When more than one file is specified, head places a marker at the start of each file which looks like:
==> filename <==

Thus, a common way to display a set of short files, identifying each one, is:
gaia% head -9999 filet file2 ••.
EXAMPLE

gaia% head -4 /usr/manlman1l{cat,head,tail}.1 *
==> lusr/manlmanllcat.lv <==
.TIl CAT IV "2 June 1983"
.SHNAME
cat - concatenate and display
.SH SYNOPSIS
==> lusr/man/man lIhead.l <==
.TH HEAD 1 "24 August 1983"
.SHNAME
head - display first few lines of specified files
.SH SYNOPSIS
==> lusr/man/manlltail.l <==
.TIl TAIL 1 "27 April 1983"
.SHNAME
tail- display the last part of a file
.SH SYNOPSIS
SEE ALSO

more(I), tail(l), cat(l V)

198

Last change: 5 May 1986

Sun Release 3.2

HELP ( 1)

USER COMMANDS

HELP(1)

NAME

help - ask for help regarding

sees

SYNOPSIS

lusrIsccslhelp [args]
DESCRIPTION
Help finds information to explain a message from a command or explain the use of a command. Zero or
more arguments may be supplied. If no arguments are given, help will prompt for one.

The arguments may be either message numbers (which normally appear in parentheses following messages) or command names, of one of the following types:
type 1

Begins with non-numerics, ends in numerics. The non-numeric prefix is usually
an abbreviation for the program or set of routines which produced the message
(for example, ge6, for message 6 from the get command).

type 2

Does not contain numerics (as a command, such as get)

type 3

Is all numeric (for example, 212)

The response of the program will be the explanatory information related to the argument, if there is any.
When all else fails, try lusrlsccs/help stuck.
FILES

/usr/lib/help

directory containing files of message text.

DIAGNOSTICS
Use help(1) for explanations.

Sun Release 3.2

Last change: 27 October 1983

199

HOSTID( 1)

USER COMMANDS

HOSTID( 1)

NAME

hostid - print identifier of current host system
SYNOPSIS

hostid
DESCRIPTION

The hostid command prints the identifier of the current host in hexadecimal. This numeric value is unique
across all Sun hosts.
SEE ALSO

gethostid(2)

200

Last change: 1 February 1985

Sun Release 3.2

HOSTNAME ( 1 )

USER COMMANDS

HOSTNAME(l)

NAME

hostname - set or print name of current host system
SYNOPSIS

hostname [ nameotbost ]
DESCRIPTION

The hostname command prints the name of the current host, as given before the "login" prompt. The
super-user can set the hostname by giving an argument; this is usually done in the startup script
I etc/rc.1ocal.
SEE ALSO

gethostname(2), sethostname(2)

Sun Release 3.2

Last change: 22 March 1983

201

ICONEDIT ( 1 )

USER COMMANDS

ICONEDIT ( 1 )

NAME

iconedit - create and edit small images for icons, cursors, panel items, etc.
SYNOPSIS

iconedit [filename ]
OPTIONS

iconedit accepts the standard SunView command-line arguments; see suntools(l) for a list
DESCRIPTION

iconedit is a standard tool provided with the SunView environment. With it you can create and edit small
images for use in icons, cursors, panel items, etc. iconedit has several subwindows:
A large drawing area or canvas (on the left).
A small proof area for previewing a life-size version of the image being edited (at the lower right).
A control panel showing the options available and their current state (at the center right).
An area for status messages (at the upper right).

An area containing instructions for the use of the mouse (above the drawing canvas).
Inside the canvas, use the left button to draw and the middle button to erase. As you draw, an enlarged version of the image appears in the canvas, while a life-sized version of the image appears in the proof area.
Use the right button to undo the previous operation.
While editing a cursor image, you can try the cursor out against different backgrounds and with different
raster operations by moving the cursor into the proof area.
CONTROL PANEL

The large control panel to the right of the canvas contains many items through which you can control
iconedit. Some items are buttons which allow you to initiate commands, some are text fields which you
type into, and some are choice items allowing you select from a range of options. Use the left button to
select items. Most items also have a menu which you can invoke with the right button.
There are three text fields: the two at the top labelled "Dir:" and "File:", and one to the right of the
"abc" labelled "Fill:". A triangular caret points to the current type-in position. Typing 
advances the caret to the next text field; you can also move the caret to a text field by selecting the field
with the left button.
Each item in the control panel is described below:
Dir

The current directory.

File

The current filename. The default is the filename given on the command line. You can request
filename completion by pressing . iconedit searches the current directory for files whose
names begin with the string you entered. If the filename search locates only one file, that file will
be loaded in. In addition, typing CTRL-L, CTRL-S, CTRL-B or CTRL-Q are equivalent to pressing the Load, Store, Browse, or Quit buttons, respectively.

Load

(Button) Load the canvas from the file named in the File field.

Store

(Button) Store the current image in the file named in the File field.

Browse (Button) Display all the images in the current directory in a popup panel. When you select an
image with the left button, it will be loaded into the canvas for editing and the browsing panel will
be hidden. Pressing browse again will cause the panel to popup again (it will come up immediately if the directory and file fields have not been modified).

202

Quit

(Button) Terminate processing. Quitting requires a confirming click of the left mouse button.

Size

Alter the canvas size. Choices are icon size (64 x 64 pixels) or cursor size (16 x 16 pixels).

Grid

Display a grid over the drawing canvas, or turn the grid off.

Clear

(Button) Clear the canvas.

Last change: 17 September 1985

Sun Release 3.2

ICONEDIT ( 1 )

USER COMMANDS

Fill

(Button) Fill canvas with current rectangular fill pattern.

Invert

(Button) Invert each pixel represented on the canvas.

ICONEDIT ( 1 )

Paintbrush
Select from among five painting modes. Instructions for each painting mode appear above the
canvas. The painting modes are:
dot

Paint a single dot at a time.

line

Draw a line. To draw a line on the canvas, point to the first endpoint of the line, and
press and hold the left mouse button. While holding the button down, drag the cursor to
the second endpoint of the line. Release the mouse button.

rectangle
Draw a rectangle. To draw a rectangle on the canvas, point to the first corner of the rectangle and press and hold the left mouse button. While holding the button down, drag the
cursor to the diagonally opposite comer of the rectangle. Release the mouse button.
In the control panel, the Fill field to the right of the rectangle indicates the current rectangle fill pattern. Any rectangles you paint on the canvas will be filled with this pattern.
circle

Draw a circle. To draw a circle on the canvas, point to the center of the circle, and press
and hold the left mouse button. While holding the button down, drag the cursor to the
desired edge of the circle. Release the mouse button.
In the control panel, the Fill field to the right of the circle indicates the current circle fill
pattern. Any circles you paint on the canvas will be filled with this pattern.

abc

Insert text. To insert text, move the painting hand to "abc" and type the desired text.
Then move the cursor to the canvas and press and hold the left mouse button. A box will
appear where the text is to go. Position the box as desired and release the mouse button.
In addition, you can choose the font in which to draw the text. Point at the Fill field to
the right of the "abc" and either click the left mouse button to cycle through the available fonts or press and hold the right mouse button to bring up a menu of fonts.

Load

This is the rasterop to be used when loading a file in from disk. (See the Pixrect Reference
Manual for details on rasterops).

Fill

This is the rasterop to be used when filling the canvas. The source for this operation is the rectangle fill pattern, and the destination is the canvas.

Proof

This is the rasterop to be used when rendering the proof image. The source for this operation is
the proof image, and the destination is the proof background.

Proof background
The proof background can be changed to allow you to preview how the image will appear against
a variety of patterns. The squares just above the proof area show the patterns available for use as
the proof background pattern. To change the proof background, point at the desired pattern and
click the left mouse button.
SEE ALSO

suntools( 1)
FILES

lusr/binliconedit

Sun Release 3.2

Last change: 17 September 1985

203

USER COMMANDS

ID( 1)

ID( 1)

NAME

id - print user and group IDs and names
SYNOPSIS

id
DESCRIPTION
id writes a message on the standard output giving the user and group IDs, and the corresponding names of
the invoking process. If the effective and real IDs do not match, both are printed.
SEE ALSO
getuid(2)

204

Last change:

Sun Release 3.2

INDENT ( 1)

USER COMMANDS

INDENT(I)

NAME

indent - indent and format C program source
SYNOPSIS

indent [ input-file [ output-file ] ] [-bad I-nbad] [-bap I-nbap] [-bbb I-nbbb] [-bc I-nbc]
[ -bl ] [ -br ] [ -bs I -nbs] [ -cn] [ -cdn] [ -cdb I -nedb ] [ -ee I -nee] [ -cin ] [ -e1in] [ -dn ]
[ -din] [ -fel I-nfel] [-in] [-ip I -nip] [ -In] [ -len] [ -Ip I -nip] [ -pes I -npes] [ -npro ]
[ -psi I -npsl] [ -se I -nse ] [ -sob I -nsob ] [ -st] [ -troff] [ -v I-nv ]
DESCRIPTION

Indent is a C program formatter. It reformats the C program in the input-file according to the switches.
The switches which can be specified are described below. They may appear before or after the file names.

NOTE: If you only specify an input-file, the formatting is done 'in-place', that is, the formatted file is written back into input-file and a backup copy of input-file is written in the current directory. If input-file is
named '/blah/blah/file', the backup file is named file.BAK.
If output-file is specified, indent checks to make sure it is different from input-file.
OPTIONS

The options listed below control the formatting style imposed by indent.
-bap,-nbap

If -bap is specified, a blank line is forced after every procedure body. Default -nbap.

-bad,-nbad

If -bad is specified, a blank line is forced after every block of declarations. Default
-nbad.

-bbb,-nbbb

If -bbb is specified, a blank line is forced before every block comment. Default
-nbbb.

-be,-nbc

If -be is specified, then a newline is forced after each comma in a declaration. -nbc
turns off this option. The default is -be.

-br,-bl

Specifying -bllines up compound statements like this:
if

( ... )

code
}

Specifying -br (the default) makes them look like this:
if

( ... )

{

code

-bs,-nbs

Enables (disables) the forcing of a blank after sizeof. Some people believe that size of
should appear as though it were a procedure call (-nbs, the default) and some people
believe that since sizeof is an operator, it should always be treated that way and should
always have a blank after it.

-en

The column in which comments on code start. The default is 33.

-edn

The column in which comments on declarations start. The default is for these comments
to start in the same column as those on code.

-cdb,-nedb

Enables (disables) the placement of comment delimiters on blank lines. With this option
enabled, comments look like this:
/*
* this is a comment
*/
Rather than like this:
/* this is a comment */
This only affects block comments, not comments to the right of code. The default is
-edb.

Sun Release 3.2

Last change: 14 June 1985

205

INDENT ( 1)

206

USER COMMANDS

INDENT ( 1)

-ee,-nee

Enables (disables) forcing 'else's to cuddle up to the immediatly preceeding '}'. The
default is -ee •

-ein

Sets the continuation indent to be n. Continuation lines will be indented that far from
the beginning of the first line of the statement Parenthesized expressions have extra
indentation added to indicate the nesting, unless -Ip is in effect -ci defaults to the same
value as -i.

-c1in

Causes case labels to be indented n tab stops to the right of the containing switch statement. -eliO.5 causes case labels to be indented half a tab stop. The default is -cliO.

-dn

Controls the placement of comments which are not to the right of code. The default -di
means that such comments are placed one indentation level to the left of code. Specifying -dO lines up these comments with the code. See the section on comment indentation
below.

-din

Specifies the indentation, in character positions, from a declaration keyword to the following identifier. The default is -di16.

-fel,-nfel

Enables (disables) the formatting of comments that start in column 1. Often, comments
whose leading 'I' is in column 1 have been carefully hand formatted by the programmer.
In such cases, -nfel should be used. The default is -fel.

-in

The number of spaces for one indentation level. The default is 4.

-ip,-nip

Enables (disables) the indentation of parameter declarations from the left margin. The
default is -ip •

-In

Maximum length of an output line. The default is 75.

-len

Sets the line length for block comments to n. It defaults to being the same as the usual
line length as specified with -I.

-Ip,-nlp

Lines up code surrounded by parenthesis in continuation lines. If a line has a left paren
which is not closed on that line, then continuation lines will be lined up to start at the
character position just after the left paren. For example, here is how a piece of continued code looks with -nIp in effect:
pI = first-procedure(second-procedure(p2, p3),
third-procedure(p4, p5»;
With -Ip in effect (the default) the code looks somewhat clearer:
pI = first-procedure(second-procedure(p2, p3),
third-procedure(p4, p5»;
Inserting a couple more newlines we get:
pI = first_procedure(second-procedure(p2,
p3) ,
third-procedure(p4,
p5) ) ;

-npro

Causes the profile files, 'J .indentpro' and '-/.indent.pro', to be ignored.

-pes ,-npes

If true (-pes) all procedure calls will have a space inserted between the name and the '(' .
The default is -npes

-psI, -npsl

If true (-psI) the names of procedures being defined are placed in column 1 - their types,
if any, will be left on the previous lines. The default is -psI

-se,-nse

Enables (disables) the placement of asterisks ('*'s) at the left edge of all comments.

-sob,-nsob

If -sob is specified, indent will swallow optional blank lines. You can use this to get rid
of blank lines after declarations. Default: -nsob

-st

Causes indent to take its input from stdin, and put its output to stdout

-Ttypename

Adds typename to the list of type keywords. Names accumulate: -T can be specified

Last change: 14 June 1985

Sun Release 3.2

INDENT ( 1)

USER COMMANDS

INDENT(1)

more than once. You need to specify all the typenames that appear in your program that
are defined by typedefs - nothing will be harmed if you miss a few, but the program
won't be formatted as nicely as it should. This sounds like a painful thing to have to do,
but it's really a symptom of a problem in C: typedef causes a syntactic change in the
laguage and indent can't find all typedefs.
-troff

Causes indent to format the program for processing by troff. It will produce a fancy
listing in much the same spirit as vgrind. If the output file is not specified, the default is
standard output, rather than formatting in place.
The usual way to get a troff'd listing is with the command
indent -troff program.c I troff -mindent

-v,-nv

-v turns on 'verbose' mode, -nv turns it off. When in verbose mode, indent reports
when it splits one line of input into two or more lines of output, and gives some size
statistics at completion. The default is -nv.

FURTHER DESCRIPTION
You may set up your own 'profile' of defaults to indent by creating a file called .indent.pro in either your
login directory or the current directory and including whatever switches you like. A '.indent.pro' in the
current directory takes precedence over the one in your login directory. If indent is run and a profile file
exists, then it is read to set up the program's defaults. Switches on the command line, though, always override profile switches. The switches should be separated by spaces, tabs or newlines.

Comments

'Box' comments. Indent assumes that any comment with a dash or star immediately after the start of comment (that is, '/*-' or '/**') is a comment surrounded by a box of stars. Each line of such a comment is
left unchanged, except that its indentation may be adjusted to account for the change in indentation of the
first line of the comment.
Straight text. All other comments are treated as straight text. Indent fits as many words (separated by
blanks, tabs, or newlines) on a line as possible. Blank lines break paragraphs.
Comment indentation
If a comment is on a line with code it is started in the 'comment column', which is set by the ---en command
line parameter. Otherwise, the comment is started at n indentation levels less than where code is currently
being placed, where n is specified by the -dn command line parameter. If the code on a line extends past
the comment column, the comment starts further to the right, and the right margin may be automatically
extended in extreme cases.

Preprocessor lines
In general, indent leaves preprocessor lines alone. The only reformmatting that it will do is to straighten up
trailing comments. It leaves imbedded comments alone. Conditional compilation (#ifdef••.#endif) is
recognized and indent attempts to correctly compensate for the syntactic peculiarites introduced.
C syntax

Indent understands a substantial amount about the syntax of C, but it has a 'forgiving' parser. It attempts to
cope with the usual sorts of incomplete and misformed syntax. In particular, the use of macros like:
*define forever for(;i)
is handled properly.
FILES
J .indent.pro
profile file
-/ .indent.pro
profile file
lusr/lib/tmac/tmac.indent Troff macro package for' 'indent -troff" output.

Sun Release 3.2

Last change: 14 June 1985

207

INDENT(l)

USER COMMANDS

INDENT(l)

BUGS
Indent has even more switches than Is.
A common mistake that often causes grief is typing:
indent *.c
to the shell in an attempt to indent all the C programs in a directory. This is probably a bug, not a feature.
The -bs option splits an excessivly fine hair.

208

Last change: 14 June 1985

Sun Release 3.2

INDXBIB (1)

USER COMMANDS

INDXBIB (1)

NAME

indxbib - make inverted index to a bibliography
SYNOPSIS
indxbib database . ..
DESCRIPTION

Indxbib makes an inverted index to the named databases (or files) for use by lookbib(l) and refer(l).
These files contain bibliographic references (or other kinds of information) separated by blank lines.
A bibliographic reference is a set of lines, constituting fields of bibliographic information. Each field starts
on a line beginning with a "%", followed by a key-letter, then a blank, and finally the contents of the field,
which may continue until the next line starting with "%".

Indxbib is a shell script that calls two programs: lusrl/iblrefer/mkey and /usrlliblreJerlinv. mkey truncates
words to 6 characters, and maps upper case to lower case. It also discards words shorter than 3 characters,
words among the 100 most common English words, and numbers (dates) < 1900 or> 2000. These parameters can be changed - see ReJer- a Bibliography System in Formatting Documents on the Sun Workstation. inv creates an entry file (.ia), a posting file (.ib), and a tag file (.ic), all in the working directory.
FILES

x .ia, x .ib, x .ic, where x is the first argument, or if these are not present, then x .ig, x
SEE ALSO
refer(l), addbib(l), sortbib(l), roftbib(l), lookbib(l)

Refer in Formatting Documents on the Sun Workstation
BUGS

Probably all dates should be indexed, since many disciplines refer to literature written in the 1800s or earlier.

S un Release 3.2

Last change: 6 April 1985

209

USER COMMANDS

NAME

input_from_defaults, defaults_from_input - update kernel state from defaults database, and vice versa
SYNOPSIS

input_from_defaults
defaults_from_ in put
DESCRIPTION

Input_from_defaults updates various parameters controlling mouse- and keyboard-processing on the
machine on which it is run. It should be used on systems which are running the SunView window system.
The parameters control the distribution of function keys on the keyboard, the assignment of buttons on the
mouse, the scaling of mouse-to-cursor motion, and the effect of two filters on mouse-motion originally provided to compensate for defective mice. The new values are taken from the defaults datbase, starting with
the file .defaults in the user's home directory.
Defaults_ from_input is the inverse operation to input_from_defaults - it updates a the user's private
defaults database (used by defaultsedit(l» to reflect the current state of kernel input parameters listed
above.
FILES

$HOME/.defaults
lusr/lib/defaults/* .d
SEE ALSO

defaultsedit( 1)
Editing and the Text Facility, in Windows and Window-Based Tools, Beginner's Guide
BUGS

Input_from_defaults should be targetable to any user's .defaults file.

210

Last change: 29 April 1986

Sun Release 3.2

INSTALL ( 1)

USER COMMANDS

INSTALL(l)

NAME

install- install files
SYNOPSIS

install [ -c] [ -m mode ] [ -0 owner] [ -g group] [ -s ] binary destination
DESCRIPTION

binary is copied to destination. If destination already exists, it is removed before binary is copied. If the
destination is a directory then binary is copied into file destination/binary.
install refuses to move a file onto itself.

Note: install has no special privileges since it simply uses cp to copy files from one place to another. The
implications of this are:
• You must have permission to read binary .
• You must have permission to copy into destination.
• You must have permission to change the modes on the final copy of the file if you want to use the -m
option to change modes.
• You must be super-user if you want to use the -0 option to change ownership.
OPTIONS

-c

Copy binary instead of moving it. In fact, install always copies the file, but the -c option is
retained for backwards compatibility with old system shell scripts which might otherwise break.

-mmode
Specifies a different mode for binary: the mode for destination is set to 755 by default.
-0

owner
Set the owner of the destination file to owner. destination is changed to owner root by default.

-g group
Set the group ownership of the destination file to group. destination is changed to group staffby
default.

-s

Strip binary files after it is installed -

only applicable to binary files in a.out(5) format.

SEE ALSO

chmod(l V), cp(l), mv(l), strip(l), chown(8)
BUGS

Should be possible to move multiple files at a time, like mv or cp.
When the destination is a directory, install simply appends the entire source file name to the directory
name, instead of using the source file name's last component like mv or cp.

Sun Release 3.2

Last change: 23 September 1985

211

IPCRM( 1)

USER COMMANDS

IPCRM(l )

NAME

ipcrm - remove a message queue, semaphore set, or shared memory id
SYNOPSIS

ipcrm [primitives]
DESCRIPTION
ipcrm removes one or several messages, semaphores, or shared memory identifiers, as specified by the following primitives:

-q msqid

removes the message queue identifier msqid from the system and destroys the message
queue and data structures associated with it

-m shmid

removes the shared memory identifier shmid from the system. The shared memory segment
and data structures associated with it are destroyed after the last detach.

-s semid

removes the semaphore identifier semid from the system and destroys the set of semaphores
and data structures associated with it.

-Q msgkey

removes the message queue identifier, created with key msgkey, from the system and destroys the message queue and data structures associated with it

-M shmkey

removes the shared memory identifier, created with key shmkey, from the system. The
shared memory segment and data structures associated with it are destroyed after the last
detach.

-8 semkey

removes the semaphore identifier, created with key semkey, from the system and destroys
the set of semaphores and data structures associated with it.

The identifiers and keys may be found by using ipcs(l).
The details of removing identifiers are described in msgctl(2), shmctl(2), and semctl(2) in the sections
detailing the IPC_RMID command.
SEE ALSO
ipcs(I), msgct1(2), msgget(2), semctl(2), semget(2), shmct1(2), shmget(2)

212

Last change: 30 April 1986

Sun Release 3.2

IPCS( 1)

USER COMMANDS

IPCS(1 }

NAME

ipcs - report interprocess communication facilities status
SYNOPSIS

ipcs [primitives]
DESCRIPTION
ipcs prints information about active interprocess communication facilities as specified by the primitives
shown below. If no primitives are given, information is printed in short format for message queues, shared

memory, and semaphores that are currently active in the system.

-q

Print information about active message queues.

-ID

Print information about active shared memory segments.

-s

Print information about active semaphores.

If any of the primitives -q, -ID, or -s are specified, information about only indicated facilities is printed. If
none of these are specified, information about all three is printed.
-b

Print the biggest allowable size information. (Maximum number of bytes in messages on queue
for message queues, size of segments for shared memory, and number of semaphores in each set
for semaphores.) See below for the meaning of columns in a listing.

-c

Print creator's login name and group name. See below.

-0

Print information on outstanding usage. (Number of messages on queue and total number of bytes
in messages on queue for message queues and number of processes attached to shared memory
segments.)

-p

Print process number information. (Process ID of last process to send a message and process ID of
last process to receive a message on message queues and process ID of creating process and process ID of last process to attach or detach on shared memory segments) See below.

-t

Print time information. (Time of the last control operation that changed the access permissions for
all facilities. Time of last msgsnd(2) and last msgrcv(2} on message queues, last shmat(2) and
last shmdt(2} on shared memory, last semop(2} on semaphores.} See below.

-3

Use all display primitive s. (This is a shorthand notation for -b, -c, -0, -p, and -t.)

-C corefile
Use the file corefile in place of Idevlkmem.

-N name list
The argument will be taken as the name of an alternate namelist (/vmunix is the default).
The column headings and the meaning of the columns in an ipcs listing are given below; the letters in
parentheses indicate the primitives that cause the corresponding heading to appear; all means that the heading always appears. Note that these primitives only determine what information is provided for each facility; they do not determine which facilities will be listed.
T

ID

KEY

MODE

Sun Release 3.2

(all) Type of the facility:
q
message queue;
m
shared memory segment;
s
semaphore.
(all) The identifier for the facility entry.
(all) The key used as an argument to msgget(2}, semget(2), or shmget(2) to create the facility entry. (Note: The key of a shared memory segment is changed to IPC _PRIVATE
when the segment has been removed until all processes attached to the segment detach
it.)
(all) The facility access modes and flags: The mode consists of 11 characters that are interpreted as follows:
The first two characters are:

Last change: 30 April 1986

213

IPCS( 1)

USER COMMANDS

R
S
D
C

IPCS (1)

if a process is waiting on a msgrcv(2);
if a process is waiting on a msgsnd(2);
if the associated shared memory segment has been removed. It will
disappear when the last process attached to the segment detaches it;
if the associated shared memory segment is to be cleared when the first
attach is executed;
if the corresponding special flag is not set.

The next 9 characters are interpreted as three sets of three bits each. The first
set refers to the owner's permissions; the next to permissions of others in the
user-group of the facility entry; and the last to all others. Within each set, the
first character indicates permission to read, the second character indicates permission to write or alter the facility entry, and the last character is currently
unused

OWNER
GROUP
CREATOR
CGROUP
CBYTES

(all)
(all)
(a,c)
(a,c)
(a,o)

QNUM
QBYTES

(a,o)
(a,b)

LSPID
LRPID
STIME
RTIME
CTIME
NATTCH
SEGSZ
CPID
LPID
ATIME
DTIME
NSEMS
OTIME

(a,p)
(a,p)
(a,t)
(a,t)
(a,t)
(a,o)
(a,b)
(a,p)
(a,p)
(a,t)
(a,t)
(a,b)
(a,t)

The permissions are indicated as follows:
r
if read permission is granted;
w
if write permission is granted;
if alter permission is granted;
a
if the indicated permission is not granted
The login name of the owner of the facility entry.
The group name of the group of the owner of the facility entry.
The login name of the creator of the facility entry.
The group name of the group of the creator of the facility entry.
The number of bytes in messages currently outstanding on the associated message
queue.
The number of messages currently outstanding on the associated message queue.
The maximum number of bytes allowed in messages outstanding on the associated
message queue.
The process ID of the last process to send a message to the associated queue.
The process ID of the last process to receive a message from the associated queue.
The time the last message was sent to the associated queue.
The time the last message was received from the associated queue.
The time when the associated entry was created or changed.
The number of processes attached to the associated shared memory segment.
The size of the associated shared memory segment.
The process ID of the creator of the shared memory entry.
The process ID of the last process to attach or detach the shared memory segment.
The time the last attach was completed to the associated shared memory segment.
The time the last detach was completed on the associated shared memory segment.
The number of semaphores in the set associated with the semaphore entry.
The time the last semaphore operation was completed on the set associated with the
semaphore entry.

FILES
Ivrnunix

system namelist
memory
letc/passwd user names
letc/group group names

Idev~mem

SEE ALSO

msgop(2), semop(2), shmop(2)

BUGS
Things can change while ipcs is running; the picture it gives is only a close approximation to reality.

214

Last change: 30 April 1986

Sun Release 3.2

JOIN (1)

USER COMMANDS

JOIN (1)

NAME

join - relational database operator
SYNOPSIS

join [ -an] [ -e string] [ -j [112] m ] [ -0 list] [ -tc ] filename 1 filename2
DESCRIPTION
join fonns, on the standard output, a join of the two relations specified by the lines of filenamel and
filename2. Iffilenamel is -t the standard input is used.

filenamel andfilename2 must be sorted in increasing ASCII collating sequence on the fields on which they
are to be joined - normally the first in each line.
There is one line in the output for each pair of lines in filenamel and filename2 that have identical join
fields. The output line normally consists of the common field, then the rest of the line fromfilenamel , then
the rest of the line fromfilename2.
The default input field separators are blank, tab t and newline. If the default input field separators are used,
multiple separators count as one field separatort and leading separators are ignored. The default output
field separator is a blank.
OPTIONS

-an

The parameter n can be one of the values:
1
produce a line for each unpairable line infilenamel .
2
produce a line for each unpairable line infilename2.
3
produce a line for each unpairable line in bothfilenamel andfilename2.
The normal output is also produced.
-e string
Replace empty output fields by string.
-j[lI2] m
The j may be immediately followed by n, which is either a '1' or a '2'. If n is missing, the join is
on the m'th field of both files. If n is present, the join is on the m'th field of file n, and the first
field of the other. Note that join counts fields from 1 instead of 0 like sort does.
-0 list Each output line comprises the fields specified in list, each element of which has the form n.m,
where n is a file number and m is a field number. The cornmon field is not printed unless
specifically requested. Note that join counts fields from 1 instead of 0 like sort does.
-tc
Use character c as a separator (tab character). Every appearance of c in a line is significant The
character c is used as the field separator for both input and output.
EXAMPLE
The following command line will join the password file and the group file, matching on the numeric group
ill, and outputting the login name, the group name and the login directory. It is assumed that the files have
been sorted in ASCII collating sequence on the group ID fields.
join -j 14 -j2 3 -0 1.1 2.1 1.6 -t: /etc/passwd /etc/group
SEE ALSO
sort(IV), comm(1), awk(I), uniq(I), look(1)
BUGS

With default field separationt the collating sequence is that of sort -b; with -t, the sequence is that of a
plain sort.
The conventions of join , sort, comm, uniq, look, and awk are wildly incongruous.
Filenames that are numeric may cause conflict when the -0 option is used right before listing filenames.

Sun Release 3.2

Last change: 17 February 1986

215

KILL(I)

USER COMMANDS

KILL ( 1)

NAME

kill- send a signal to a process, or terminate a process
SYNOPSIS
kill [ -sig ] processid
kill-I

0

0

0

DESCRIPTION
kill sends the TERM (terminate, 15) signal to the specified processes. If a signal name or number preceded
by '-' is given as first argument, that signal is sent instead of terminate. The signal names are listed by
using the -I option, and are as given in lusr/include/signal.h, stripped of the common SIG prefix.

The terminate signal will kill processes that do not catch the signal, so kill -9
is a sure kill, as the
KILL (9) signal cannot be caught. By convention, if process number 0 is specified, all members in the process group (that is, processes resulting from the current login) are signaled (but beware: this works only if
you use sh(I); not if you use csh(I).) Negative process numbers also have special meanings; see kill(2) for
details. The killed processes must belong to the current user unless he is the super-user.
0

••

To shut the system down and bring it up single user the super-user may send the initialization process a
TERM (terminate) signal by 'kill 1'; see init(8). To force init to close and open terminals according to
what is currently in letclttys use 'kill-HUP l' (sending a hangup, signal 1).
The shell reports the process number of an asynchronous process started with' &' (run in the background).
Process numbers can also be found by usingps(I).
kill is built in to csh(I); it allows job specifiers, such as kill %
for details.

o. 0, in place of kill arguments.

See csh(l)

OPTIONS

-I

Display a list of signal names.

SEE ALSO
csh(I), ps(I), kill(2), sigvec(2)

BUGS
A replacement for kill 0 for csh(l) users should be provided.

216

Last change: 17 July 1986

Sun Release 3.2

LAST ( 1)

USER COMMANDS

LAST ( 1)

NAME

last - indicate last logins of users and teletypes
SYNOPSIS

last [ -number] [ -f filename] [name ... ] [ tty ... ]
DESCRIPTION
last looks back in the wtmp file which records alllogins 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 ttyO'. 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. last displays
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, last 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 displays a record of alllogins and logouts, in reverse order.
If last is interrupted, it indicates how far the search has progressed in wtmp. If interrupted with a quit signal
(generated by a control-\) last indicates how far the search has progressed so far, and the search continues.
OPTIONS

-number
limit the number of entries displayed to that specified by number.
-ffilename
Use filename as the name of the accounting file instead of lusrladmlwtmp.
FILES

lusr/admlwtmp

login data base

SEE ALSO
utmp(5), ac(8), lastcomm(l)

Sun Release 3.2

Last change: 23 September 1985

217

LASTCOMM ( 1 )

USER COMMANDS

LASTCOMM ( 1 )

NAME

lastcomm - show last commands executed in reverse order
SYNOPSIS

lastcomm [command name] ... [user name] ... [terminal name] ...
DESCRIPTION
Lastcomm gives information on previously executed commands. Lastcomm with no arguments displays
information about all the commands recorded during the current accounting file's lifetime. If called with
arguments, lastcomm only displays accounting entries with a matching command name, user name, or terminalname.
EXAMPLES

tutorial% Iastcomm a.out root ttydO
would produce a listing of all the executions of commands named a.out, by user root while using the terminal ttydO. and
tutorial% Iastcomm root
would produce a listing of all the commands executed by user root.
For each process entry, lastcomm displays the following items of information:
The command name under which the process was called.
One or more flags indicating special information about the process. The flags have the following meanings:
F

The process performed afork but not an exec.

S

The process ran as a set-user-id program.

D The process dumped memory.
X The process was killed by some signal.
The name of the user who ran the process.
The terminal which the user was logged in on at the time (if applicable).
The amount of CPU time used by the process (in seconds).
The date and time the process exited.
FILES

lusr/admlacct

accounting file

SEE ALSO
last(I), acct(5), core(5)

218

Last change: 1 February 1985

Sun Release 3.2

LD(l )

USER COMMANDS

LD( 1)

NAME

ld - link editor
SYNOPSIS
Id [ -align datum] [ -A name] [ -d ] [ -D hex] [ -e entry] [ -Ix] [ -Ldir ] [ -M] [ -n ] [ -N ]
[ -0 name] [ -r ] [ -s ] [ -8 ] [ -t ] [ - T [text] hex] [ - Tdata hex] [ -u name] [ -x] [ -x ]
[ -ysym] [ -z ] filename ...

DESCRIPTION

ld combines several object programs into one, resolves external references, and searches libraries. In the
simplest case several objectfilenames are given, and ld combines them, producing an object module which
can either be executed or become the input for a subsequent ld run. In the latter case, the -r option must be
given to preserve the relocation bits. The output of ld is left on a file called a.out if not otherwise specified.
The output file is made executable only if no errors occurred during link editing.

Files specified by the argument filename ... are concatenated in the order specified. The entry point of the
output is the beginning of the first routine, unless the -e option is specified.
If a named file is a library, it is searched exactly once at the point it is encountered in the argument list.
Only those routines defining an unresolved external reference are loaded. If a routine from a library references another routine in the same library, and the library has not been processed by ranlib, the referenced
routine must appear after the referencing routine in the library. Thus the order of programs within libraries
may be important. The first member of a library should be a file named ' __.SYMDEF' , which is understood to be a dictionary for the library as produced by ranlib; the dictionary is searched iteratively to
satisfy as many references as possible.

The symbols _etext, _ edata and _end (etext, edata and end in C) are reserved, and if referred to, are set to
the first location above the program, the first location above initialized data, and the first location above all
data, respectively. It is erroneous to define these symbols.
OPTIONS

Options should appear before the filenames, except abbreviated library names specified by the -I option,
which can appear anywhere.
-align datum
datum (usually a FORTRAN common block) is increased in length to be a multiple of the page
size; its beginning is set at a page boundary.
-A name
Incremental loading: linking is to be done in a manner so that the resulting object may be read into
an already executing program. name is the name of a file whose symbol table is taken as a basis on
which to define additional symbols. Only newly linked material is entered into the text and data
portions of a.out, but the new symbol table will reflect all symbols defined before and after the
incremental load. This argument must appear before any other object file in the argument list.
One or both of the - T options may be used as well, and will be taken to mean that the newly
linked segment will commence at the corresponding addresses (which must be a multiple of the
page size). The default value is the old value of _end.

-d

Force definition of common storage even if the -r flag is present.

-D hex Pad the data segment with zero-valued bytes to make it hex bytes long.

-e entry
Define the entry point: the entry argument is made the name of the entry point of the loaded program.
-Ix

Sun Release 3.2

This option is an abbreviation for the library name Iibx.a, where x is a string. ld searches for
libraries first in any directories specified with -L options, then in the standard directories llib,
lusr/lib, and lusrlIocaIllib. A library is searched when its name is encountered, so the placement
of a -I is significant.

Last change: 17 July 1986

219

LD(I)

USER COMMANDS

LD(I)

-Ldir

Add dir to the list of directories in which libraries are searched for. Directories specified with-L
are searched before the standard directories rob, lusr/lib, and lusr/local/lib.

-M

Produce a primitive load map, listing the names of the files which will be loaded.

-0

Arrange (by giving the output file a 0410 'magic number') that when the output file is executed,
the text portion will be read-only and shared among all processes executing the file. This involves
moving the data areas up to the first possible segment boundary following the end of the text.

-N

Do not make the text portion read-only or sharable. (Use 'magic number' 0407.)

-0 name

Name is made the name of the ld output file, instead of a.out.
-r

Generate relocation bits in the output file so that it can be the subject of another ld run. This flag
also prevents final definitions from being given to common symbols, and suppresses the
'undefined symbol' diagnostics.

-s

Strip the output, that is, remove the symbol table and relocation bits to save space (but impair the
usefulness of the debuggers). This information can also be removed by strip(I).

-S

Strip the output by removing all symbols except locals and globals.

-t

Trace: display the name of each file as it is processed.

- T [ text] hex
Start the text segment at location hex. Specifying -Tis the same as using the - Ttext option.
-Tdata hex
Start the data segment at location hex. This option is only of use to programmers wishing to write
code for PROMs, since the resulting code cannot be executed by the UNIX system.

-uname
Enter name as an undefined symbol. This is useful for loading wholly from a library, since initially the symbol table is empty and an unresolved reference is needed to force the loading of the
first routine.
-x

Preserve only global (non- .globl) symbols in the output symbol table; only enter external symbols. This option saves some space in the output file.

-X

Record local symbols, except for those whose names begin with 'L'. This option is used by cc to
discard internally generated labels while retaining symbols local to routines.

-ysym Display each file in which sym appears, its type and whether the file defines or references it.
Many such options may be given to trace many symbols. It is usually necessary to begin sym with
an '_', as external C, FORTRAN and Pascal variables begin with underscores.

-z

Arrange for the process to be loaded on demand from the resulting executable file (0413 'magic
number') rather than preloaded. This is the default. Results in a (32-byte) header on the output
file followed by text and data segments, each of which has a multiple of page-size bytes (being
padded out with nulls in the file if necessary). With this format the first few BSS segment symbols
may actually end up in the data segment; this is to avoid wasting the space resulting from rounding the data segment size. The text is read-only and shared among all processes executing the file.

FILES

llib/lib* .a
lusr/lib/lib*.a
lusr/iocalllib/lib*.a
a.out

libraries
more libraries
still more libraries
output file

SEE ALSO
as(l), ar(l), cc(l V), ranlib(l), strip(l)

220

Last change: 17 July 1986

S un Release 3.2

LEAVE ( 1)

USER COMMANDS

LEAVE(I)

NAME

leave - remind you when you have to leave
SYNOPSIS

leave [[ + ]hhmm]
DESCRIPTION
leave sets an alarm to a time you specify and will tell you when the time is up. leave 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, and at the time. After the specified time, it reminds you every minute thereafter 10 more
times. leave disappears after you log off.
You can specify the time in on of two ways, namely as an absolute time of day in the form hhmm where hh
is a time in hours (on a 12 or 24 hour clock), or you can place a + sign in front of the time, in which case
the time is relative to the current time, that is, the specified number of hours and minutes from now. 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?". leave exits if you just type a
newline, otherwise the reply is assumed to be a time. This 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 and
its process id.
SEE ALSO

calendar( 1)
EXAMPLES

The first example sets the alarm to an absolute time of day:
manual% leave 1535
Alarm set for Wed Mar 7 15:35:07 1984
work work work work
manual% Time to leave!
The second example sets the alarm for 10 minutes in the future:
manual% leave +10
Alarm set for Wed Mar 7 15:45:24 1984
work work work work
manual% Time to leave!
work work work work
manual% You're going to be late!

Sun Release 3.2

Last change: 17 July 1986

221

LEX ( 1)

USER COMMANDS

LEX ( 1)

NAME

lex - generator of lexical analysis programs
SYNOPSIS

lex [ -tvro] [filename] ...
DESCRIPTION

lex generates programs to be used in simple lexical analyis of text. Each filename (standard input by
default) contains regular expressions to search for, and actions written in C to be executed when expressions are found.

A C source program, lex.yy.c is generated, to be compiled as follows:
cc lex.yy.c -11
This program, when run, copies unrecognized portions of the input to the output, and executes the associated C action for each regular expression that is recognized. The actual string matched is left in yytext, an
external character array.
Matching is done in order of the strings in the file. The strings may contain square braces to indicate character classes, as in [abx-z] to indicate a, b, X, y, and z; and the operators *, + and ?, which mean, respectively, any nonnegative number, any positive number, or either zero or one occurrences of the previous
character or character-class. The "dot" character (.) is the class of all ASCII characters except NEWLINE.
Parentheses for grouping and vertical bar for alternation are also supported. The notation r{d,e} in a rule
indicates instances of regular expression r. between d and e. It has a higher precedence than I, but lower
than that of *, ?, +, or concatenation. The carat character () at the beginning of an expression permits a
successful match only immediately after a NEWLINE, and the character $ at the end of an expression
requires a trailing NEWLINE.
The character I in an expression indicates trailing context; only the part of the expression up to the slash is
returned in yytext, although the remainder of the expression must follow in the input stream.
An operator character may be used as an ordinary symbol if it is within

n

symbols or preceded by \.

Three subroutines defined as macros are expected: inputO to read a character; nnput(c) to replace a character read; and output(c) to place an output character. They are defined in terms of the standard streams,
but you can override them. The program generated is named yylexO, and the library contains a maio()
which calls it. The action REJECT on the right side of the rule causes this match to be rejected and the next
suitable match executed; the function yymoreO accumulates additional characters into the same yytext; and
the function yyless(p) pushes back the portion of the string matched beginning at p, which should be
between yytext and yytext +yyleng. The macros input and output use files yyio and yyout to read from and
write to, defaulted to stdio and stdont, respectively.
In a lex program, any line beginning with a blank is assumed to contain only C text and is copied; if it precedes % % it is copied into the external definition area of the lex.yy.c file. All rules should follow a % %,
as in YACC. Lines preceding % % which begin with a nonblank character define the string on the left to be
the remainder of the line; it can be used later by surrounding it with {}. Note that curly brackets do not
imply parentheses; only string substitution is done.
The external names generated by lex all begin with the prefix yy or YY.
Certain table sizes for the resulting finite-state machine can be set in the definitions section:

222

%p n

number of positions is n (default 2000)

%0 n

number of states is n (500)

%t n

number of parse tree nodes is n (1000)

%a n

number of transitions is n (3000)

Last change: 23 July 1986

Sun Release 3.2

USER COMMANDS

LEXC 1)

LEXC 1)

The use of one or more of the above automatically implies the -v option, unless the -n option is used.
OPTIONS
-t

Place the result on the standard output instead of in file lex.yy.c.

-v
-n

Print a one-line summary of statistics of the generated analyzer.

-f

'Faster' compilation: don't bother to pack the resulting tables; limited to small programs.

Opposite of -v; -n is default.

EXAMPLES

lex lexcommands
would draw lex instructions from the file lexcommands, and place the output in lex.yy.c.
%%
[A-Z] putcharCyytext[O]+'a'-'A');
[]+$

;

[ ]+

putcharC' ');

is an example of a lex program. It converts upper case to lower, removes blanks at the end of lines, and
replaces multiple blanks by single blanks.
D
%%

if
[a-z] +
O{D}+
{D}+
"++"

"+"
"/*tI

[0-9]

printfCtlIF statement\n tl );
printf("tag, value %s\ntl ,yytext);
printf("octal number %s\ntl ,yytext);
printfCtldecimal number %s\ntl,yytext);
printf("unary op\ntl);
printfCtlbinary op\ntl);
{
loop:
while CinputO != '*');
switch CinputO)
{
case '/': break;
case '*': unputC'*');
default: go to loop;
}
}

SEE ALSO
yaccCl), sedCl V)

Lex - A Lexical Analyzer Generator, in Programming Utilities for the Sun Workstation.

Sun Release 3.2

Last change: 23 July 1986

223

LINE ( 1)

USER COMMANDS

LINE ( 1)

NAME

line - read one line
SYNOPSIS

line
DESCRIPTION

line copies one line (up to a newline) from the standard input and writes it on the standard output It
returns an exit code of 1 on EOF and always prints a newline at least. It is often used within shell scripts to
read from the user's terminal.
SEE ALSO

sh(I), read(2)

224

Last change: 21 February 1986

Sun Release 3.2

LINT ( IV)

USER COMMANDS

LINT ( IV)

NAME

lint - a C program verifier
SYNOPSIS
lint [ -abchinouvxz] [ -Dname [=def ] ] [ -D name] [ -U name ] [ -I dir] [ -0 outftle ] filename . ..
lint [ -Clib ] filename ...
SYSTEM V SYNOPSIS
/usrlSbin/Iint [ -abcghnpuvxzO ] [ -D name =def] [ -D name] [ -U name] [ -I dir] [ -0 lib ] filename
DESCRIPTION
lint attempts to detect features of the C programfiles that are likely to be bugs, non-portable, or wasteful.
lint also checks the type usage of the program more strictly than the C compiler. lint runs the C preprocessor as its first phase. The preprocessor symbol "lint" is defined, in order to allow certain questionable code
to be altered or removed for lint. Therefore, the symbol "lint" should be thought of as a reserved word for
all code that is planned to be checked by lint.

Among the things that are currently found are unreachable statements, loops not entered at the top,
automatic variables declared and not used, and logical expressions whose values are constant. Moreover,
the usage of functions is checked to find functions which return values in some places and not in others,
functions called with varying numbers of arguments, and functions whose values are not used.
Arguments whose names end with .c are taken to be C source files. Arguments whose names end with .In
are taken to be the result of an earlier invocation of lint with the -C option used. The.ln files are analogous to.o (object) files that are produced by the cc(lV) command when given a.c file as input.
lint will take all the .c,.In, and llib-Ix.In (specified by -Ix) files and process them in their command line
order. By default, lint appends the standard C lint library (llib-Ic.ln) to the end of the list of files. When
the -C option is not used, the second pass of lint checks this list of files for mutual compatibility. When
the -C option is used, the .In and the llib-Ix.ln files are ignored.

To create lint libraries, use the -C option. For example
tutorial% lint -Ccongress files ...
where files are the C sources of library congress, produces a file llib-lcongress .In in the current directory in
the correct library format suitable for lint'ing programs using -Icongress.
General Comments
The routine exit(2) and other functions which do not return are not understood; this causes various lies.

Certain conventional comments in the C source will change the behavior of lint:
/*NOTREACHED*/
at appropriate points stops comments about unreachable code. (This comment is typically placed
just after calls to functions like exit(2».
I*V ARARGSn*1
suppresses the usual checking for variable numbers of arguments in the following function
declaration. The data types of the first n arguments are checked; a missing n is taken to be O.
I*ARGSUSED*I
turns on the -v option for the next function.
1* LINTLIBRARY */
at the beginning of a file, shuts off complaints about unused functions and function arguments in
this file. This is equivalent to using the -v and -x options.
SYSTEM V DESCRIPTION
lint will take all the .c,.ln, and llib-Ix.In (specified by -Ix) files and process them in their command line
order. By default, lint appends the standard C lint library (llib-Ic.ln) to the end of the list of files. However, if the -p option is used, the portable C lint library (llib-port.In) is appended instead. When the -c

Sun Release 3.2

Last change: 17 July 1986

225

LINT ( IV)

USER COMMANDS

LINT ( IV)

option is not used, the second pass of lint checks this list of files for mutual compatibility. When the -c
option is used, the .In and the Ilib-lx.1n files are ignored.
Lint produces its first output on a per-source-file basis. Complaints regarding included files are collected
and printed after all source files have been processed. Finally, if the -c option is not used, information
gathered from all input files is collected and checked for consistency. At this point, if it is not clear
whether a complaint stems from a given source file or from one of its included files, the source file name
will be printed followed by a question mark.

The behavior of the -c and the -0 options allows for incremental use of lint on a set of C source files.
Generally, one invokes lint once for each source file with the -c option. Each of these invocations produces a .In file which corresponds to the .c file, and prints all messages that are about just that source file.
After all the source files have been separately run through lint, it is invoked once more (without the -c
option), listing all the .In files with the needed -Ix options. This will print all the inter-file inconsistencies.
This scheme works well with make (1); it allows make to be used to lint only the source files that have been
modified since the last time the set of source files were linted.
OPTIONS

-a

Report assignments of long values to variables that are not long.

-b

Report break statements that cannot be reached. This is not the default because, unfortunately,
most lex(l) and many yacc(l) outputs produce dozens of such messages.

-c

Complain about casts which have questionable portability.

-b

Apply a number of heuristic tests to attempt to intuit bugs, improve style, and reduce waste.

-i

Cause lint to produce a .In file for every .c file on the command line. These .In files are the product of lint's first pass only, and are not checked for compatibility between functions.

-n

Do not check compatibility against the standard library.

-u

Do not complain about functions and external variables used and not defined, or defined and not
used (this is suitable for running lint on a subset of files comprising part of a larger program).

-v

Suppress complaints about unused arguments in functions.

-x

Report variables referred to by extern declarations, but never used.

-z

Do not complain about structures that are never defined (for example, using a structure pointer
without knowing its contents).

-Dname=def

-Dname
Define name to the preprocessor, as if by '#define'. If no definition is given, the name is defined
as lit.
It

-Uname
Remove any initial definition of name in the preprocessor.
-Idir

'#include' files whose names do not begin with 'I' are always sought first in the directory of the
file argument, then in directories named in -I options, then in the lusrlinclude directory.

-ooutfile
Name the output file outfile. outfile cannot be the same as sourcefile (lint will not overwrite the
source file).
-CUb

create a lint library with name lib (see DESCRIPTION section).

-llib

use lint library lib from the lusrllibllint directory.

SYSTEM V OPTIONS
The sense of the -a, -b, -b, and -x options is reversed in the System V version of lint; the tests they control are performed unless the flag is specified. The -C option is not available; instead, the -c or -0 options
can be used.

226

Last change: 17 July 1986

Sun Release 3.2

LINT ( IV)

USER COMMANDS

LINT ( IV)

-p

Attempt to check portability to other dialects (IBM and GeOS) of C. Along with stricter checking,
this option causes all non-external names to be truncated to eight characters and all external names
to be truncated to six characters and one case.

-c

Cause lint to produce a .In file for every .c file on the command line. These .In files are the product of lint's first pass only, and are not checked for compatibility between functions.

-0

lib

Cause lint to create a lint library with the name IIib-llib .In. The -c option nullifies any use of the
option. The lint library produced is the input that is given to lint's second pass. The -0 option
simply causes this file to be saved in the named lint library. To produce a llib-llib.ln without
extraneous messages, use of the -x option is suggested. The -v option is useful if the source
file(s) for the lint library are just external interfaces (for example, the way the file llib-Ie is written). These option settings are also available through the use of "lint comments" (see below).

-0

-g
-0

These options are accepted but ignored. By recognizing these options, lint's behavior is closer to
that of the cc (1 V) command.

EXAMPLE

The following lint call:
tutorial% lint -b myfile.c
checks the consistency of the code in the C source file file myfile.c. The -b option indicates that unreachable break statements are to be checked for.
FILES

lusr/lib/lintllint[1 2]
lusr/lib/lintillib-l*.ln
lusr/lib/lintillib-l*
These libraries exist
-Itermeap.

programs
Various prebuilt lint libraries.
Sources of the prebuilt lint libraries.
for -Ie, -Ieore, -Ieurses, -1m, -Imp, -Ipixrect, -Isuntool, -Isunwindow, and

SYSTEM V FILES

lusr/5lib/lintllint[1 2]
programs
lusr/lib/5lintlllib-I*.1n Various prebuilt lint libraries.
Sources of the prebuilt lint libraries.
lusr/lib/5Iintlllib-l*
These libraries exist for -Ie, -1m, and -Iport.
SEE ALSO

cc(1 V), cpp(l)
Lint, a C Program Checker, in Programming Utilities/or the Sun Workstation

BUGS
There are some things you just can't get lint to shut up about.

Sun Release 3.2

Last change: 17 July 1986

227

LN( 1)

LN(l)

USER COMMANDS

NAME

In - make links
SYNOPSIS

In [ -f] [ -s ] filename [ linkname ]
In [ -f] [ -s ] filename . .. directory
DESCRIPTION

In assigns an additional name (directory entry), called a link, to a file or directory. Several links may be
assigned to a file at anyone time. The number of links does not affect other attributes such as size, protections, data, etc. There are two kinds of links: hard links and symbolic links.
A hard link, which is the default, can only be made to an existing file. Only the superuser can make a hard
link to a directory. To remove a file with more than one hard link, all such links (including the name by
which it was created) must be removed. Hard links may not span file systems.

In can also make symbolic links. A symbolic link contains the name of the file or directory to which it is
linked. The referenced file or directory is used when an open(2V) operation is performed on the link. A
stat on a symbolic link returns the linked-to file; an Istat(2) must be done to obtain information about the
link itself. The readlink(2) call may be used to read the contents of a symbolic link. Symbolic links may
span file systems and may refer to directories.
filename is the original name of the file or directory to be linked. linkname is the new name to be associated
with the file or filename. If linkname is omitted, the last component of the original pathname is used
directory is a directory in which to place the link. When a directory is specified, In uses the last component
of each original pathname as the name of each link.
OPTIONS

-f

Force a hard link to a directory, -

-s

Create symbolic links.

this option is only available to the superuser.

EXAMPLES

The commands below illustrate the effects of the different forms of the In command.
See what files we've got
tutorial% Is -F
grab
jones/
See what files there are in jones
tutorial% Is -F jones
One file
house
try to link a file in the same directory
tutorial% In grab
Sorry - can't link a file to itself
Jgrab: File exists
link a file from another directory to here
tutorial% In joneslhouse
tutorial % Is -F
grab
house jones/
link afile to another name in this directory
tutorial% In grab hold
tutorial% Is -F
grab
hold
house jones/
link files from here to jones
tutorial% In grab hold jones
tutorial% Is -F jones
grab
hold
house
tutorial%
SEE ALSO

rm(I), cp(I), mv(I), link(2), readlink(2), stat(2), symlink(2), Istat(2)

228

Last change: 23 September 1985

Sun Release 3.2

LOCKSCREEN ( 1 )

USER COMMANDS

LOCKSCREEN ( 1 )

NAME

lockscreen, lockscreen_default - maintain window context, prevent unauthorized access and reduce phosphorbum.
SYNOPSIS

lockscreen [ -b program] [ -e] [ -0] [ -r] [ -t seconds] [gfx-program] [gfx-program-args]
DESCRIPTION
Lockscreen is a standard tool provided under the SunView environment that preserves the current state of
the display while the machine is not in use. When run, the display is cleared to black and the gfx-program
is run. It is assumed that the gfx-pro gram will provide moving graphics to limit phosphor bum of the video

display that might otherwise occur from leaving the same static window configuration displayed for a long
time. If no gfx-program is provided, a suitable default program is run.
Lockscreen prevents unauthorized access by requiring the user's password before restoring the window
context. When any keyboard or mouse button is pressed, the graphics screen is replaced by a password
screen that displays the user name, a small box with a bouncing logo, and a prompt for the user's password.
If the user has no password, or if the -0 option is used, the user's window context is immediately restored.

When the password screen appears:
1)

Restore the window context by entering the user's password followed by a carriage return (this
password is not echoed on the screen) or,

2)

Point to the black box and click the left button to return to the graphics display.

If neither of the above actions is taken, gfxyrogram will resume execution after the interval specified with
the -t option, as described below.
OPTIONS
-b program

Allow an additional program to be run as a child process of lockscreen. This background process
could be a compile server or some other useful program that the user wants run while lockscreen
is running. No arguments are passed to this program.
-e

Add the Exit Desktop choice to the password screen. If pointed to and clicked, the SunView
environment is exited and the current user is logged out.

-n

Require no password to reenter the window environment.

-r

Allow the use of the user name root in the Name: field of the password screen. Normally, root is
not accepted as a valid user name.

-t seconds

After seconds seconds, clear the password screen and restart the gfx-prograrn. The default is 5
minutes (300 seconds).
[ gfx-program] [ gfx-program-args ]
Run this program after clearing the screen to black. If no pro gram argument is present, lockscreen will try to run lockscreen_default if it exists on the standard search path, otherwise a
bouncing Sun logo will appear. If gfx-program-args are specified and the gfx-program isn't then
the args are passed to lockscreen_default. Lockscreen_default is typically a life program displaying the successive generations. Lockscreen will not search for lockscreen_default if the gfxprogram is specified explicitly as ''''.
FILES

lusrlbinllockscreen_default
The default gfx-program. If a file named lockscreen_defaUlt appears earlier in the
search path, that file is used instead.
SEE ALSO

suntools(l),login(l)

Sun Release 3.2

Last change: 16 June 1986

229

LOCKSCREEN ( 1 )

USER COMMANDS

LOCKSCREEN ( 1 )

NAME

login - sign on
SYNOPSIS
login [ username ]
DESCRIPTION
login signs username on to the system initially; login may also be used at any time to change from one
userid to another.

When used with no argument, login requests a user name and password (if appropriate). Echoing is turned
off (if possible) while typing the password.
When successful, login updates accounting files, informs you of the existence of any mail, prints the message of the day, and displays the time you last logged in (unless you have a .hushlogin file in your home
directory - mainly used by nonhuman users, such as uucp).

login initializes the user and group IDs and the working directory, then starts a command interpreter shell
(usually either Ibinlsh or Ibinlcsh according to specifications found in the file letclpasswd. (Argument 0 of
the command interpreter is "-sh", or more generally, the name of the command interpreter with a leading
dash ("-") prepended.)
login also initializes the environment with information specifying home directory, command interpreter,
terminal-type (if available) and username.
If the file letclnologin exists, login prints its contents on the user's terminal and exits. This is used by shutdown(8) to stop log ins when the system is about to go down.
The login command, recognized by sh and csh, is executed directly (without forking), and terminates that
shell. To resume working, you must log in.

login times out and exits if its prompt for input is not answered within a reasonable time.
When the Bourne shell (sh) starts up, it reads a file called .profile from your home directory (that of the
usemame you use to log in). When the C-Shell (csh) starts up, it reads a file called .cshrc from your home
directory, and then reads a file called .login.
The shells read these files only if they are owned by the person logging in.
FILES

accounting
accounting
time of last login
terminal types
quota check
mail
message-of-the-day
password file
stop login, print message
makes login quieter

letclutmp
lusrladmlwtmp
lusrladmllastlog
lusrlttytype
lusrlucblquota
Iusrlspool!maill*
letclmotd
letclpasswd
letclnologin
-I.hushlo gin

SEE ALSO
init(8), getty(8), mail(l), passwd(l), passwd(5), environ(5V), shutdown(8), utmp(5)
DIAGNOSTICS
"Login incorrect," if the name or the password is bad (or mistyped).
"No Shell", "cannot open password file", "no directory": ask your system administrator for assistance.

230

Last change: 12 June 1986

Sun Release 3.2

LOGNAME(l)

USER COMMANDS

LOGNAME(l)

NAME

logname - get login name
SYNOPSIS

iogname
DESCRIPTION
logname returns the contents of the environment variable LOGNAME, which is set when a user logs into the
system.
FILES

/ etc/profile
SEE ALSO
env(l), login(I), environ(5V)

Sun Release 3.2

Last change:

231

LOOK ( 1)

USER COMMANDS

LOOK ( 1)

NAME

look - find lines in a sorted list or words in the system dictionary
SYNOPSIS

look [ -dr] string [ file]
DESCRIPTION
Look consults a sortedfile and prints all lines that begin with string.
OPTIONS
-d

-f

'Dictionary' order: only letters, digits, tabs and blanks participate in comparisons.
Fold: Upper case letters compare equal to lower case.

If no file is specified, look uses lusrldictlwords with collating sequence -dr.
FILES

lusr/diet/words
SEE ALSO
sort(1 V), grep(1 V)

232

Last change: 13 April 1983

Sun Release 3.2

LOOKBID(l)

USER COMMANDS

LOOKBIB(l)

NAME

lookbib - find references in a bibliography
SYNOPSIS
lookbib database
DESCRIPTION
A bibliographic reference is a set of lines, constituting fields of bibliographic information. Each field starts
on a line beginning with a "%", followed by a key-letter, then a blank, and finally the contents of the field,
which may continue until the next line starting with' '%" .

Lookbib uses an inverted index made by indxbib to find sets of bibliographic references. It reads keywords
typed after the ">" prompt on the terminal, and retrieves records containing all these keywords. If nothing
matches, nothing is returned except another ">" prompt.
It is possible to search multiple databases, as long as they have a common index made by indxbib. In that
case, only the first argument given to indxbib is specified to lookbib.
If lookbib does not find the index files (the .i[abc] files), it looks for a reference file with the same name as
the argument, without the suffixes. It creates a file with a '.ig' suffix, suitable for use withfgrep. Lookbib
then uses this fgrep file to find references. This method is simpler to use, but the .ig file is slower to use
than the .i[abc] files, and does not allow the use of multiple reference files.
FILES

x.ia, x.ib, x.ic, where x is the first argument, or if these are not present, then x.ig, x
SEE ALSO
refer(l), addbib(l), sortbib(l), roffbib(l), indxbib(l)

Refer in Formatting Documents on the Sun Workstation
BUGS

Probably all dates should be indexed, since many disciplines refer to literature written in the 1800s or earlier.

Sun Release 3.2

Last change: 6 April 1985

233

LORDER( 1)

USER COMMANDS

LORDER(I)

NAME

lorder - find ordering relation for an object library
SYNOPSIS

lorder file •••
DESCRIPTION

Give lorder one or more object or library archive (see ar(l» files, and it lists pairs of object file namesmeaning that the first file of the pair refers to external identifiers defined in the second - to the standard
output. Lorder's output may be processed by tsort(l) to find an ordering of a library suitable for one-pass
access by ld(l).
EXAMPLE

This brash one-liner intends to build a new library from existing.o files.
ar cr library . . lorder *.0 I tsort'
The ranlib(I), command converts an ordered archive into a randomly accessed library and makes lorder
unnecessary .
SEE ALSO

tsort(I), Id(I), ar(I), ranlib(l)

BUGS
The names of object files, in and out of libraries, must end with '.0'; otherwise, nonsense results.

234

Last change: 11 November 1983

Sun Release 3.2

USER COMMANDS

LPQ( 1)

LPQ( 1)

NAME

lpq - spool queue examination program
SYNOPSIS

Ipq [ + [ num ] ] [ -I] [ -Pprinter ] [job # ... ] [ user . .. ]
DESCRIPTION
lpq examines the spooling area used by lpd (8) for printing files on the line printer, and reports the status of

the specified jobs or all jobs associated with a user.
Ipq reports on any jobs currently in the queue when invoked without any options. Arguments supplied that
are not recognized as options are interpreted as user names or job numbers to filter out only those jobs of
interest.

For each job submitted (that is, each invocation of Ipr) Ipq reports the user's name, current rank in the
queue, the names of files comprising the job, the job identifier (a number which may be supplied to lprm
for removing a specific job), and the total size in bytes. Normally, only as much information as will fit on
one line is displayed. Job ordering is dependent on the algorithm used to scan the spooling directory and is
supposed to be FIFO (First in First Out). File names comprising a job may be unavailable (when Ipr is
used as a sink in a pipeline) in which case the file is indicated as '(standard input)'.
If lpq warns that there is no daemon present (that is, due to some malfunction), the lpe(8) command can be
used to restart the printer daemon.
OPTIONS
-Pprinter report the state of the queue to the specified printer. In the absence of the -P option, the queue
to the printer specified by the PRINTER variable in the environment is reported on. If the PRINTER variable

isn't set, the default line printer queue is reported.
-Ijob # ...

causes information about each of the files comprising the job to be printed.
+nnn

display the spool queue until it empties. Supplying a number nnn immediately after the + sign
indicates that lpq should sleep nnn seconds in between scans of the queue.

FILES

letc/termcap
letclprintcap
lusrlspooll*
lusrlspooll*/cf*
lusrlspooll *flock

for manipulating the screen for repeated display
to determine printer characteristics
the spooling directory, as determined from printcap
control files specifying jobs
the lock file to obtain the currently active job

SEE ALSO

Ipr(l), Iprm(l), Ipc(8), Ipd(8)
BUGS

The + option doesn't wait until the entire queue is empty; it only waits until the local machine's queue is
empty.
Ipq may report unreliably. The status, as reported, may not always reflect the actual state of the printer.

Output formatting is sensitive to tl-te line length of the terminal; this can result in widely-spaced columns.
Ipq is sometimes unable to open various files because the lock file is malformed.
DIAGNOSTICS

Waiting for printer to become ready (offline ?)
The daemon could not open the printer device. This can happen for a number of reasons; the most
common is that the printer is turned off-line. This message can also be generated if the printer is
out of paper, the paper is jammed, and so on. The actual reason is dependent on the meaning of
error codes returned by system device driver. Not all printers supply sufficient information to distinguish when a printer is off-line or having trouble (for example, a printer connected through a

Sun Release 3.2

Last change: 23 September 1985

235

LPQ( 1)

USER COMMANDS

LPQ(l)

serial line). Another possible cause of this message is some other process, such as an output filter,
has an exclusive open on the device. Your only recourse here is to kill off the offending
program(s) and restart the printer with lpc.

printer is ready and printing
The lpq program checks to see if a daemon process exists for printer and prints the file status. If
the daemon is hung, a super user can use lpc to abort the current daemon and start a new one.

waiting for host to come up
Indicates that there is a daemon trying to connect to the remote machine named host in order to
send the files in the local queue. If the remote machine is up, lpd on the remote machine is probably dead or hung and should be restarted as mentioned for lpr.

sending to host
The files should be in the process of being transferred to the remote host. If not, the local daemon
should be aborted and started with lpc.
Warning: printer is down
The printer has been marked as being unavailable with lpc.

Warning: no daemon present
The lpd process overseeing the spooling queue, as indicated in the "lock" file in that directory,
does not exist. This normally occurs only when the daemon has unexpectedly died. The error log
file for the printer should be checked for a diagnostic from the deceased process. To restart an
lpd, use

% /usr/etc/lpc restart printer

236

Last change: 23 September 1985

Sun Release 3.2

LPR( 1)

USER COMMANDS

LPR( 1)

NAME

lpr - off-line print
SYNOPSIS
Ipr [ -Pprinter] [ -#num ] [ -Cclass] [ - Jjob ] [ - Ttitle] [ -i [ num] ] [ -1234font]
[-wnum] [ -r ] [ -m] [ -b] [ -s] [ -filter-option] [filename ... ]
DESCRIPTION
lpr uses a spooling daemon to print the named files when facilities become available. lpr reads the stndard
input if no files are specified.
OPTIONS

-Pprinter
Force output to the named printer. Normally, the default printer is used (site dependent), or the
value of the PRINTER environment variable is used.
-#num Produce multiple copies of output, using num as the number of copies for each file named. For
example,
tutorial% Ipr -#3 new.index.c print.index.c more.c
produces three copies of the file new .index.c , followed by three copies of print .index.c , etc. On the other
hand,
tutorial% cat new.index.c print.index.c more.c Ilpr-#3
generates three copies of the concatenation of the files.
-C

Print class as the job classification on the burst page. For example,
tutorial% Ipr -C Operations new.index.c
replaces the system name (the name returned by hostname) with 'Operations' on the burst page,
and prints the file new Jndex.c .

-Jjob

Print job as the job name on the burst page. Normally, Ipr uses the first file's name.

- Ttitle Use title instead of the file name for the title used by pr.
-i[num] Indent output num spaces. If num is not given, eight spaces are used as default
-I font

-2font
-3 font
-4 font Mount the specified font on font position I, 2, 3 or 4. The daemon will construct a .railmag file in
the spool directory that indicates the mount by referencing lusrlliblvfontlfont.
-wnum Use num as the page width for pr.
-r

Remove the file upon completion of spooling.

-m

Send mail upon completion.

-b

Suppress printing the burst page.

-s

Create a symbolic link from the spool area to the data files rather than trying to copy them (so
large files can be printed). This means the data files should not be modified or removed until they
have been printed. In the absence of this option, files larger than 1 Megabyte in length are truncated. Note that the -s option only works on the local host (files sent to remote printer hosts are
copied anyway), and only with named data files - it doesn't work if Ipr is at the end of a pipeline.

filter-option
The following single letter options notify the line printer spooler that the files are not standard text
files. The spooling daemon will use the appropriate filters to print the data accordingly.
-p
-I
-t
-n

Sun Release 3.2

Use pr to format the files (lpr -p is very much like pr Ilpr).
Print control characters and suppress page breaks.
The files contain troff(cat phototypesetter) binary data.
The files contain data from ditroff(device independent troft).

Last change: 30 July 1986

237

LPR( 1)

USER COMMANDS

-d
-g
-v
-c
-f

LPR( 1)

The files contain data from tex (DVI fonnat from Stanford).
The files contain standard plot data as produced by the plot(3X) routines (see also
plot(lG) for the filters used by the printer spooler).
The files contain a raster image, see rasterfile(5).
This option currently is unassigned.
Interpret the first character of each line as a standard FORTRAN carriage control character.

If no filter-option is given, '%!' as the first two characters indicates that the file contains
Postscript commands.
FILES

/etc/passwd
/ etclprintcap
/usr/lib/lpd*
/usr/spooll*
/usr/spooll*/cf*
/usr/spooll*/df*
/usr/spooll*/tf*

personal identification
printer capabilities data base
line printer daemons
directories used for spooling
daemon control files
data files specified in "cf' files
temporary copies of "cf' files

SEE ALSO

lpq(l), lprm(l), pr(lV), printcap(5), Ipc(8), Ipd(8), rasterfile(5), screendump(l)
DIAGNOSTICS

lpr: copy file is too large
A file is determined to be too 'large' to print by copying into the spool area. Use the -s option as
defined above to make a symbolic link to the file instead of copying it. A 'large' file is approximately 1 Megabyte in this system.
Ipr: printer: unknown printer
The printer was not found in the printcap database. Usually this is a typing mistake; however, it
may indicate a missing or incorrect entry in the /etclprintcap file.
Ipr: printer: jobs queued, but cannot start daemon.
The connection to lpd on the local machine failed. This usually means the printer server started at
boot time has died or is hung. Check the local socket Idev/printer to be sure it still exists (if it
does not exist, there is no lpd process running).
lpr: printer: printer queue is disabled
This means the queue was turned off with
tutorial% lusr/etclIpc disable printer
to prevent lpr from putting files in the queue. This is nonnally done by the system manager when a printer
is going to be down for a long time. The printer can be turned back on by a super-user with lpc.
If the -f and -s flags are combined as follows:

Ipr -fs filename
copies the file to the spooling directory rather than making a symbolic link.
Placing the -s flag first, or writing each as separate arguments makes a link as expected.
BUGS

Ipr -p is not equivalent to pr Ilpr. Ipr -p puts the current date at the top of each page, rather than the date
last modified, and inserts a header page between each file printed.
The -p and -# options don't work well together; the second and subsequent copies do not include the file
name in each page's title.
Fonts for troff and tex reside on the host with the printer. It is currently not possible to use local font
libraries.

238

Last change: 30 July 1986

Sun Release 3.2

LPRM( 1)

USER COMMANDS

LPRM(I)

NAME

lprm - remove jobs from the line printer spooling queue
SYNOPSIS

Iprm [ -Pprinter ] [ - ] [job # ... ] [ username ... ]
DESCRIPTION
lprm removes a job, or jobs, from a printer's spool queue. Since the spooling directory is protected from
users, using lprm is normally the only method by which a user may remove ajob.

lprm without any arguments will delete the currently active job if it is owned by the user who invoked
lprm.
If the - flag is specified, lprm will remove all jobs which a user owns. If the super-user employs this flag,
the spool queue will be emptied entirely. The owner is determined by the user's login name and host name
on the machine where the lpr command was invoked.

Specifying a user's name, or list of user names, will cause lprm to attempt to remove any jobs queued
belonging to that user (or users). This form of invoking lprm is useful only to the super-user.
A user may dequeue an individual job by specifying its job number. This number may be obtained from
lpq. For example:
tutorial% Ipq -Pimagen
imagen is ready and printing
Rank Owner Job Files
active wendy 385 standard input
tutorial% Iprm -Pimagen 385

Total Size
35501 bytes

lprm announces the names of any files it removes and is silent if there are no jobs in the queue which match
the request list.
lprm will kill off an active daemon, if necessary, before removing any spooling files. If a daemon is killed,
a new one is automatically restarted upon completion of file removals.
The -P option may be used to specify the queue associated with a specific printer (otherwise the default
printer, or the value of the PRINTER variable in the environment is used).
FILES

letc/printcap
printer characteristics file
lusrlspooll*
spooling directories
lusrlspooll*/lock lock file used to obtain the pid of the current
daemon and the job number of the currently active job
SEE ALSO
Ipr(I), Ipq(1), Ipd(8)
DIAGNOSTICS

Iprm: printer: cannot restart printer daemon
The connection to lpd on the local machine failed. This usually means the printer server started at
boot time has died or is hung. Check the local socket !dev/printer to be sure it still exists (if it
does not exist, there is no lpd process running). Use
tutorial% ps ax I fgrep Ipd
to get a list of process identifiers of running lpd's. The lpd to kill is the one which is not listed in
any of the "lock" files (the lock file is contained in the spool directory of each printer). Kill the
master daemon using the following commands:
tutorial% su Password:
tutorial# kill pid

Sun Release 3.2

Last change: 23 September 1985

239

LPRM( 1)

USER COMMANDS

LPRM(I)

Then remove Idevlprinter and restart the daemon (and printer) with the following commands.
tutorial# rm /dev/printer
tutorial# /usr/lib/lpd
Another possibility is that the lpr program is not setuid root, setgid daemon. This can be checked
with
tutorial# Is -Ig /usr/ucblIpr

BUGS
Since there are race conditions possible in the update of the lock file, the currently active job may be
incorrectly identified.

240

Last change: 23 September 1985

Sun Release 3.2

LS( IV)

USER COMMANDS

LS( IV)

NAME

Is - list contents of directory
SYNOPSIS

Is [ -acdfgilqrstulACLFR ] filename . ..
SYSTEM V SYNOPSIS

/usr/5binlls [ -abcdfgilmnopqrstuxCLFR ] filename . ..
DESCRIPTION

For each filename which is a directory, Is lists the contents of the directory; for each filename which is a
file, Is repeats its name and any other information requested. By default, the output is sorted alphabetically.
When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments are processed before directories and their contents.
In order to determine output formats for the -C, -x, and -m options, /usr/5binlls uses an environment variable, COLUMNS, to determine the number of character positions available on one output line. If this variable is not set, the terminfo database is used to determine the number of columns, based on the environment
variable TERM. If this information cannot be obtained, 80 columns are assumed.
OPTIONS

-a

List all entries; in the absence of this option, entries whose names begin with a '.' are not listed
(except for the super-user, for whom Is, but not /usr/Sbin/ls, normally prints even files that begin
with a '.').

-b

(/usr/Sbin/Is only) Force printing of non-graphic characters to be in the octal \ddd notation.

-c

Use time of last edit (or last mode change) for sorting or printing.

-d

If argument is a directory, list only its name (not its contents); often used with -I to get the status
of a directory.

-f

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

-g

For Is, show the group ownership of the file in a long output. For /usr/Sbin/Is, print a long listing,
the same as -I, except that the owner is not printed.

-i

For each file, print the i-number in the first column of the report.

-I

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 will instead contain
the major and minor device numbers. If the file is a symbolic link the pathname of the linked-to
file is printed preceded by '->'. /usr/5bin/1s will print the group in addition to the owner.

-m

(/usr/5binlls only) Stream output format; the file names are printed as a list separated by commas,
with as many entries as possible printed on a line.

-n

(/usr/Sbinlls only) The same as -I, except that the owner's UID and group's GID numbers are
printed, rather than the associated character strings.

-0

(/usr/5binlls only) The same as -I, except that the group is not printed.

-p

(/usr/Sbinlls only) Put a slash (I) after each filename if that file is a directory.

-q

Display non-graphic characters in filenames as the character (?); this is the default when output is
to a terminal.

-r

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

-s

Give size of each file, including any indirect blocks used to map the file, in kilobytes (Is) or 512byte blocks (/usr/Sbin/Is).

-t

Sort by time modified (latest first) instead of by name.

Sun Release 3.2

Last change: 17 July 1986

241

LS( IV)

USER COMMANDS

LS( IV)

-u

Use time of last access instead of last modification for sorting (with the -t option) and/or printing
(with the -I option).

-x

(/usr/5binlIs only) Multi-column output with entries sorted across rather than down the page.

-1

(Is only) Force one entry per line output format; this is the default when output is not to a terminal.

-A

(Is only) Same as -3, except that'.' and ' •. ' are not listed.

-C

Force multi-column output, with entries sorted down the columns; for Is, this is the default when
output is to a terminal.

-F

Mark directories with a trailing slash (I), executable files with a trailing asterisk (*), symbolic
links with a trailing at-sign (@), and AF_UNIX domain sockets with a trailing equals sign (=).

-L

If argument is a symbolic link, list the file or directory the link: references rather than the link
itself.

-R

Recursively list subdirectories encountered.

INTERPRETATION OF LISTING
The mode printed under the -I option contains 10 characters interpreted as follows. If the first character is:
d entry is a directory;
b entry is a block-type special file;
c entry is a character-type special file;
I entry is a symbolic link;
p entry is a fifo (a.k.a. "named pipe") special file;
s entry is an AF_ UNIX domain socket, or
entry is a plain file.

The next 9 characters are interpreted as three sets of three bits each. The first set refers to owner permissions; the next refers to permissions to others in the same user-group; and the last refers 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. The permissions are indicated as follows:
r the file is readable;
w the file is writable;
x the file is executable;
the indicated permission is not granted.
The group-execute permission character is given as s if the file has the set-group-id bit set; likewise the
owner-execute permission character is given as s if the file has the set-user-id bit set.
The last character of the mode (normally x or -) is t if the 1000 bit of the mode is on. See c hmod (1 V) for
the meaning of this mode. The indications of set-ID and 1000 bits of the mode are capitalized (S and T
respectively) if the corresponding execute permission is not set
When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks is
printed.
FILES

fetclpasswd
fetc/group

to get user id's for Is -I and Is -0.
to get group id's for Is -g and lusr/5bin/Is-1.

fusrflibfterminfof*
to get terminal information for lusrISbin/ls.
BUGS

Newline and tab are considered printing characters in filenames.

242

Last change: 17 July 1986

Sun Release 3.2

LS( IV)

USER COMMANDS

LS( IV)

The output device is assumed to be 80 columns wide.
The option setting based on whether the output is a teletype is undesirable as 'Is -s' is much different than
'Is -s Ilpr'. On the other hand, not doing this setting would make old shell scripts which used Is almost
certain losers.
None of the above apply to lusr/5binlIs.
Unprintable characters in file names may confuse the columnar output options.

Sun Release 3.2

Last change: 17 July 1986

243

M4( IV)

USER COMMANDS

M4( IV)

NAME
~4-fJUacroprocessor

SYNOPSIS
m4 [filename] ...
SYSTEM V SYNOPSIS
m4 [ -es ] [ -B int] [ -H int] [ -S int] [ -Tint] '[ -Dname=val ] [ -Uname ] [filename ] ...
DESCRIPTION
m4 is a fJUacro processor intended as a front end for Ratfor, C, and other languages. Each of the argufJUent
files is processed in order; if there are no files, or if a file name is -, the standard input is read. The processed text is written on the standard output.

Macro calls have the form:

name(argJ[, arg2, ... ,] argn)
The '(' fJUust iffifJUediately follow the name of the fJUacro. If the name of a defined fJUacro is not followed by
a '(" it is interpreted as a call of the fJUacro with no argufJUents. Potential ~acro names consist of letters,
digits, and underscores L), where the first character is not a digit.
Leading unquoted blanks, tabs, and NEWLINEs are ignored while collecting argufJUents. Left and right single quotes (, ,) are used to quote strings. The value of a quoted string is the string stripped of the quotes.
When a ~acro name is recognized, its argufJUents are collected by searching for a matching right
parenthesis. If fewer arguments are supplied than are in the fJUacro definition, the trailing arguments are
taken to be null. Macro evaluation proceeds nOffJUally during the collection of the arguments, and any co~­
mas or right parentheses which happen to tum up within the value of a nested call are as effective as those
in the original input text. After argufJUent collection, the value of the fJUacro is pushed back onto the input
streafJU and rescanned.
Built-In Macros
m4 fJUakes available the following built-in fJUacros. They may be redefined, but once this is done the original fJUeaning is lost. Their values are null unless otherwise stated.

define

the second argufJUent is installed as the value of the fJUacro whose name is the first argu~ent.
Each occurrence of $n in the replacefJUent text, where n is a digit, is replaced by the n'th
argument. Argument 0 is the name of the macro; missing arguments are replaced by the
null string.

undefine

refJUoves the definition of the fJUacro named in its argument.

ifdef

if the first argufJUent is defined, the value is the second argu~ent, otherwise the third. If
there is no third argufJUent, the value is null. The word unix is predefined.

changequote change quote characters to the first and second argufJUents. cbangequote without argu~ents
restores the original values (i.e.,' ,).

244

divert

m4 fJUaintains 10 output streafJUS, numbered 0-9. The final output is the concatenation of the
streams in nUfJUerical order; initially stream 0 is the current stream. The divert fJUacro
changes the current output stream to its (digit-string) argufJUent. Output diverted to a stream
other than 0 through 9 is discarded.

undivert

causes immediate output of text frofJU diversions named as argufJUents, or all diversions if no
argument. Text fJUay be undiverted into another diversion. Undiverting discards the
diverted text.

divnum

returns the value of the current output stream.

dnl

reads and discards characters up to and including the next newline.

ifelse

has three or fJUore arguments. If the first argument is the same string as the second, then the
value is the third argument. If not, and if there are fJUore than four arguments, the process is

Last change: 17 July 1986

Sun Release 3.2

M4(lV)

USER COMMANDS

M4( IV)

repeated with arguments 4, 5, 6, 7 and so on. Otherwise, the value is either the last string
not used by the above process, or, if it is not present, null.

iner

returns the value of its argument incremented by 1. The value of the argument is calculated
by interpreting an initial digit-string as a decimal number.

eval

evaluates its argument as an arithmetic expression, using 32-bit arithmetic. Operators
include +, -, *, /, %, (exponentiation); relationals; parentheses.
A

len

returns the number of characters in its argument.

index

returns the position in its first argument where the second argument begins (zero origin), or
-1 if the second argument does not occur.

substr

returns a substring of its first argument. The second argument is a zero origin number
selecting the first character; the third argument indicates the length of the substring. A missing third argument is taken to be large enough to extend to the end of the first string.

translit

transliterates the characters in its first argument from the set given by the second argument
to the set given by the third No abbreviations are permitted.

include

returns the contents of the file named in the argument

sinclude

is similar to include, except that it says nothing if the file is inaccessible.

sysemd

executes the UNIX system command given in the first argument. No value is returned.

maketemp

fills in a string of XXXXX in its argument with the current process ID.

errprint

prints its argument on the diagnostic output file.

dumpdef

prints current names and definitions, for the named items, or for all if no arguments are
given.

SYSTEM V DESCRIPTION
In the System V version of m4, the following built-in macros have added capabilities.

define

$# is replaced by the number of arguments; $* is replaced by a list of all the arguments
separated by commas; $@ is like $*, but each argument is quoted (with the current quotes).

ehangequote change quote symbols to the first and second arguments. The symbols may be up to five
characters long.

eval

Additional operators include bitwise &, I, A, and -. Octal, decimal and hex numbers may be
specified as in C. The second argument specifies the radix for the result; the default is 10.
The third argument may be used to specify the minimum number of digits in the result

The System V version of m4 makes available the following additional built-in macros.

defn

returns the quoted definition of its argument(s). It is useful for renaming macros, especially
built-ins.

pushdef

like define, but saves any previous definition.

popdef

removes current definition of its argument(s), exposing the previous one, if any.

shift

returns all but its first argument. The other arguments are quoted and pushed back with
commas in between. The quoting nullifies the effect of the extra scan that will subsequently
be performed.

ehangeeom

change left and right comment markers from the default # and NEWLINE. With no arguments, the comment mechanism is effectively disabled. With one argument, the left marker
becomes the argument and the right marker becomes NEWLINE. With two arguments, both
markers are affected. Comment markers may be up to five characters long.

deer

returns the value of its argument decremented by 1.

sysval

is the return code from the last call to syscmd.

Sun Release 3.2

Last change: 17 July 1986

245

M4(1V)

USER COMMANDS

M4( IV)

m4exit

causes immediate exit from m4. Argument 1, if given, is the exit code; the default is O.

m4wrap

argument 1 will be pushed back at final EOF; example: m4wrap(' cleanup()')

traceon

with no arguments, turns on tracing for all macros (including built-ins). Otherwise, turns on
tracing for named macros.

traceoff

turns off trace globally and for any macros specified. Macros specifically traced by traceon
can be untraced only by specific calls to traceo!!.

SYSTEM V OPTIONS
The options and their effects are as follows:

-e

Operate interactively. Interrupts are ignored and the output is unbuffered.

-s

Enable line sync output for the C preprocessor (#line ... )

-Bint

Change the size of the push-back and argument collection buffers from the default of 4,096.

-Hint

Change the size of the symbol table hash array from the default of 199. The size should be prime.

-Sint

Change the size of the call stack from the default of 100 slots. Macros take three slots, and nonmacro arguments take one.

-Tint

Change the size of the token buffer from the default of 512 bytes.

To be effective, these flags must appear before any file names and before any -D or -U flags:

-Dname[=val]
Defines name to be valor to be null in val's absence.
-Uname
undefines name .
SEE ALSO

M4 -A Macro Processor, in Programming Utilitiesfor the Sun Workstation.

246

Last change: 17 July 1986

Sun Release 3.2

MACH ( 1)

USER COMMANDS

MACH ( 1)

NAME

mach - display the processor type of the current host
SYNOPSIS

mach
DESCRIPTION

The mach command displays the processor-type of the current Sun host
SEE ALSO

arch(l), machid(l)

Sun Release 3.2

Last change: 29 May 1986

247

MACHID( 1)

USER COMMANDS

MACHID(I)

NAME

machid, sun, iAPX286, m68k, pdp11, u3b, u3b2, u3b5, vax - provide truth value about your processor type
SYNOPSIS

sun
iAPX286
m68k
pdp11

u3b
u3b2
u3bS
vax
DESCRIPTION

The following commands will return a true value (exit code of 0) if you are on a processor that the command name indicates.
sun

True if you are on a Sun.

iAPX286
True if you are on a computer using an iAPX286 processor.
m68k True if you are on a computer using an MC68000-farnily processor.
pdp11 True if you are on a PDP-l1.

u3b

True if you are on a 3B 20S computer.

u3b2

True if you are on a 3B 2 computer.

u3b5

True if you are on a 3B 5 computer.

vax

True if you are on a VAX.

The commands that do not apply will return a false (non-zero) value. These commands are often used
within make (1) rnakefiles and shell procedures to increase portability.
SEE ALSO

arch(I), mach(I), make(I), sh(I), test(IV), true(l)

248

Last change: 6 June 1986

Sun Release 3.2

MAIL ( 1)

USER COMM:ANDS

MAIL(l)

NAME

mail, Mail- interactive message-processing system
SYNOPSIS

Mail [ -d ] [ -e ] [ -f [filename I +folder ] ] [ -H ] [ -i ] [ -n] [ -N ] [ - T file] [ -u user] [ -U] [ -v ]
Mail [ -d ] [ -F] [ -b nwnber ] [ -i ] [ -0] [ -r address] [ -s subject] [ -U ] [ -v ] recipient . ..
/usr/ueb/mail ...
DESCRIPTION

mail provides a comfortable, flexible environment for sending and receiving electronic messages. While
reading mail, mail provides commands to browse, display, save, delete, and respond to messages. While
sending mail, mail allows editing and reviewing of a message being composed, and the inclusion of text
from files or other messages.
Incoming mail is stored in a standard file for each user, called the system mailbox for that user. When mail
is called to read messages, the system mailbox is the default place to find them. As messages are read, they
are marked to be moved to a secondary file for storage (unless specific action is taken), so that the messages need not be seen again. This secondary file, called the mhox, is normally the file .mbox in the user's
home directory, but can be changed by setting the MBOX variable. Messages remain in this file until forcibly removed
OPTIONS

If no recipient is specified, mail attempts to read messages from the system mailbox.
-d

Turn on debugging output (Neither particularly interesting nor recommended.)

-e

Test for presence of mail. If there is no mail, mail prints nothing and exits (with a successful return code).

-f [filename]

Read messages from filename instead of system mailbox. If no filename is specified, the
mbox is used.

-f [ + folder]

Use the filefolder in the folder directory (same as the folder command). The name of this
directory is listed in the folder variable.

-F

Record the message in a file named after the first recipient Overrides the record variable, if set.

-b number

The number of network 'hops' made so far. This is provided for network software to
avoid infinite delivery loops.

-H

Print header summary only.

-i

Ignore interrupts (as with the ignore variable).

-n

Do not initialize from the system default MaiI.re file.

-N

Do not print initial header summary.

-r address

Pass address to network delivery software. All tilde commands are disabled.

-s subject

Set the Subject header field to subject.

- T file

Print the contents of the article-id fields of all messages that were read or deleted on file
(for the use of network news programs if available).

-u user

Read user's system mailbox. This is only effective if user's system mailbox is not read
protected.

-U

Convert uucp style addresses to Internet standards. Overrides the eonv environment variable.

-v

Pass the -v flag to sendmail (8).

Sun Release 3.2

Last change: 17 July 1986

249

MAll.. ( 1)

USER COMMANDS

MAll.. ( 1)

USAGE

Refer to Mail and Messages: Beginner's Guide for tutorial information about mail.
Starting Mail

As it starts, mail reads commands from a system-wide file (/usr/liblMaiI.re) to initialize certain variables,
then it reads from from a private start-up file called the .mailrc file (it is normally the file .mailre in your
home directory, but can be changed by setting the MAILRC environment variable) for your personal commands and variable settings. Most mail commands are legal inside start-up files. The most common uses
for this file are to set up initial display options and alias lists. The following commands are not legal in the
start-up file: !, Copy, edit, followup, Followup, hold, mail, preserve, reply, Reply, replyall, replysender,
shell, and visual. Any errors in the start-up file cause the remaining lines in that file to be ignored.
You can use the mail command to send a message directly by including names of recipients as arguments
on the command line. When no recipients appear on the mail command line, it enters command mode,
from which you can read messages sent to you. If you list no recipients and have no messages, mail prints
the message: "No mail for username" and exits.
When in command mode (while reading messages), you can send messages using the mail command.
Sending Mall

While you are composing a message to send, mail is in input mode. If no subject is specified as an argument to the command a prompt for the subject is printed. Mter entering the subject line, mail enters input
mode to accept the text of your message to send
As you type in the message, mail stores it in a temporary file. To review or modify the message, enter the
appropriate tilde escapes, listed below, at the beginning of an input line.

To indicate that the message is ready to send, type a dot (or end-of-file character, normally AD) on a line by
itself. mail submits the message to sendmail (8) for routing to each recipient.
Recipients can be local usernames, Internet addresses of the form:
name@domain
uucp(lC) addresses of the form:
. .. [host!]host!username

filenames, folders or alias groups. If the name of the recipient begins with a pipe symbol (I), the
remainder of the name is taken as a shell command to pipe the message through. This provides an
automatic interface with any program that reads the standard input, such as Ipr(l) to record outgoing mail
on paper. An alias group is the name of a list of recipients that is set by the alias command, taken from the
host's lusr/lib/aliases file, or taken from the Yellow Pages aliases domain. See addresses(5) for more
information about mail addresses and aliases.
Tllde Escapes

The following tilde escape commands can be used when composing messages to send. Each must appear
at the beginning of an input line. The escape character (-), can be changed by setting a new value for the
escape variable. The escape character can be entered as text by typing it twice.

-! [shell-command]
Escape to the shell. If present, run shell-command.
Simulate end of file (terminate message input).
-: mail-command
- mail-command
Perform the indicated mail command. Valid only when sending a message while reading mail.

250

-?

Print a summary of tilde escapes.

-A

Insert the autograph string Sign into the message.

a

Insert the autograph string sign into the message.

Last change: 17 July 1986

Sun Release 3.2

MAIL ( 1)

USER COMMANDS

MAIL(I)

-bname ...
Add the names to the blind carbon copy (Bcc) list. This is like the carbon copy (Cc) lis4 except
that the names in the Bcc list are not shown in the header of the mail message.
cname ...
Add the names to the carbon copy (Cc) list.
-dRead in the dead.letter file. The name of this file is listed in the variable DEAD.
e

Invoke the editor to edit the message. The name of the editor is listed in the EDITOR variable.
The default editor is ex(l}.

-r [message-list]
Forward the listed messages, or the current message being read. Valid only when sending a message while reading mail; the messages are inserted without alteration (as opposed to the - m
escape).
-h

Prompt for the message header lines: Subject, To, Cc, and Bcc. If the header line contains text,
you can edit the text by backspacing over it and retyping.

-i variable
Insert the value of the named variable into the message.
- m [message-list]

Insert text from the specified messages, or the current message, into the letter. Valid only when
sending a message while reading mail; the inserted text is shifted to the right by one tab stop.
p

Print the message being entered.

q

Quit from input mode by simulating an interrupt If the body of the message is not empty, the partial message is saved in the dead. letter file.

-r filename
- ' in the header summary. For commands that take an optional list of messages, if you omit a message number as an argumen4 the command applies to the current message.

Sun Release 3.2

Last change: 17 July 1986

251

MAa(I)

USER COMMANDS

MAIL(I)

A message-list is a list of message specifications, separated by spaces, which may include:
The current message.
Message number n.
The first undeleted message.
S
The last message.
+
The next undeleted message.
The previous undeleted message.
*
All messages.
n-m
An inclusive range of message numbers.
user
All messages from user.
I string All messages with string in the subject line (case ignored).
:c
All messages of type c, where c is one of:
d
deleted messages
n
new messages
o
old messages
r
read messages
u
unread messages
Note that the context of the command determines whether this type of message
specification makes sense.
n

Additional arguments are treated as strings whose usage depends on the command involved. Filenames,
where expected, are expanded using the normal shell filename-substitution mechanism.
Special characters, recognized by certain commands, are documented with those commands.
Commands

While in command mode, if you type in an empty command line (a carriage-return or NEWLINE only), the
print command is assumed. The following is a complete list of mail commands:

! shell-command

Escape to the shell. The name of the shell to use is listed in the SHELL variable.

# comment

Null command (comment). This may be useful in .mailrc files.

=

Print the current message number.

?

Prints a summary of commands.

alias [alias recipient ... ]
group [alias recipient ... ]
Declare an alias for the given list of recipients. The list will be substituted when the
alias is used as a recipient while sending mail. When put in the .mailrc file, this
command provides you with a record of the alias. With no arguments, the command
displays the list of defined aliases.
alternates name. . .

cd[ directory]
chdir [directory]

Declares a list of alternate names for your login. When responding to a message,
these names are removed from the list of recipients for the response. With no arguments, alternates prints the current list of alternate names.
Change directory. If directory is not specified, $HOME is used.

copy [message-list] [filename]
Copy messages to the file without marking the messages as saved. Otherwise
equivalent to the save command.
Copy [message-list] Save the specified messages in a file whose name is derived from the author of the
message to be saved, without marking the messages as saved. Otherwise equivalent
to the Save command.

252

Last change: 17 July 1986

Sun Release 3.2

MAIL ( 1)

USER COMMANDS

MAIL(1)

delete [message-list] Delete messages from the system mailbox. If the variable autoprint is set, print the
message following the last message deleted.
discard [header-field ... ]
ignore [header-field ... ]
Suppress printing of the specified header fields when displaying messages on the
screen, such as "Status" and "Received". The fields are included when the message
is saved unless the variable alwaysignore is set The Print and Type commands
display all header fields, ignored or not
dp [message-list]
dt [message-list]

Delete the specified messages from the system mailbox, and print the message after
the last one deleted. Equivalent to a delete command followed by a print command.

echo [string ... ]

Echo the given strings (like echo (1V».

edit [message-list]

Edit the given messages. The messages are placed in a temporary file and the
EDITOR variable is used to get the name of the editor. The default editor is ex(1).

exit
xit
file [filename]
folder [filename]

Exit from mail without changing the system mailbox. No messages are saved in the
mbox (see also quit).
Quit from the current mailbox file and read in the named mailbox file. Several special characters are recognized when used as file names:
%
Your system mailbox.
% user
The system mailbox for user.
#
The previous mail file.
&
Your mbox file (of messages previously read).
+filename The named file in the/older directory (listed in the folder variable).
With no arguments, file prints the name of the current mail file, and the number of
messages and characters it contains.

folders

Print the name of each mail file in the/older directory (listed in the folder variable).

followup [message]

Respond to a message, recording the response in a file, name of which is derived
from the author of the message (overrides the record variable, if set). See also the
Followup, Save, and Copy commands and the outfolder variable.

Followup [message-list]
Respond to the first message in the message list, sending the message to the author of
each message in the list. The subject line is taken from the first message, and the
response is recorded in a file, the name of which is derived from the author of the
first message (overrides the record variable, if set). See also the followup, Save, and
Copy commands and the outfolder variable.
from [message-list]

Print the header summary for the indicated messages or the current message.

group alias name. .. Same as the alias command.
headers [message]

Prints the page of headers that includes the message specified, or the current message. The screen variable sets the number of headers per page. See also the z command.

help

Prints a summary of commands.

hold [message-list]
preserve [message-list]
Holds the specified messages in the system mailbox.

Sun Release 3.2

Last change: 17 July 1986

253

MAIL ( 1)

USER COMMANDS

MAIL(I)

ifslrlt
mail-command

else
mail-command
endif

Conditional execution, where s will execute following mail-command up to an else
or emlif, if the program is in send mode, r executes the mail-command only in
receive mode, and t executes the mail-command only if mail is being run from a terminal. Useful primarily in the .mailrc file.

ignore [header-fteld . .. ]
Same as the discard command.
list

Prints all commands available. No explanation is given.

mail recipient . ..

Mail a message to the specified recipients.

mbox [message-list] Arrange for the given messages to end up in the standard mbox file when mail terminates normally. See also the exit and quit commands.
new [message-list]
New [message-list]
unread [message-list]
Unread [message-list]
Takes a message list and marks each message as not having been read.
next message

Go to next message matching message. A message-list can be given instead of message, but only first valid message in the list is used. (This can be used, for instance,
to jump to the next message from a specific user.)

pipe [message-list] [shell-command]
[shell-command]
Pipe the message through shell-command. The message is treated marked as read
(and normally saved to the mbox file when mail exits). If no arguments are given,
the current message is piped through the command specified by the value of the cmd
variable. If the page variable is set, a form feed character is inserted after each message.

I [message-list]

preserve [message-list]
Same as the hold command.
print [message-list]
type [message-list]

Print the specified messages. If the crt variable is set, messages longer than the
number of lines it indicates paged through the command specified by the PAGER
variable. The default paging command is more (1).

Print [message-list]
Type [message-list] Print the specified messages on the screen, including all header fields. Overrides
suppression of fields by the ignore and retain commands.
quit

Exit from mail storing messages that were read in the mbox file and unread messages
in the system mailbox. Messages that have been explicitly saved in a file are deleted
unless the variable keepsave is set.

reply [message-list]
respond [message-list]
replysender [message-list]
Send a response to the author of each message in the message-list. The subject line
is taken from the first message. If record is set to a filename, a copy of the the reply
is added to that file. If the replyaU variable is set, the actions of Reply/Respond and

254

Lastchange: 17 July 1986

Sun Release 3.2

MAIL(1)

USER COMMANDS

MAIL(1)

reply/respond are reversed. The repJysender command is not affected by the
repJyalI variable, but sends each reply only to the sender of each message.
Reply [message]
Respond [message]
replyall [message]

retain

Reply to the specified message, including all other recipients of that message. If the
variable record is set to a filename, a copy of the reply added to that file. If the
replyalI variable is set, the actions of Reply/Respond and reply/respond are
reversed. The replyall command is not affected by the repJyaU variable, but always
sends the reply to all recipients of the message.
Add the list of header fields named to the retained list. Only the header fields in the
retain list are shown on your tenninal when you print a message. All other header
fields are suppressed. The set of retained fields specified by the retain command
overrides any list of ignored fields specified by the ignore command The Type and
Print commands can be used to print a message in its entirety. If retain is executed
with no arguments, it lists the current set of retained fields.

save [message-list] ffilename]
Save the specified messages in the named file. The file is created if it does not exist.
If no filename is specified, the file named in the MBOX variable is used, mbox in
your home directory by default. Each saved message is deleted from the system
mailbox when mail terminates unless the keepsave variable is set. See also the exit
and quit commands.
Save [message-list]

Save the specified messages in a file whose name is derived from the author of the
first message. The name of the file is taken from the author's name, with all network
addressing stripped off. See also the Copy, followup, and Followup commands and
the outfolder variables.

set [variable [=value ] ]
Define a variable. To assign a value to variable, separate the variable name from
the value by an equal-sign (=) (there must be no space before or after the =). A variable may be given a null, string, or numeric value. To embed spaces within a value
enclose it in quotes.
With no arguments, set displays all defined variables and any values they might
have. See Variables for a description of all predefined mail variables.
shell

Invoke the interactive shell listed in the SHELL variable.

size [message-list]

Print the size in characters of the specified messages.

source filename

Read commands from the given file and return to command mode.

top [message-list]

Print the top few lines of the specified messages. If the toplines variable is set, it is
taken as the number of lines to print. The default number is 5.

touch [message-list] Touch the specified messages. If any message in message-list is not specifically
saved in a file, it will be placed in the mbox upon normal termination. See also the
exit and quit commands.

type [message-list]

Same as the print command

Type [message-list]

Same as the Print command.

undelete [message-list]
Restore deleted messages. This command only restores messages deleted in the
current mail session. If the autoprint variable is set, the last message restored is
printed.

Sun Release 3.2

Last change: 17 July 1986

255

MAIL(I)

USER COMMANDS

MAIL(l)

unread [message-list]
Unread [message-list]
Same as the new command.
Erases the specified variables. If the variable was imported from the environment
(that is, an environment variable or exported shell variable), it cannot be unset from
within mail.
version
Prints the current version and release date of the mail utility.
visual [message-list] Edit the given messages with the screen editor listed in the VISUAL variable. The
default screen editor is vi(1). Each message is placed in a temporary file for editing.
write [message-list] [filename]
Write the given messages onto the specified file, but without the header and trailing
blank line. Otherwise, this is equivalent to the save command.
xit
Same as the exit command.
Scroll the header display forward (+) or backward (-) one screenfull. The number
z[+I-]
of headers displayed is set by the screen variable.
Forwarding Messages
To forward a specific message, include it in a message to the desired recipients with the -f or - m tilde
escapes. To forward mail automatically, add the addresses of additional recipients to the .forward file in
your home directory. Note that forwarding addresses must be valid, or the messages will "bounce." (You
cannot, for instance, reroute your mail to a new host by forwarding it to your new address if it is not yet
listed in the yP aliases domain.)
Variables
The behavior of mail is governed by a set of predefined variables that are set and cleared using the set and
unset commands. Values for the following variables are read in automatically from the environment; they
cannot be altered from within mail:
HOME=direetory
The user's home directory.
MAILRC=filename
The name of the personal start-up file. The default is $HOMEI.maiIrc.
Below are listed the remaining predefined variables recognized by mail. Each can be initialized within the
.mailre file, or set and altered at any time while in mail, using the set command. They can also be imported
from the environment (in which case their values cannot be changed within mail). The unset command
clears variables. The set command can also be used to clear a variable by prefixing the word no to the name
of the variable to clear.
Variables for which values are normally supplied are indicated with an equal-sign (=). The equal-sign is
required by the set command, and there can be no spaces between the variable-name, equal-sign, and value,
using set to assign a value.
alInet
All network names whose last component (login name) match are treated as identical.
This causes the message list specifications to behave similarly. Default is noallnet. See
also the alternates command and the metoo variable.
alwaysignore Ignores header fields with ignore everywhere, not just during print or type. Affects the
save, Save, copy, Copy, top, pipe, and write commands, and the -m and -f tilde escapes.
Upon termination, append messages to the end of the mbox file instead of prepending
append
them. Default is noappend but append is set in the global start-up file (which can be
suppressed with the -n command line option).
Prompt for the Cc list after message is entered. Default is noaskcc.
askcc
Prompt for subject if it is not specified on the command line with the -s option. Enabled
asksub
by default.
Enable automatic printing of messages after delete and undelete commands. Default is
autoprint
noautoprint.
Enable the special-casing of exclamation points (!) in shell escape command lines as in
bang
vi. Default is nobang.
cmd=shell-eommand
unset variable . ..

256

Last change: 17 July 1986

Sun Release 3.2

MAIL ( 1)

USER COMMANDS

MAIL(I)

Set the default command for the pipe command. No default value.
conv=conversion

crt=number

Convert uucp addresses to the specified address style. The only valid conversion now is
internet, which requires a mail delivery program conforming to the RFC822 standard for
electronic mail addressing. Conversion is disabled by default. See also sendmail and the
-U command line option.
Pipe messages having more than number lines through the command specified by the
value of the PAGER variable (more by default). Disabled by default.

DEAD=filename

The name of the file in which to save partial letters in case of untimely interrupt or
delivery errors. Default is the file dead.Ietter in your horne directory.
debug
Enable verbose diagnostics for debugging. Messages are not delivered. Default is nodebug.
dot
Take a period on a line by itself during input from a terminal as end-of-file. Default is
nodot but dot is set in the global start-up file (which can be suppressed with the -n command line option).
EDITOR=shell-command
The command to run when the edit or - e command is used. Default is ex(I).
escape=c
Substitute c for the - escape character.
folder=directory
The directory for saving standard mail files. User specified file names beginning with a
plus (+) are expanded by preceding the filename with this directory name to obtain the
real filename. If directory does not start with a slash (I), the value of HOME is prepended
to it. There is no default for the folder variable. See also outfolder below.
Enable printing of the header summary when entering mail. Enabled by default.
header
Preserve all messages that are read in the system mailbox instead of putting them in the
hold
standard mbox save file. Default is nohold.
Ignore interrupts while entering messages. Handy for noisy dial-up lines. Default is
ignore
noignore.
ignoreeof
Ignore end-of-file during message input Input must be terminated by a period (.) on a
line by itself or by the -. command. Default is noignoreeof. See also dot above.
keep
When the system mailbox is empty, truncate it to zero length instead of removing it. Disabled by default.
keepsave
Keep messages that have been saved in other files in the system mailbox instead of deleting them. Default is nokeepsave.
LISTER=shell-command
The command (and options) to use when listing the files in the folder directory. The
default is Is (1 V).
MBOX=filename
The name of the file to save messages which have been read. The xit command overrides
this variable, as does saving the message explicitly to another file. Default is the file
mbox in your horne directory.
If your login appears as a recipient, do not delete it from the list. Default is nometoo.
metoo
When used as a prefix to a variable name, has the effect of unsetting the variable.
no
When responding to a message that was originally sent to several recipients, the other
one hop
recipient addresses are normally forced to be relative to the originating author's machine
for the response. This flag disables alteration of the recipients' addresses, improving
efficiency in a network where all machines can send directly to all other machines (that is,
one hop away).
outfolder
Locates the files used to record outgoing messages in the directory specified by the folder
variable unless the pathname is absolute. Default is nooutfolder. See folder above and
the Save, Copy, followup, and Followup commands.
page
Used with the pipe command to insert a form feed after each message sent through the

Sun Release 3.2

Last change: 17 July 1986

257

MAIL(I)

USER COMMANDS

MAIL(I)

pipe. Default is nopage.
PAGER=shell-command
The command to use as a filter for paginating output, along with any options to be used
Default is more(I).
prompt=string Set the command mode prompt to string Default is &.
quiet
Refrain from printing the opening message and version when entering mail Default is
noquiet.
record=filename
Record all outgoing mail in filename. Disabled by default. See also the variable outfolder.
replyaU
Reverses the effect of the reply and Reply commands.
save
Enable saving of messages in the dead.letter file on interrupt or delivery error. See DEAD
for a description of this file. Enabled by default
screen=number Sets the number of lines in a screen-full of headers for the headers command.
sendmail=shell-command
Alternate command for delivering messages. Default is sendmail (8).
sendwait
Wait for background mailer to finish before returning. Default is nosendwait.
SHELL=shell-command
The name of a preferred command interpreter. Typically inherited from the environment,
the shell is normally the one you always use. Otherwise defaults to sh(I).
When displaying the header summary and the message is from you~ print the recipient's
showto
name instead of the author's name.
sign=autograph The autograph text inserted into the message when the -a (autograph) command is given.
No default (see also the -i tilde escape).
Sign=autograph The autograph text inserted into the message when the -A command is given. No default
(see also the -i tilde escape).
toplines=number
The number of lines of header to print with the top command. Default is 5.
verbose
Invoke sendmail with the -v flag.
VISUAL=shell-command
The name of a preferred screen editor. Default is vi.
FILES

$HOME/.mailrc
$HOMEI forward
$HOMElmbox
$HOMEIdead. letter
lusrlspoollmail
lusrllibIMail.help*
lusrlliblMail.rc
ItmplR[emqsxl*

personal start-up file
list of recipients for automatic forwarding of messages
secondary storage file
undeliverable messages file
directory for system mailboxes
help message files
global start-up file
temporary files

SEE ALSO

binmail(I), mailtool(l) sendmail(8), biff(I), fmt(I), addresses(5), newaliases(8), vacation(l)
mail is found in lusr/ucblMail, as a link to lusr/ucb/mail. If you wish to use the original (version 7)
UNIX mail program, you can find it in !bin/mail. Its man page is named binmail (1).
BUGS

Where shell-command is shown as valid, arguments are not always allowed. Experimentation is recommended.
Internal variables imported from the execution environment cannot be unset
Replies do not always generate correct return addresses. Try resending the errant reply with onebop set.
mail does not lock your record file. So, if you use a record file and send two or more messages simultaneously, lines from the messages may be interleaved in the record file.

258

Last change: 17 July 1986

Sun Release 3.2

MAILTOOL ( 1 )

USER COMMANDS

MAILTOOL ( 1 )

NAME

mailtool - window- and mouse-based interface for mail
SYNOPSIS
mailtool [ -x ] [ -i seconds ]
DESCRIPTION

mailtool is a standard tool provided with the SunView environment.
mailtool manages your mail in much the same manner as mail, but provides a more convenient and powerful user interface. Scroll able windows allow easy access to your mailbox and mail folders. Software "buttons" make the most frequently used commands readily available. Less used commands are accessable
from menus and keyboard accelerators are provided for the more experienced user. The full editing capabilities of textedit(l) and the SunView selection service are available for modifying and composing mail.
In addition, the behavior of mailtool may be customized by setting parameters with defaultsedit(l). Users
who are not familiar with the mail program should read Mail and Messages: Beginner's Guide. For more
information on mailtool, text editing, and use of the selection service see Windows and Window-Based
Tools: Beginner's Guide.
OPTIONS

-x

expert mode - don't ask for confirmation after potentially damaging mail commands; off by
default

-i seconds
interval- check for new mail every seconds seconds - default is 300 (5 minutes)
mailtool also accepts all of the generic tool arguments discussed in suntools(I).
SUBWINDOWS

mailtool consists of four scrollable subwindows. From top to bottom they are:
header

a read-only text subwindow which lists the header information (From: and Subject: and so
on) for mail messages in the current folder or system mailbox

command

a panel subwindow with software buttons corresponding to the most frequently used mail
commands, and two text items for directory and file names

message

a text subwindow that allows reading and the editing of messages that you have received

composition

a text subwindow in which to compose and reply to messages (this subwindow appears only
when composing or replying)

COMMAND BUTTONS
All buttons except next and undelete operate on the currently selected message. To select a message, make
a selection anywhere on the line in the header subwindow corresponding to the desired message. This is
accomplished by positioning the cursor anywhere on the line, and clicking the select mouse button (the
leftmost one).

The set of command buttons in the command panel is as follows.
abort

quit the tool without modifying your system mailbox

cd

change to the directory specified in the Directory: text field

cancel

abort the message being composed in the composition subwindow

commit

commit changes to your system mailbox or the current folder

compose

open the composition subwindow to compose (or forward - see below) a message

copy

copy the selected message to the file or folder specified in the File: text field

deliver

send the message being composed in the composition subwindow

delete

delete the selected message

done

commit changes, close the tool, and read new mail on next open

Sun Release 3.2

Last change: 1 May 1986

259

MAILTOOL ( 1 )

USER COMMANDS

MAILTOOL ( 1 )

folder

commit changes and switch to the file or folder specified in the File: text field

new mail

commit changes and reread the system mailbox to see new mail

next

show the next message in the message subwindow

preserve

hold the selected message in the system mailbox after the next commit

print

print the selected message on a hardcopy printer

quit

commit changes and quit the tool

reply

open the composition subwindow to reply to the selected message

save

save the selected message in the file or folder specified in the File: text field

show

show the selected message in the message subwindow

undelete

undelete the most recently deleted message(s) - this may be used repeatedly

.mailrc

source your -/.mailrc file and thereby aquire the current option settings

COMMAND MENUS

All buttons in the command panel have menus behind them. Depress the right mouse button over a command button to see its menu. Variations on a button command or related commands in mailtool have been
grouped on these menus. For example, the reply buttton has menu items that reply to all recipients of the
original message, reply including the original message, and reply to all recipients including the message.
The compose button has the function forward grouped with it. All menus have corresponding keyboard
acclerators - i.e. you may hold down a key while clicking the left mouse button to achieve the same effect
without popping-up the menu. Two keys are used: SHIff and CTRL. In general, if a command has an
"inverse" function like reversed direction, the SHIFf key is used, and CfRL is used to "strengthen" a command or invoke a related function. When a menu has actions corresponding to all four combinations of
SHIFf and CfRL, the order of the menu items is as follows:
simply clicking on the command button,
holding SHIFf while clicking on the button,
holding CfRL while clicking on the button,
holding both SHIff and CTRL when clicking on the button.
With this organization of commands, the keyboard accelerators for these command menu items may be
quickly learned. Simply browse the button menus to discover what additional commands are available.
There are two special file menus in the command panel. The menu behind the folder button will show you
all your folders. The menu behind the File: text field holds the most recently used file (and folder) names.
Selecting a name from these menus replaces the contents of the File: item just as if you typed the name.
This name is used for the save, copy, and folder commands. Folder names are of the form +folder and are
relative to the directory specified by the mail's folder variable. Filenames typed into the File: field are
relative to the directory specified in the Directory: field.
To switch to a folder, select it from one of the file menus or type directly into the File: text field, and press
the folder button. To return to your system mailbox, use the new mail button.
MAIL VARIABLES

mailtool interprets several variables in addition to those of mail. All can be set in your .mailrc file by using
defaultsedit(1).
allowreversescan allows you to work through your mailbox in the reverse, as well as forward, directions.
This will affect which message is next - if the sense of direction is reverse then the
message displayed by next is actually the previous one.

260

autoprint

display the next message when the current message is deleted or saved

bell

number of times to ring the bell when new mail arrives

cmdlines

number of lines in command panel

expert

sets expert mode - no confirmations required (same as the -x flag)

Last change: 1 May 1986

Sun Release 3.2

USER COMMANDS

MAILTOOL ( 1 )

MAILTOOL ( 1 )

filemenu

list of files to initialize the File: menu, (e.g. "+mbox +trash")

filemenusize

specifies the maximum size of the File: menu

Hash

number of times to flash the window or icon when new mail arrives

headerlines

number of lines in header sub window

interval

interval in seconds to check for new mail (same as the -i flag)

maillines

number of lines in mail message subwindow

msgpercent

percent of the message sub window to remain visible during a reply or compose

printmail

the command to use when printing mail- the default is lpr -po

trash

name of trash bin (if set to "+trash", this may be accessed like any other folder)

H the trash variable is set, all deleted messages will be moved to the trash bin. You can look at the trash
bin as with any other folder by typing its name to the File: item and hitting the folder button. The trash bin
is emptied when you hit done.
In addition, you can make your .mailrc conditionally set mail variables depending on whether it is running
in the tty environment or the window environment. The command if t tests if you are in the tty environment For example:

ift
else
set autoprint
cd
endif
will set the variable autoprint and change to your home directory when mail is started in the Sun View
environment.
FILES

lusr/spool/mail/·
-I.mailrc

post office
file giving initial mail commands

SEE ALSO

binmail(I), defaultsedit(I), mail(I), suntools(I), textedit(l)
aliases(5), mailaddr(7), newaliases(8), sendmail(8)
Mail and Messages: Beginner's Guide,
Windows and Window-Based Tools: Beginner's Guide
BUGS

H mail receives an error then mailtool may hang and you must kill it.
New mail status is only approximate, therefore the presence of new mail is not always accurately reflected
in the icon image and tool namestripe.

H you press done and immediately interact with another window, a few interactions may be lost while
mailtool is becoming iconic.

Sun Release 3.2

Last change: 1 May 1986

261

MAKE(l)

USER COMMANDS

MAKE(l)

NAME

make - maintain, update, and regenerate groups of programs
SYNOPSIS

make [ -f makefile ] . .. [-deikmnpqrsStb] [ target. .. ] [ macro-name =value . .. ]
DESCRIPTION

make executes a list of shell commands associated with each target, typically to create or update a file of
the same name. makefile contains entries for targets that describe how to bring them up to date with respect
to the files andlor other targets on which each depends, called dependencies.
A target is out of date when the file it describes is missing, or when one (or more) of its dependency files
has a more recent modification time than that of the target file. make recursively scans the list of dependencies for each target argument (or the first target entry in the makefile if no target argument is supplied)
to generate a list of targets to check. It then checks, from the bottom up, each target against any files it
depends on to see if it is out of date. If so, make rebuilds that target
To rebuild a target, make executes the set of shell commands, called a rule, associated with it This rule
may be listed explicitly in a makefile entry for that target, or it may be supplied implicitly by make.
If no makefile is specified on the command line, make uses the first file it finds with a name from the following list:

makefile, Makefile, s.makefile ~ sMakefile, SCCSls.makefile, SCCSlsMakefile
If no target is specified on the command line, make uses the first target defined in makefile. If a target has
no makefile entry, or if its entry has no rule, make attempts to update that target using an implicit rule.
OPTIONS

-fmakefile
Use the description file makefile. A - as the makefile argument denotes the standard input The
contents of makefile. when present, override the builtin rules. When more than one -f makefile
argument pairs appear, make takes input from each makefile in the order listed (just as if they were
run through cat(IV».

262

-d

Debug mode. Print out detailed information on files and times examined.

-e

Environment variables override assignments within makefiles.

-i

Ignore error codes returned by invoked commands.

-k

When a nonzero error status is returned by an invoked command, abandon work on the current
target but continue with other branches that do not depend on that target

-D

No execution mode. Print commands, but do not execute them. Even lines beginning with an @
are printed. However, if a command line contains the $(MAKE) macro, that line is always executed (see the discussion of MAKEFLAGS in Environment Variables and Macros).

-p

Print out the complete set of macro definitions and target descriptions.

-q

Question mode. make returns a zero or nonzero status code depending on whether or not the target file is up to date.

-r

Do not use the the implicit rules make supplies by default. Implicit rules defined in the make file
remain in effect

-s

Silent mode. Do not print command lines before executing them.

-S

Undo the effect of the -k option.

-t

Touch the target files (bringing them up to date) rather than performing commands listed in their
rules.

-b

This option has no effect, but is present for compatibility reasons.

Last change: 19 June 1986

Sun Release 3.2

MAKE ( 1)

USER COMMANDS

MAKE(l)

macro-name =value
Macro definition. This definition overrides any definition for the specified macro that occurs in
the makefile itself, or in the environment. See Macros and Environment Variables and Macros,
for details.
USAGE

Refer to Doing More With UNIX: Beginner's Guide, and Make in Programming Utilities for the Sun Workstation for tutorial information about make.
Targets and Rules

There need not be an actual file named by a target, but every dependency in the dependency list must be
either the name of a file, or the name of another target.
If the target has no dependency list and no rule, or if the target has no entry in the makefile, make attempts
to produce an entry by selecting a rule from its its set of implicit rules. If none of the implicit rules apply,
make uses the rule specified in the .DEFAULT target (if it appears in the makefile). Otherwise make stops
and produces an error message.
Makefile Target Entries

A target entry has the following format:
target . .. : [dependency] ... [; command] ...
[command]

The first line contains the name of a target (or a space-separated list of target names), terminated with a
colon (:). This may be followed by a dependency, or a dependency list that make checks in the order listed.
The dependency list may be terminated with a semicolon (;), which in turn can be followed by a Bourne
shell command. Subsequent lines in the target entry begin with a TAB, and contain Bourne shell commands. These commands comprise a rule for building the target, and are performed when the target is
updated by make.
Shell commands may be continued across input lines by escaping the NEWLINE with a backslash (\). The
continuing line must also start with a TAB.
To rebuild a target, make expands any macros, strips off initial TABs and passes each resulting command
line to a Bourne shell for execution.
The first nonblank line that does not begin with a TAB or # begins another target or macro definition.
Makefile Special Characters

••

Conditional dependency branch. When used in place of a colon (:) the double-colons allow a target to be checked and updated with respect to more than one dependency list The double-colons
allow the target to have more than one branch entry in the makefile, each with a different dependency list and a different rule. make checks each branch, in order of appearance, to see if the target is outdated with respect to its dependency list. If so, make updates the target according to
dependencies and rule for that branch.

#

Start a comment The comment ends at the next NEWLINE.

$

Macro expansion. See Macros, below, for details.
Following the TAB, if the first character of a command line is a -, make ignores any nonzero error
code it may return. make nonnally terminates when a command returns nonzero status, unless the
-i or -k options are in effect.

@

Following the TAB, if the first character is a @, make does not print the command line before executing it.
If - and @ appear as the first two characters after the TAB, both apply.

$$

Sun Release 3.2

The dollar-sign, escaped from macro expansion. Can be used to pass variable expressions beginning with $ to the shell.

Last change: 19 June 1986

263

MAKE(I)

USER COMMANDS

MAKE(1)

Command Execution
Command lines are executed one at a time, each by its own shell. Shell commands, notably cd, are ineffectual across an unescaped NEWLINE in the makefile. A line is printed (after macro expansion) as it is executed, unless it starts with a @, there is a .SILENT entry in the dependency hierarchy of the current target,
or make is run with the -s option. Although the -n option specifies printing without execution, lines containing the macro $(MAKE) are executed regardless, and lines containing the @ special character are
printed. The -t (touch) option updates the modification date of a file without executing any rules. This can
be dangerous when sources are maintained by more than one person.

To take advantage of the Bourne shell if control statement, use a command line of the form:
if expression ; \
then command ; \
command; \
elif command

\

else command
\
fi
Although composed of several input lines, the escaped NEWLINEs insure that make treats them all as one
command line. To take advantage of the Bourne shell for control statement, use a command line of the
form:
for var in list ; do \
command; \

done
To write shell variables, use double dollar-signs ($$). This escapes expansion of the dollar-sign by make.
Signals
INT and QUIT signals received from the keyboard cause make to halt, and to remove the target file being
processed (unless it is in the dependency list for .PRECIOUS).
Special-Function Targets
When incorporated in a makefile, the following target names perform special functions .
•DEFAULT

If this target is defined in the makefile, its rule is used when there is no entry in the make file
for a given target and none of the implicit rules applies. make ignores the dependency list
for this target.

•PRECIOUS

List of files not to delete. Files listed as dependencies for this target are not removed if
make is interrupted while rebuilding them.

.SILENT

Run silently. When this target appears in the make file, make does not echo commands
before executing them.

.IGNORE

Ignore errors. When this target appears in the make file, make ignores nonzero error codes
returned from commands .

•SUFFIXES

The suffixes list for selecting implicit rules (see Implicit Rules).

Include Files
make has an include file capability. If the word include appears as the first seven letters of a line, and is
followed by a SPACE or a TAB, the string that follows is taken as a filename. The text of the named file is
read in at the current location in the makefile. include files can be nested to a depth of no more than about

16.

264

Last change: 19 June 1986

Sun Release 3.2

MAKE ( 1)

USER COMMANDS

MAKE(I)

Macros

Entries of the form
macro-name =value

define macros. name is the name of the macro, and value, which consists of all characters up to a comment
character or unescaped NEWLINE, is the value. Words in a macro value are delimited by SPACE, TAB, and
escaped NEWLINE characters, and the terminating NEWLINE.
Subsequent references to the macro, of the forms: $(name) or ${name} are replaced by value. The
parentheses or brackets can be omitted in a reference to a macro with a single-character name.
Macros definitions can contain references to other macros, but the nested references aren't expanded
immediately. Instead, they are expanded along with references to the macro itself.
Substitutions within macros can be made as follows:
$(name :str1 =str2)

where str1 is either a suffix, or a word to be replaced in the macro definition, and str2 is the replacement
suffix or word.
Dynamically Maintained Macros

There are several dynamically maintained macros that are useful as abbreviations within rules.

$*

The basename of the current target. It is assigned only for implicit rules.

$<

The name of the file on which the target is assumed to depend. This macro is only assigned for
implicit rules, or within the .DEFAULT target's rule.

$@

The name of the current target. It is assigned only for rules in targets that are explicitly defined in
the make file.

$?

The list of dependencies with respect to which the target is out of date. This macro is assigned
only for explicit rules.

$%

The library member. The $% macro is only evaluated when the target is an archive library
member of the form: lib (file.o ). In this case, $@ evaluates to lib and $% evaluates to the library
member, file.o .

All of these macros but $? can be modified to apply either to the filename part, or the directory part of the
strings they stand for, by adding an upper case F or D, respectively (and enclosing the resulting name in
parentheses or braces). Thus, $(@D) refers to the directory part of the string $@. If there is no directory
part, • is generated.
Environment Variables and Macros

After reading in its implicit rules, make reads in variables from the environment, treating them as if they
were macro definitions. Only then does make read in a makefile. Thus, macro assignments within a
makefile override environment variables, provided that the -e option is not in effect. In turn, make exports
environment variables to each shell it invokes. Macros not read in from the environment are not exported.
The MAKEFLAGS macro is a special case. When present as an environment variable, make takes its
options (except for -f, -p, and -d) from MAKEFLAGS, in combination with any flags entered on the command line. make retains this combined value, exports it automatically to each shell it forks, and reads its
value to obtain options for any make commands it invokes. Note, however that flags passed with
MAKEFLAGS, even though they are in effect, are not shown in the output produced by make.
The MAKE macro is another special case. It has the value "make" by default, and temporarily overrides
the -0 option for any line that contains a reference to it This allows nested invocations of make written as:
$(MAKE) ...

to run recursively, so that the command make -n can be used to test an entire hierarchy of makefiles.

Sun Release 3.2

Last change: 19 June 1986

265

MAKE ( 1)

USER COMMANDS

MAKE(l)

For compatibility with the 4.2 BSD make, the MFLAGS macro is set from the MAKEFLAGS variable by
prepending a "_". MFLAGS is not exported automatically.
make supplies the following macros for compilers and their options:
CC
C compiler, ee(IV)
CFLAGS
C compiler options
FC
FORTRAN 77 compiler,j77(1)
FFLAGS
FORTRAN 77 compiler options
RFLAGS
FORTRAN 77 compiler options with Ratfor (.r) source
PC
Pascal compiler, pc (1)
PFLAGS
Pascal compiler options
M2C
Modula-2 compiler
M2FLAGS
Modula-2 compiler options
GET
sees (1) get command
GFLAGS
sees get options
AS
the assembler, as(l)
ASFLAGS
assembler options
LD
the linker, Id(l)
LDFLAGS
linker options
LEX
lex (1)
LFLAGS
lex options
YACC
yaee(l)
YFLAGS
yaee options
Unless these macros are read in as environment variables, their values are not exported by make. If you
run make with any these set in the environment, it is a good idea to add commentary to the makefile to indicate what value each takes. If -r is in effect, make ignores these macro definitions.

When set to a single-word value such as Ibin/csh, the SHELL macro indicates the name of an alternate
shell to use for invoking commands. Note, however, that to improve normal performance make executes
command lines that contain no shell metacharacters directly. Such builtin commands as dirs, or set in the
C-Shell are not recognized unless the command line includes a metacharacter (for instance, a semicolon).
Implicit Rules
make supplies implicit rules for certain types of targets that have no explicit rule defined in the makefile.
For these types of targets, make attempts to select an implicit rule by looking for an association between
the target and a file in the directory that shares its basename. That file, if found, is presumed to be a dependency file. The implicit rule is selected according to the target's suffix (which may be null), and that of the
dependency file. If there is no such dependency file, if the suffix of either dependency or target is not the
suffixes list, or if there is no implicit rule defined for that pair of suffixes, no rule is selected. make either
uses the default rule that you have supplied (if any), or stops.

The suffixes list is a target with each known suffix listed as a dependency, by default:

.SUFFIXES:.o .c .c- .mod .mod- .sym .def .def- .p.p- .f .f- .r .r- .y .y- .1 .1- .s .s.sh .sh- .h .hMultiple suffix-list targets accumulate; a .SUFFIXES target with no dependencies clears the list of suffixes.
Order is significant; make selects a rule that corresponds to the target's suffix and the first dependency-file
suffix found in the list
A tilde (-) refers to the s. prefix of an sces history file (see sees(I». If make cannot locate a history file
(with a name of the form s.basename.suffix) in the current working directory, it checks for one in the sees
subdirectory (if that directory exists) for one from which to get(l) the dependency file.
An implicit rule is a target of the form:

dt:
rule

where t is the suffix of the target, d is the suffix of the dependency, and rule is the implicit rule for building
such a target from such a dependency. Both d and t must appear in the suffixes list for make to recognize
the target as one that defines an implicit rule.
An implicit rule with only one suffix describes how to build a target having a null (or no) suffix, from a
dependency having the indicated suffix. For instance, the .c rule describes how to build the executable file
from a C source file,jile.e.

Implicit rules are supplied for the following suffixes and suffix pairs:

.c .c- .p .p- .mod .mod- .f .f .F .F- .r .r- .sh .sh- .c.o .c-.0 .c-.c .p.o .p-.0 .p-.p
.mod.o .mod-.o .mod-.mod .def.sym .def.sym .def-.def .f.o .f-.f .F.o .F-.o .F-.F .r.o

266

Last change: 19 June 1986

Sun Release 3.2

MAKE ( 1)

USER COMMANDS

MAKE(I)

.r .0 .r-.r .s.o .s-.0 .s- .s .sh-.sh .y.o .y-.0 .1.0 .1-.0 .y.c .y-.c .y .y .I.c .l-.c .1-.1 .c.a
.c-.a .s-.a .h-.h
These rules can be changed within a makefile, and additional implicit rules can be added. To print out
make's internal rules, use the following command (note that this command only works with the Bourne
Shell):
$ make -fp - 2>/dev/null /dev/tty) >&/dev/null
Library Maintenance
If a target name contains parentheses, as with:

lib .a(member)
it is assumed to be the name of an archive (ar(I» library. The string within the parentheses refers to a
member of the library. (If the string contains more than one word, the only first word is used.) A member
of an archive can be explicitly made to depend on a file with a matching filename. For instance, given a
directory that contains the files meml.c and mem2.c, along with a makefile with the entries:
lib.a: lib.a(mem1.o) lib.a(mem2.0)
lib.a(mem1.o): mem1.o
ar rv lib.a mem1.o
lib.a(mem2.o): mem2.o
ar rv lib.a mem2.o

make, when run, compiles the .c files into relocatable object (.0) files using the .c.o implicit rule. It then
loads the freshly compiled version of each file into the library according to the explicit rules in the 'lib.aO'
targets.
Implicit rules pertaining to archive libraries have the form .xx.a where the XX is the suffix from which the
archive member is to be made. An unfortunate byproduct of the current implementation requires that XX to
be different from the suffix of the archive member itself. For instance, the target Iib(file.o) cannot depend
upon the file.o explicitly, but instead, must be made to depend on a source file, such as file.c. For this reason it is recommended that you define an explicit target in the makefile for each library member to maintain, as shown above.
A target name of the form
library «entry-point»
refers to the member of a randomized object library (see ranlib(I» that defines the symbol entry-point.
EXAMPLES
This makefile says that pgm depends on two files a.o and b.o, and that they in tum depend on their
corresponding source files (a.c and b.c) along with a common file incl.h:

pgm: a.o b.o
cc a.o b.o -0 $@
a.o: incl.h a.c
cc -c a.c
b.o: incl.h b.c
cc-c b.c
The following makefile uses the builtin inference rules to express the same dependencies:
pgm: a.o b.o
cc a.o b.o -0 pgm
a.o b.o: incl.h

Sun Release 3.2

Last change: 19 June 1986

267

MAKE(l)

USER COMMANDS

MAKE(l)

FILES

[MmJ akefile
s.[MmJakefile
SCCSls.[mMJakefile
DIAGNOSTICS
Don't know how to make target. Stop.
There is no rnakefile entry for target, and none of make's implicit rules apply (there is no dependency file with a suffix in the suffixes list, or the target's suffix is not in the list).

*** target removed.
make was interrupted in the middle of trying to build target. Rather than leaving a partiallycompleted version that is newer than its dependencies, make removes the file associated with target.

*** Error code n.
The previous shell command returned a nonzero error code. In this case make stops, unless either
the -k or the -i option is set, the target .IGNORE appears, or the command is prefixed with a - in
the makefile.
SEE ALSO
cc(lV), ar(l), cd(l), get(I), lex(I), ranlib(I), sh(I), sccs(1)

Doing More with UNIX: Beginner's Guide
Make, in Programming Utilities for the Sun Workstation
BUGS

Some commands return nonzero status inappropriately; use -i to overcome the difficulty.
Filenames with the characters = : @ will not work.
You cannot build lib(file.o) from file.o.
The macro substitution $(a:.o=.c-) does not work.
Options supplied by MAKEFLAGS should appear in output from make.

268

Last change: 19 June 1986

Sun Release 3.2

MAN ( 1)

USER COMMANDS

MAN(l)

NAME

man - display reference manual pages; find reference pages by keyword
SYNOPSIS

man [ - ] [ -t] [ -M path] [ - T macro-pkg ] [[ section] title ... ] ...
man [ ":""M path] -k keyword . . .
man [ -M path] -f filename . . .
DESCRIPTION

man displays information from the reference manuals. It can display complete manual pages that you
select by title. It can display one-line summaries selected either by keyword (-k), or by the name of an
associatedfile (-f).
When neither -k nor -f is specified, man formats a specified set of manual pages by title. A section, when
given, applies to the titles that follow it on the command line (up to the next section, if any). man looks in
the indicated section of the manual for those titles. section is either a digit (perhaps followed by a single
letter indicating the type of manual page), or one of the words 'new,' 'local,' 'old,' or 'public.' If section is
omitted, man searches all reference sections (giving preference to commands over functions) and prints the
first manual page it finds. If no manual page is located, man prints an error message.
If the standard output is not a terminal, or if the - flag is given, man pipes its output through cat(l). Otherwise, man pipes its output through more(l) to handle paging and underlining on the screen.
OPTIONS
-t

man arranges for the specified manual pages to be troffed to a suitable raster output device (see
trolf(l) or vtrolf(l)). If both the - and -t flags are given, man updates the trolfed versions of each
named title (if necessary), but does not display them.

-Mpath
Change the search path for manual pages. path is a colon-separated list of directories that contain
manual page directory subtrees. For example, 'Iusrlmanlu_ man:lusrlman/a_man' makes man
search in the standard System V locations. When used with the -k or -f options, the -M option
must appear first.

- T macro-pkg
man uses macro-pkg rather than the standard -man macros defined in lusrllibltmac/tmac.an for
formatting manual pages.
-kkeyword . ..
man prints out one-line summaries from the whatis database (table of contents) that contain any of
the given keywords.
-f filename ...

man attempts to locate manual pages related to any of the given file s. It strips the leading pathname components from each filename, and then prints one-line summaries containing the resulting
basename or names.
MANUAL PAGES

Manual pages are troff(l)/nrolf(l) source files prepared with the -man macro package. Refer to man(7),
or Formatting Documents on the Sun Workstation for more information.
When formatting a manual page, man examines the first line to determine whether it requires special processing.
Referring to Other Manual Pages

If the first line of the manual page is a reference to another manual page entry fitting the pattern:
.so man?*lsourcefile
man processes the indicated file in place of the current one. The reference must be expressed as a pathname relative to to the root of the manual page directory subtree.

Sun Release 3.2

Last change: 11 July 1986

269

MAN(I)

USER COMMANDS

MAN ( 1)

When the second or any subsequent line starts with .so, man ignores it; troff(l) or nroff(l) processes the
request in the usual manner.
Preprocessing Manual Pages
If the first line is a string of the form:
'\" X

where X is separated from the the " by a single space and consists of any combination of characters in the
following list, man pipes its input to troff(1) or nroff(l) through the corresponding preprocessors.
c
cw(I), where available
eqn(l), or neqn(l) for nroff
e
p
pic(I), where available
r
re;(er(l)
t
tbl (1), and col (1) for nroff
v
vgrind(l)
If eqn or neqn is invoked, it will automatically read the file lusrlpubleqnchar (see eqnchar(7».
FILES

lusrlman
lusrlmanlman?1*
lusrlmanl cat? 1*
1usrlmanifmt? 1*
lusrlmanlwhatis
lusrllibltmacltmac .an
ENVIRONMENT
MAN PATH

PAGER
TCAT
TROFF

root of the standard manual page directory subtree
unformatted manual entries
nroffed manual entries
trofted manual entries
table of contents and keyword database
standard -man macro package

If set, its value overrides lusrlman as the default search path. (The -M flag, in turn, overrides this value.)
A program to use for interactively delivering man's output to the screen. If not set, more-s
is used.
The name of the program to use to display troffed manual pages. If not set, Ipr -t is used.
The name of the formatter to use when the -t flag is given. If not set, troiT is used.

SEE ALSO

cat(IV), col(IV), eqn(I), more(I), nroff(l), tbl(I), troff{l), whatis(1), man(7), catman(8)
BUGS

The manual is supposed to be reproducible either on a phototypesetter or on an ASCII terminal. However,
on a terminal some information (indicated by font changes, for instance) is necessarily lost.
Some dumb terminals cannot process the vertical motions produced by the e (eqn(l» preprocessing flag.
To prevent garbled output on these terminals, when you use e also use t, to invoke col(l) implicitly. This
workaround has the disadvantage of eliminating superscripts and subscripts--even on those terminals that
can display them. CTRL-Q will clear a terminal that gets confused by eqn(l) output.

270

Last change: 11 July 1986

Sun Release 3.2

MESO ( 1)

USER COMMANDS

MESO ( 1)

NAME

mesg - permit or deny messages
SYNOPSIS

mesg [n] [y]
DESCRIPTION

Mesg with argument n forbids messages via write(l) by revoking non-user write permission on the user's
terminal. Mesg with argument y reinstates permission. All by itself, mesg reports the current state without
changing it.
FILES

ldev/tty*
SEE ALSO

write(I), ta1k(I)
DIAGNOSTICS

Exit status is 0 if messages are receivable, 1 if not, 2 on error.

Sun Release 3.2

Last change: 16 February 1984

271

MKDIR( 1)

USER COMMANDS

MKDIR(I)

NAME

mkdir - make a directory
SYNOPSIS

mkdir dimame ••.
DESCRIPTION
Mkdir creates directories. Standard entries, '.', for the directory itself, and ' •• ' for its parent, are made

automatically.
The current umask(2) setting determines the mode in which directories are created. Modes may be
modified after creation by using chmod(IV).
Mkdir requires write permission in the parent directory.
SEE ALSO

chmod(IV), rnndir(I),rEn(l)

272

Last change: 15 March 1983

Sun Release 3.2

MKSTR(l)

USER COMMANDS

MKSTR(l)

NAME

mkstr - create an error message file by massaging C source
SYNOPSIS

mkstr [ - ] messagefile prefix file •••
DESCRIPTION
Mkstr creates files of error messages. You can use mkstr to make programs with large numbers of error

diagnostics much smaller, and to reduce system overhead in running the program do not have to be constantly swapped in and out.

as the error messages

Mkstr processes each of the specified files, placing a massaged version of the input file in a file whose name
consists of the specified prefix and the original name. A typical example of using mkstr would be:

mks tr pistrings xx *.c
This command would cause all the error messages from the C source files in the current directory to be
placed in the file pistrings and processed copies of the source for these files to be placed in files whose
names are prefixed with xx.
To process the error messages in the source to the message file, mkstr keys on the string 'error('" in the
input stream. Each time it occurs, the C string starting at the "" is placed in the message file followed by a
null character and a new-line character; the null character terminates the message so it can be easily used
when retrieved, the new-line character makes it possible to sensibly cat the error message file to see its
contents. The massaged copy of the input file then contains a {seek pointer into the file which can be used
to retrieve the message, that is:

char
int

efilnameO
efil = -1;

=

"/usr/lib/pi_strings";

error(al, a2, a3, a4)
{

char buf[256];
if (efil < 0) {
efil = open(efilname, 0);
if (efil < 0) {

oops:
perror( efilname);
exit(I);
}
}
if (lseek(efil, (long) aI, 0)

II read(efil, buf, 256) <= 0)

goto oops;
printf(buf, a2, a3, a4);
}
OPTIONS

Place error messages at the end of the specified message file for recompiling part of a large mkstr' d
program.
SEE ALSO

xstr(l)

Sun Release 3.2

Last change: 1 November 1983

273

MORE ( 1)

USER COMMANDS

MORE ( 1)

NAME

more, page - browse through a text file
SYNOPSIS

more [ -cdOsu] [ -lines] [+linenumber] [+Ipattern] [name .•• ]
page [ -cdflsu] [ -lines] [ +linenumber] [ +1pattern] [ name. •• ]
DESCRIPTION

More is a filter which displays the contents of a text file one screenful at a time on a video terminal. It normally pauses after each screenful, and prints '--More--' at the bottom of the screen. More displays another
line if you type a carriage-return; more displays another screenful if you type a space.
If you use the page command instead of the more command, the screen is cleared before each screenful is
displayed (but only if a full screenful is being displayed), and k - 1 rather than k - 2 lines are displayed in
each screenful, where k is the number of lines the terminal can display.

More looks in the file /etc!termeap 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.
More 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 esh command "setenv MORE -e" or the sh command
sequence "MORE=' -e' ; export MORE" would cause all invocations of more, including invocations by
programs such as man to use this mode. Normally, the user will place the command sequence which sets
up the MORE environment variable in the .login or .profile file.
If more is reading from a file, rather than a pipe, a percentage is displayed along with the --More-- prompt.

This gives the fraction of the file (in characters, not lines) that has been read so far.
Other sequences which may be typed when more pauses, and their effects, are as follows (i is an optional
integer argument, defaulting to 1) :
i
display i more lines, (or another screenful if no argument is given)
AD

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

d

same as AD (control-D)

iz

same as typing a space except that i, if present, 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 rrwre.
Display the current line number.
v

Start up the editor vi at the current line.

h

Help command; give a description of all the more commands.

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), the position in the file remains unchanged.
Otherwise, a screenful is displayed, starting two lines before the place where the expression was
found, or the end of the pipe, whichever comes first. 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.

274

Last change: 13 March 1984

Sun Release 3.2

MORE ( 1)

USER COMMANDS

MORE(I)

!command
invoke a shell with command. The characters '%' and '!' 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 n\%" and n\!" are replaced by n%n and n!" 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, more goes back to the beginning of the file. If i doesn't make sense, more skips
back to the first file. If more 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 more (same as q or Q).
(dot) repeat the previous command.
The commands take effect immediately; it is not necessary to type a carriage return. Up to the time when
the command character itself is given, the user may type the line kill character to cancel the numerical
argument being formed. In addition, the user may type the erase character to redisplay the --More--(xx%)
message.
At any time when output is being sent to the terminal, the user can type the quit key (normally control-\).
More stops sending output, and displays 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.

More sets the terminal to noecho mode so that the output can be continuous. Thus what you type does not
show on your terminal, except for the / and! commands.
If the standard output is not a terminal, more acts just like cat, except that a header is printed before each
file in a series.
OPTIONS

-lines

Set the size of the window to lines lines long instead of the default.

-c

Display each page by redrawing the screen instead of scrolling. This makes it easier to read text
while more is writing. This option is ignored if the terminal does not have the ability to clear to
the end of a line.

-d

Display the message 'Hit space to continue, Rubout to abort' at the end of each screenful. This is
useful if more is being used as a filter in some setting, such as a class, where users are unsophisticated.

-f

Count logical rather than screen lines. That is, long lines are not folded. This option is recommended if nroff output is being piped through ul, since the latter may generate escape sequences.
These escape sequences contain characters which would ordinarily occupy screen postions, but
which do not print when they are sent to the terminal as part of an escape sequence. Thus more
may think that lines are longer than they actually are, and fold lines erroneously.

-I

Do not treat "L (form feed) specially. If -I is not used, more pauses 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
is cleared before the file is printed.

-s

Squeeze mUltiple blank lines from the output, and replace them with single blank lines. Especially
helpful when viewing nroff output, this option maximizes the useful information present on the
screen.

-u

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

+Iinenumber

Sun Release 3.2

Last change: 13 March 1984

275

MORE ( 1)

USER COMMANDS

MORE(I)

Start up at linenumber.
+/pattern
Start up two lines before the line containing the regular expression pattern. Note that unlike with
editors, the construct should not end with a /. If it does, then the trailing slash is taken as a character in the search pattern.
EXAMPLES
A sample usage of more in previewing nroff output would be

nroff -ms +2 doc.n I more -s
FILES

/etc/termcap
Terminal data base
/usrllib/more.helpHelp file
SEE ALSO
csh(l), man(I), script(I), sh(I), environ(5V), termcap(5)

276

Last change: 13 March 1984

Sun Release 3.2

MT(I)

USER COMMANDS

MT(I)

NAME

mt - magnetic tape manipulating program
SYNOPSIS

mt [ -f tapename ] command [ count]
DESCRIPTION

sends commands to a magnetic tape drive. If tapename is not specified, the environment variable TAPE
is used; if TAPE does not exist, mt uses the device Idevlrmt12. Note that tapename must reference a raw
(not block) tape device. By default mt performs the requested operation once. Operations may be performed multiple times by specifying count.

mt

The available commands are listed below. Only as many characters as are required to uniquely identify a
command need be specified.
eof, weof
Write count end-of-file marks at the current position on the tape.
fsf

Forward space count files.

fsr

Forward space count records.

bsf

Back space count files.

bsr

Back space count records.

For the following commands, count is ignored:
rewind Rewind the tape.
offline, rewoffl
Rewind the tape and place the tape unit off-line.
status

Print status information about the tape unit

retension
Wind the tape to the end of the reel and then rewind it, smoothing out the tape tension.
(count is ignored.)
erase

Erase the entire tape.

mt returns a 0 exit status when the operation(s) were successful, 1 if the command was unrecognized, and 2
if an operation failed.
FILES

ldev/rmt*
Raw magnetic tape interface
/dev/rar*
Raw Archive cartridge tape interface
/dev/rst* Raw SCSI tape interface
/dev/rxt*
Raw Xylogics tape interface
SEE ALSO

mtio(4), dd(l), environ(5V)
BUGS

Not all devices support all options. For example, ar(4S) and st(4S) currently do not support the fsr, bsf, or
bsr options; but they are the only only ones that currently support the retension and rewind options.
Nine-track tapes, in particular, do not support the retension option.

Sun Release 3.2

Last change: 23 September 1985

277

MV(I)

USER COMMANDS

MV(I)

NAME
~v

- move or rename files

SYNOPSIS
mv [ -i ] [ -f] [ - ] filename1 filename2

mv [ -i ] [ -f] [ - ] directory1 directory2
mv [ -i ] [ -f] [ - ] filename . .. directory . .. directory
DESCRIPTION
my moves files and directories around in the file system. A side effect of my is to rename a file or directory. The three major forms of my are shown in the synopsis above.

The first form of mv moves (changes the name ot) filename1 to filename2. If filename2 already exists, it is
removed before filename1 is moved. If filename2 has a mode which forbids writing, my prints the mode
(see chmod(2» and reads the standard input to obtain a line; if the line begins with y, the move takes place,
otherwise mY exits.
The second form of mv moves (changes the name ot) directory1 to directory2 , ONLY if directory2 does not
already exist - if it does, the third form applies.
The third form of my moves one or more files and directories, with their original names, into the last directory in the list.
my refuses to move a file or directory onto itself.

OPTIONS
-i

-f

interactive mode: mv displays the name of the file or directory followed by a question mark whenever a move would replace an existing file or directory. If you type a line starting with 'y', mv
moves the specified file or directory, otherwise my does nothing with that file or directory.
force: override any mode restrictions and the -i switch. The -f option also suppresses any warning messages about modes which would potentially restrict overwriting.
Interpret all the following arguments to my as file names. This allows file names starting with
minus.

SEE ALSO
cp(I),ln(l)
BUGS

If filename1 and filename2 are on different file systems, then my must copy the file and delete the original.
In this case the owner name becomes that of the copying process and any linking relationship with other
files is lost.
my will not move a directory from one file system to another.

278

Last change: 23 September 1985

Sun Release 3.2

NICE ( 1)

USER COMMANDS

NICE ( 1)

NAME

nice - run a command at low priority
SYNOPSIS
nice [ -number] command [ arguments]
DESCRIPTION
There are two distinct versions of nice: it is built in to the C-Shell, and is an executable program available
in !bin/nice for use with the Bourne shell.

nice executes command with a higher "nice" value. The higher the value, the lower the command's
scheduling priority. If the number argument is present, the nice value is incremented by that amount, up to
a limit of 20. The default number is 10.
The super-user may run commands with priority higher than normal by using a negative nice value, such as

'-10'.
SEE ALSO
csh(l), nice(3C), renice(8)
DIAGNOSTICS
nice returns the exit status of the subject command.
BUGS

The nice C-Shell built-in has a slightly different syntax than the nice command described here. When
using the built-in, the additional + option, as in:
nice +n
sets the nice value to n rather than incrementing by n.
Although you can increase the nice value for any process you own, only the super-user can decrement that
value.

Sun Release 3.2

Last change: 17 July 1986

279

NL(I)

USER COMMANDS

NL(I)

NAME

nl- line numbering filter
SYNOPSIS
01 [ -b type] [ -b type] [ -ftype] [ -v start] [ -iincr] [ -p] [ -Inum] [ -ssep] [ -wwidth]

[ -ofmt] [ -ddelim ] filename
DESCRIPTION
nl reads lines from filename (or the standard input), numbers them according to the options in effect, and
sends its output to the standard output.

nl views the text it reads in terms of logical pages. Line numbering is normally reset at the start of each
page. A logical page is composed of header, body and footer sections. The start of each page section is signaled by input lines containing section delimiters only:
Start offile

\:\:\:
header

\:\:
body

\:
footer
Empty sections are valid. Different line-numbering options are available within each section. The default
scheme is no numbering for headers and footers.
OPTIONS
-b type

280

Specifies which logical page body lines are to be numbered. type is one of:
a
number all lines
t
number lines with printable text only (the default)
o,
no line numbering
p rexp number only lines that contain the regular expression rexp

-b type

Same as -b type except for the header. The default type for the logical page header is
lines numbered).

-ftype

Same as -b type except for the footer. The default for logical page footer is 0 (no lines numbered).

-p

Do not restart numbering at logical page delimiters.

-v start

start is the initial value used to number logical page lines. The default is 1.

-i incr

incr is the increment by which to number logical page lines. The default is 1.

-ssep

sep is the character(s) used to separate the line number from the corresponding text line. The
default is a TAB.

-w width

width is the number of characters to be used for the line-number field. The default is 6.

-ofmt

fmt is the line numbering format Recognized values are:
ro
right justified, leading zeroes supressed (the default)
In
left justified, leading zeroes suppressed
rz
right justified, leading zeroes kept

-I num

num is the number of blank lines to be considered as one. For example, -12 results in only
the second adjacent blank being numbered (if the appropriate -ba, -ba, and/or -fa option is
set). The default is 1.

Last change:

0

(no

Sun Release 3.2

NL(I)

USER COMMANDS

-d n

NL(l)

The delimiter characters specifying the start of a logical page section may be changed from
the default characters (\:) to two user-specified characters. If only one character is entered,
the second character remains the default character (:). No space should appear between the
-d and the delimiter characters. To enter a backslash, use two backslashes.

EXAMPLE

The command:

nl-vlO -itO -d!+ filel
will number filel starting at line number 10 with an increment of ten. The logical page delimiters are !+.
SEE ALSO

pr(l)

Sun Release 3.2

Last change:

281

NM(I)

USER COMMANDS

NM(I)

NAME

nm - print name list
SYNOPSIS
om [ -gooprua] [ [filename] ...
DESCRIPTION

Nm prints the name list (symbol table) of each object filename in the argument list If an argument is an
archive, a listing for each object file in the archive will be produced. If no filename is given, the symbols in
a.out are listed.

Each symbol name is preceded by its value (blanks if undefined) and one of the letters:
A

absolute

B

bsssegmentsymbol

C

common symbol

D

data segment symbol

f

filename

T

text segment symbol

U

undefined
debug, giving symbol table entries (see -a below)

The type letter is upper case if the symbol is external, and lower case if it is local. The output is sorted
alphabetically.
OPTIONS

-g

Print only global (external) symbols.

-0

Sort numerically rather than alphabetically.

-0

Prepend file or archive element name to each output line rather than only once.

-p

Don't sort; print in symbol-table order.

-r

Sort in reverse order.

-u

Print only undefined symbols.

-a

Print all symbols.

EXAMPLE

nm
prints the symbol list of a.out, the default output file for the C, FORTRAN 77 and Pascal compilers.
SEE ALSO

ar(l), ar(5), a.out(5)

282

Last change: 9 June 1983

Sun Release 3.2

USER COMMANDS

NOHUP(IV)

NOHUP(IV)

NAME

nohup - run a command immune to hangups and quits
SYNOPSIS
nohup command [ arguments]
DESCRIPTION
There are three distinct versions of nohup: it is built in to the C-Shell, and is an executable program available in lusr/binlnohup and lusr/5binlnohup when using the Bourne shell.

nohup executes command such that it is immune to HUP (hang up) and QUIT (quit) signals. If the standard
output is a terminal, it is redirected to the file nohup.out. If nohup.out is not writable in the current directory, output is redirected to $HOME/nohup.out. If the standard error is a terminal, it is redirected to the
standard output.
The priority is incremented by 5. nohup should be invoked from the shell with '&' in order to prevent it
from responding to interrupts or input from the next user.
EXAMPLE
It is frequently desirable to apply nohup to pipelines or lists of commands. This can be done only by placing pipelines and command lists in a single file, called a shell script. The command

manual % nohup sh script
applies to everything in script. (If the script is to be executed often, then the need to type sh can be eliminated by giving script execute permission). Add an ampersand and the contents of script are run in the
background with interrupts also ignored (see sh(I»:
manual % nohup script &
FILES

nohup.out
$HOME/nohup.out
SEE ALSO
chmod(lV), nice(I), sh(l), signal(2)
BUGS

If you use csh(I), then commands executed with '&' are automatically immune to HUP signals while in the
background.
There is a C-Shell built-in command nohup which provides immunity from terminate, but it does not
redirect output to nohup.out.
WARNINGS
nohup command 1; command2----- nohup applies only to command1
nohup (commandl; command2)
is syntactically incorrect.

Be careful of where standard error is redirected. The following command may put error messages on tape,
making it unreadable:
nohup cpio -0 /dev/rmt/lm&
while
nohup cpio -0 /dev/rmt/lm 2>errors&
puts the error messages into file errors.

Sun Release 3.2

Last change: 18 July 1986

283

NROFF(1)

USER COMMANDS

NROFF( 1)

NAME

nroff - format documents for display or line-printer
SYNOPSIS
orotT [ -opagelist] [ -oN] [ -sN] [ -m name] [ -r aN] [ -i ] [ -q] [ - T name ]
[ -e ] [ -h ] [filename] ...
DESCRIPTION

nrolfformats text in the named files for typewriter-like devices. See also trolf(1). The full capabilities of
nrolf and trolf are described in Formatting Documents with Nroff and Troff.
If no file argument is present, nrolf reads the standard input An argument consisting of a single minus (-)
is taken to be a file name corresponding to the standard input.
OPTIONS
Options may appear in any order so long as they appear before the files.

-olist

Print only pages whose page numbers appear in the comma-separated list of numbers and ranges.
A range N -M means pages N through M; an initial-N means from the beginning to page N; and a
final N - means from N to the end.

-oN

Number first generated page N.

-sN

Stop every N pages. nroff will halt prior to every N pages (default N = 1) to allow paper loading or
changing, and will resume upon receipt of a newline.

-mname
Prepend the macro file lusrllibltmacltmac.name to the input files.

-raN

Set register a (one-character) to N.

-i

Read standard input after the input files are exhausted

-q

Invoke the simultaneous input-output mode of the rd request.

-Tname
Prepare output for a device of the specified name. Known name s are:
37
Teletype Corporation Model 37 terminal- this is the default.
ert I Jpr I tn300
GE TermiNet 300, or any line printer or terminal without half-line capability.
DASI-300.
300
300-12 DASI-300 - 12-pitch.
300S I 302 I dte
DASI-300S.
300S-12 I 302-12 I dte12
DASI-300S.
382
DASI-382 (fancy DTC 382).
382-12 DASI-82 (fancy DTC 382 - 12-pitch).
450 I ipsi
DASI450 (Diablo Hyterm).
450-12 I ipsi12
DASI450 (Diablo Hyterm) - 12-pitch.
450-12-8 DASI450 (Diablo Hyterm) - 12-pitch and 8 lines-per-inch.
450X
DASI450X (Diablo Hyterm).
832
AI 832.
833
AI 833.
832-12 AI 832 - 12-pitch.
833-12 AI 833 -12-pitch.
itoh
C:ITOH Prowriter.
itoh-12 C:ITOH Prowriter - 12-pitch.

284

Last change: 16 June 1986

Sun Release 3.2

NROFF( 1)

USER COMMANDS

nee
nec12
nec-t
qume
qume12
xerox
xerox12
x-ecs
x-ecs12

NROFF( 1)

NEe 55?0 or NEe 77?0 Spinwriter.
NEe 55?0 or NEe 77?0 Spinwriter - 12-pitch.
NEe 55?0177?0 Spinwriter - Tech-MathlTimes-Roman thimble.

Qume Sprint - 5 or 9.
Qume Sprint - 5 or 9, 12-pitch.
Xerox 17'10 or Diablo 16'10.
Xerox 17'10 or Diablo 16'10 - 12-pitch.
Xerox/Diablo 1730/630 - Extended Character Set.
Xerox/Diablo 1730/630 - Extended Character Set, 12-pitch.

-e

Produce equally-spaced words in adjusted lines, using full terminal resolution.

-b

Use output tabs during horizontal spacing to speed output and reduce output character count. Tab
settings are assumed to be every 8 nominal character widths.

EXAMPLE

gaia% nroff -s4 -me users.guide
Formats users .guide using the -me macro package, and stopping every 4 pages.
FILES

Itmp/ta*
temporary file
lusr/lib/tmac/tmac. * standard macro files
lusr/lib/terml*
terminal driving tables for nroff
lusrllib/termlREADMEindex to terminal description files
SEE ALSO

troff(l), eqn(l), tbl(I), ms(7), me(7), man(7), col(IV), checknr(l), term(5V)
Formatting Documents on the Sun Workstation
Using nroff and troff on the Sun Workstation

Sun Release 3.2

Last change: 16 June 1986

285

OD( 1V)

USER COMMANDS

OD(IV)

NAME

od - octal, decimal, hex, ascii dump
SYNOPSIS
od [ -format] [file] [[+ ]offset[.] [b] [label] ]
DESCRIPTION
od displays file, or its standard input, in one or more dump formats as selected by the first argument. If the
first argument is missing, -0 (octal) is the default Dumping continues until end-of-file.

The meanings of the format argument characters are:
3

Interpret bytes as characters and display them with their ASCII names. If the p character is given
also, bytes with even parity are underlined. If the P character is given, bytes with odd parity are
underlined. Otherwise the parity bit is ignored.

b

Interpret bytes as unsigned octal.

c

Interpret bytes as ASCII characters. Certain non-graphic characters appear as C escapes: null=\O,
backspace=\b, forrnfeed=\f, newline=\n, retum=\r, tab=\t; others appear as 3-digit octal numbers.
Bytes with the parity bit set are displayed in octal.

d

Interpret (short) words as unsigned decimal.

f

Interpret long words as floating point

h

Interpret (short) words as unsigned hexadecimal.
Interpret (short) words as signed decimal.
Interpret long words as signed decimal.

o

Interpret (short) words as unsigned octal.

s[n]

Look for strings of ASCII graphic characters, terminated with a null byte. n specifies the minimum
length string to be recognized. By default, the minimum length is 3 characters.

v

Show all data. By default, display lines that are identical to the last line shown are not output, but are
indicated with an "*" in column 1.

w[n] Specifies the number of input bytes to be interpreted and displayed on each output line. If w is not

specified, 16 bytes are read for each display line. If n is not specified, it defaults to 32.
x

Interpret (short) words as hexadecimal.

An upper case format character implies the long or double precision form of the object
The offset argument specifies the byte offset into the file where dumping is to commence. By default this
argument is interpreted in octal. A different radix can be specified; if . is appended to the argument, then
offset is interpreted in decimal. If offset begins with x or Ox, it is interpreted in hexadecimal. If b (8) is
appended, the offset is interpreted as a block count, where a block is 512 (1024) bytes. If thefile argument
is omitted, thhe offset argument must be preceded by +.
The radix of the displayed address will be the same as the radix of the offset, if specified; otherwise it will
be octal.

label will be interpreted as a pseudo-address for the first byte displayed. It will be shown in "0" following the file offset. It is intended to be used with core images to indicate the real memory address. The syntax for label is identical to that for offset.
SYSTEM V DESCRIPTION
The 3, f, h, I, v, and w formats are not supported. The s format interprets (short) words as signed decimal,
rather than searching for strings. The options for interpreting long or double-precision forms are not supported. The label argument is not supported. The B suffix to the offset argument is not supported.

286

Last change: 17 July 1986

Sun Release 3.2

OD( IV)

USER COMMANDS

OD( IV)

SEE ALSO

adb(I), dbxtool(I), dbx(l)

BUGS
A file name argument can't start with +. A hexadecimal offset can't be a block count. Only one file name
argument can be given.
It is an historical botch to require specification of object, radix, and sign representation in a single character
argument

Sun Release 3.2

Last change: 17 July 1986

287

ONe lC)

USER COMMANDS

ON( lC)

NAME

on - execute a command remotely
SYNOPSIS
00 [

-i ] [ -0] [ -d] host command [ argument] ...

DESCRIPTION

The on program is used to execute commands on another system, in an environment similar to that invoking the program. All environment variables are passed, and the current working directory is preserved. To
preserve the working directory, the working file system must be either already mounted on the host or be
exported to it. Relative path names will only work if they are within the current file system; absolute path
names may cause problems.
Standard input is connected to standard input of the remote command, and standard output and standard
error from the remote command are sent to the corresponding files for the on command.
OPTIONS

-i

Interactive mode: use remote echoing and special character processing. This option is
needed for programs that expect to be talking to a terminal. All terminal modes and window size changes are propagated.

-0

No Input this option causes the remote program to get end-of-file when it reads from
standard input, instead of passing standard input from the standard input of the on program. For example, -0 is necessary when running commands in the background with job
control.

-d

Debug mode: print out some messages as work is being done.

SEE ALSO
rexd(8), exports(5)
DIAGNOSTICS

unknown host
cannot connect to server
can't find.
can't locate mount point

Host name not found
Host down or not running the server
Problem finding the working directory
Problem finding current file system

Other error messages may be passed back from the server.
BUGS

The SunView window system can get confused by the environment variables.

288

Last change: 07 November 1985

Sun Release 3.2

OVERVIEW ( 1 )

USER COMMANDS

OVERVIEW(l)

NAME

overview - run a program from SunView that takes over the screen
SYNOPSIS

overview [generic_toolJags] program_name [ arguments] ...
DESCRIPTION

Bitmap graphics based programs that are not SunView based can be run from SunView using overview.
Overview shows an icon in SunView when overview is brought up iconic (-Wi flag) or when the program
being run by overview is suspended (for example using ctrl-Z). Opening the overview icon, or starting
overview non-iconic, starts the program named on the command line. Overview supresses SunView so that
SunView window applications won't interfere with the program's display output or input devices.
Overview is mainly designed to run programs that fit the following profile:
own display
The program needs to own the bits on the screen. It doesn't use the sunwindow or suntool
libraries to arbitrate the use of the display and input devices between processes.
keyboard input from stdin
The program takes keyboard input from stdin directly.
mouse input from Idevlmouse
The program takes locator input from the mouse directly.
SEE ALSO

Windows and Window-Based Tools: Beginner's Guide
BUGS

Users of overview on a Prism need to be aware of the existence of plane groups for pre-3.2 applications.
You can't successfully run pre-3.2 applications under overview if overview itself is running in the color
buffer. If you start overview so that it is not running in the overlay plane then the enable plane wouldn't be
properly set up for viewing of the application running under overview. This means that you can't run overview with the -Wf or -Wb flags. Also, you can't run overview on a desktop created by sun tools using the
-8bit_color_only option.
NAME

pack, peat, unpack - compress and expand files
SYNOPSIS

pack [ - ] [ -f] filename ...
pcat filename . ..
unpackfilename ...
DESCRIPTION

pack attempts to store the specified files in a packed form using Huffman (minimum redundancy) codes on
a byte-by-byte basis. Wherever possible (and useful), each input file filename is replaced by a packed file
filename.z with the same access modes, access and modified dates, and owner as those of filename. If pack
is successful, filename will be removed.
Packed files can be restored to their original form using unpack or pcat.
The amount of compression obtained depends on the size of the input file and the frequency distribution of
its characters.
Because a decoding tree forms the first part of each .z file, it is usually not worthwhile to pack files smaller
than three blocks unless the distribution of characters is very skewed. This may occur with printer plots or
pictures.

Sun Release 3.2

Last change: 9 April 1986

289

PACK ( 1)

USER COMMANDS

PACK ( 1)

Typically, large text-files are reduced to 60-75% of their original size. Load modules, which use a larger
character set and have a more uniform distribution of characters, show little compression. Their packed
versions come it?- at about 90% of the original size.
No packing will occur if:
the file appears to be already packed
the file name has more than 12 characters
the file has links
the file is a directory
the file cannot be opened
no disk storage blocks will be saved by packing
a file called name.z already exists
the .z file cannot be created
an I/O error occurred during processing
The last segment of the filename must contain no more than 12 characters to allow space for the appended
.z extension. Directories cannot be packed.
.

pcat does for packed files what cat (1 V) does for ordinary files, except that pcat cannot be used as a filter.
The specified files are unpacked and written to the standard output. To view a packed file named name.z
use:
peat filename .z
or just:

peat filename
To make an unpacked copy without destroying the packed version, use

peat filename> newname
Failure may occur if:
the filename (exclusive of the .z) has more than 12 characters;
the file cannot be opened;
the file does not appear to be the output of pack.

unpack expands files created by pack. For each file name specified in the command, a search is made for a
file called name.z (or just name, if name ends in .z). If this file appears to be a packed, it is replaced by its
expanded version. The new file has the .z suffix stripped from its name, and has the same access modes,
access and modification dates, and owner as those of the packed file. Failure may occur for the same reasons that it may in pcat, as well as for the following:
a file with the "unpacked" name already exists
the unpacked file cannot be created.
OPTIONS

Print compression statistics for the following filename or names on the standard output. Subsequent -'s between filenames toggle statistics off and on.

-f

Force packing of filename. This is useful for causing an entire directory to be packed, even if
some of the files will not benefit.

DIAGNOSTICS
pack returns the number of files that it failed to compress.

peat returns the number of files it was unable to unpack.
unpack returns the number of files it was unable to unpack.
SEE ALSO
cat( 1), compact( 1)

290

Last change: 9 Apri11986

Sun Release 3.2

PAGESIZE ( 1 )

USER COMMANDS

PAGESIZE ( 1 )

NAME

pagesize - print system page size
SYNOPSIS

pagesize
DESCRIPTION
Pagesize prints the size of a page of memory in bytes, as returned by getpagesize(2). This program is useful in constructing portable shell scripts.
SEE ALSO
getpagesize(2)

Sun Release 3.2

Last change: 3 April 1983

291

PASSWD(l)

USER COMMANDS

PASSWD( 1)

NAME

passwd - change login password
SYNOPSIS

passwd [ -f filename] [ username ]
DESCRIPTION

This command changes (or installs) a password associated with the username (your own by default).
passwd prompts for the old password and then for the new one. You must supply both, and the new password must be typed twice to forestall mistakes.

New passwords should be at least five characters long, if they combine upper and lower-case characters, or
at least six characters long if in monocase. Users that persist in entering shorter passwords are compromising their own security.
Only the owner of the name or the super-user may change a password; the owner must prove he knows the
old password.
Use yppasswd to change your password in the network yellow pages. This will not affect your local password, or your password on any remote machines on which you have accounts.
OPTIONS
-f

Treat file as the password file.

FILES

/etc/passwd
/etc/yp/passwd
SEE ALSO

login(l), passwd(5), yppasswd(l)
Robert Morris and Ken Thompson, UNIX Password Security

BUGS
passwd will change a local password, but not a password in the network Yellow Pages. Refer to
yppasswd(l) for information on how to change a Yellow Pages password.

292

Last change: 23 September 1985

Sun Release 3.2

PASTE ( 1)

USER COMMANDS

PASTE(I )

NAME

paste - merge same lines of several files or subsequent lines of one file
SYNOPSIS
paste file 1 file2 ...
paste -dlist filel file2 ...
paste -s [ -dIist ] filel file2 ...
DESCRIPTION
In the first two forms, paste concatenates corresponding lines of the given input files filel , file2, etc. It
treats each file as a column or columns of a table and pastes them together horizontally (parallel merging).
It is the counterpart of cat which concatenates vertically, i.e., one file after the other. In the last form
above, paste replaces the function of an older command with the same name by combining subsequent
lines of the input file (serial merging). In all cases, lines are glued together with the tab character, or with
characters from an optionally specified list. paste can be used as a filter, if - is used in place of a filename.
OPTIONS
-d

Without this option, the new-line characters of each but the last file (or last line in case of the-s
option) are replaced by a tab character. This option allows replacing the tab character by one or
more alternate characters in list. The list is used circularly, i.e., when exhausted, it is reused. In
parallel merging (i.e., no -s option), the lines from the last file are always terminated with a newline character, not from the list. list may contain the special escape sequences: \n (new-line), \t
(tab), \\ (backs lash), and \0 (empty string, not a null character). Quoting may be necessary, if
characters have special meaning to the shell.

-s

Merge subsequent lines rather than one from each input file. Use tab for concatenation, unless list
is specified with -d. Regardless of the list, the very last character of the file is forced to be a
new-line.

EXAMPLES
Is I paste -d" " -

Is

I paste -

- - -

paste -s -d"\ t\n" file

list directory in one column
list directory in four columns
combine pairs of lines into lines

SEE ALSO
cut(1), grep(l), pr( 1)
DIAGNOSTICS

line too long

Output lines are restricted to 511 characters.

too many files

Except for -s option, no more than 12 input files may be
specified.

Sun Release 3.2

Last change:

293

PC( 1)

USER COMMANDS

PC(1)

NAME

pc - Pascal compiler
SYNOPSIS

pc [ -align _block] [ -b ] [ -c] [ -C] [ -dryrun ] [ -Dname [=def] ] [float_option]
[ -g] [ -belp] [ -H ] [ -mame ... ] [ -Ipathname] [ -J ] [ -I] [ -Ilib ]
[ -lpfc] [ -L ] [ -0 ouifile ] [ -0] [ -p ] [ -pg] [ -pipe] [ -P ]
[ -Qoption prog opt] [ -Qpath pathname] [ -Qproduce sourcetype] [ -R ] [ -s ]
[-s ] [-tdir ] [ -temp=dir] [ -time] [ -Uname ] [ -v] [ -V] [ -w] [ -z ] [ -Z ] sourcefile ...
DESCRIPTION

pc is the Sun Pascal compiler. If given an argument file ending with .p, pc compiles the file and leaves the
result in an executable file, called a.out by default
A program may be separated into multiple.p files. pc compiles a number of .p files into object files (with
the extension .0 in place of .p). Object files may then be linked into an executable file. Exactly one object
file must supply a program statement to successfully create an executable file. The rest of the files must
consist only of declarations which logically nest within the program. References to objects shared between
separately compiled files are allowed if the objects are header files declared with include statements.
Names of header files must end with .h. Header files may only be included at the outermost level, and thus
declare only global objects. To allow external functions and procedures to be declared, an external
directive has been added, whose use is similar to the forward directive but restricted to appear only in .h
files. function and procedure bodies may not appear in .h files. A binding phase of the compiler checks
that declarations are used consistently, to enforce the type checking rules of Pascal.
Filenames ending in .il are taken to be in-line expansion code template files; these are used to expand calls
to selected routines in-line when the -0 option is in effect.
Object files created by other language processors may be linked together with object files created by pc.
The functions and procedures they define must have been declared in .h files included by all the .p files
which call those routines.
Pascal's calling conventions are compatible with those of C, with var parameters passed by address and
other parameters passed by value.

pc(1) supports ISO Level 1 Standard Pascal, including conformant array parameters. Deviations from the
ISO Standard are noted under BUGS below.
See the Pascal User's Manual for details.
OPTIONS

See ld(l) for link-time options.
-align _block

Cause the global symbol whose Pascal name is block to be page-aligned: its size is
increased to a whole number of pages, and its first byte is placed at the beginning of a
page.

-b

Buffer the file output in units of disk blocks, rather than lines.

-c

Suppress linking with Id(1) and produce a.o file for each source file.

-C

Compile code to perform subscript and subrange checks, and verify assert statements.
Note that pointers are not checked. This option differs significantly from the -C option of
the cc compiler.

-dryrun

Show but do not execute the commands constructed by the compilation driver.

-Dname[=def] Define a symbol name to the C preprocessor (cpp(1». Equivalent to a #define directive
in the source. If no def is given, name is defined as '1'.
float_option

Floating -point code generation option. Can be one of:

-f68881
in-line code for the Motorola 68881 floating-point coprocessor (supported only

294

Last change: 29 May 1986

Sun Release 3.2

PC( 1)

USER COMMANDS

PC( 1)

on Sun-3).
-ffpa

in-line code for the Sun Floating-Point Accelerator (supported only on Sun-3).

-fsky

in-line code for the Sky floating-point processor (supported only on Sun-2).

-fsoft

software floating-point calls (This is the default).

-fswitch
run-time-switched floating-point calls. The compiled object code is linked at
runtime to routines that support one of the above types of floating point code.
This was the default in previous releases. Only for use with programs that are
floating-point intensive, and which must be portable to machines with various
floating-point options.

-g

Produce additional symbol table information for dbx(l) and pass the -Ig flag to ld(l).

-help

Display helpful information about pc.

-H

Compile code to perform range checking on pointers into the heap.

-iname ...

Produce a listing for the specified procedures, functions and include files.

-Ipathname

Add pathname to the list of directories in which to search for #include files with relative
filenames (not beginning with slash I). The preprocessor first searches for #include files
in the directory containing sourcefile then in directories named with -I options (if any),
and finally, in lusrlinclude .
J

-J

Generate 32-bit offsets in switch statement labels.

-I

Make a program listing during translation.

-Ilib

Link with object library lib (for ld(1».

-Ipfc

Link with common startup code for programs containing mixed Pascal and FORTRAN 77
object files. Such programs should also be linked with the FORTRAN 77 libraries (see
FILES below).

-L

Map upper case letters in keywords and identifiers to lower case.

-ooutfile

Name the output file outfile. outfile must have the appropriate suffix for the type of file to
be produced by the compilation (see FILES, below). outfile cannot be the same as
sourcefile (the compiler will not overwrite the source file).

-0

Optimize the object code.

-p

Prepare the object code to collect data for profiling with prof(I). Invokes a run-time
recording mechanism that produces a mon.out file (at normal termination).

-pg

Prepare the object code to collect data for profiling with gprof(1). Invokes a run-time
recording mechanism that produces a gmon.out file (at normal termination).

-pipe

Use pipes, rather than intermediate files, between compilation stages. (Very cpuintensive.)

-P

Use partial evaluation semantics for the boolean operators and and or. For these operators only, left-to-right evaluation is guaranteed, and the second operand is evaluated only
if necessary to determine the result.

-Qoption prog opt
Pass the option opt to the program pro g. The option must be appropriate to that program
and may begin with a minus sign. prog can be one of: as, cpp, or Id.
-Qpath pathname
Insert directory pathname into the compilation search path (to use alternate versions of
programs invoked during compilation).

Sun Release 3.2

Last change: 29 May 1986

295

PC(I)

USER COMMANDS

PC( 1)

-Qproduce sourcetype
Produce source code of the type sourcetype. sourcetype can be one of:
.pi
Preprocessed Pascal source from cpp (1) .
•0
Object file from as (1) .
.s
Assembler source (from c2,j1 or inline).

-R
-s

Merge data segment with text segment for as(I).

-S

Compile the named program, and leave the assembly language output on the corresponding file suffixed.s. No.o is created.

-temp=dir

Set directory for temporary files to be dire

-time

Report execution times for the various compilation passes.

-Uname

Remove any initial definition of the cpp(l) symbol name. (Inverse of the -D option.)

-v

Verbose. Print the version number of the compiler and the name of each program it executes.

-v

Report hard errors for nonstandard Pascal constructs.

-w
-z

Suppress warning messages.

-z

Initialize local variables to zero.

Accept standard Pascal only; nonstandard constructs and extensions cause warning diagnostics.

Allow execution profiling with pxp(l) by generating statement counters, and arranging
for the creation of the profile data file pmon.out when the resulting object is executed.

Other arguments are taken to be linker option arguments or libraries of pc-compatible routines. Certain
flags can also be controlled by comments within the program, as described in the Pascal User's Manual in
the Sun Pascal Manual.
ENVIRONMENT
FLOAT_OPTION When no floating-point option is specified, the compiler uses the value of this environ-

ment variable (if set). Recognized values are: f68881, ffpa, fsky, fswitch and fsoft.
FILES

a.out
file .a
file .c
file.d
file .r
file.F
file .il
file .0
file.p
file .pi
file.r
file.s
file.S
file.tcov
lliblc2
Iliblcompile
Iliblcpp
lliblcrtO.o
Ilib!fl
lliblF crt1 .0
lliblgcrtO.o

296

executable output file
library of object files
C source file
tcov(1) test coverage input file
F77 source file
F77 source file for cpp (1)
inline expansion file
object file
Pascal source file
Pascal source after preprocessing with cpp (1)
Ratfor source file
assembler source file
assembler source for cpp(l)
output from tcov(l)
object code optimizer
compiler command-line processing driver
macro preprocessor
runtime startoff
code generator
startup code for -rsoft option
startoff for profiling with gprof( 1)

Last change: 29 May 1986

Sun Release 3.2

PC( 1)

USER COMMANDS

llibllibc.a
lliblmcrtO.o
lliblMcrtl.o
lliblScrtl.o
lliblWcrtl.o
lusrlinclude
lusrlliblhow yc
lusrllibllibc y.a
lusrllibllibF77.a
I usrlliblinline
lusrllibllibI77.a
lusrllibllibm.a
lusrllibllibpc.a
lusrllibllibpfc .a
lusrlliblpcO
lusrlliblpc2.il
I usrlliblpc3
lusrllibllibU77.a
Ioopl*

mon.out
gmon.out

PC(l )

standard library, see intro (3)
startoff for profiling with prof(l)
startup code for -f68881 option
startup code for -fsky option
startup code for -tTpa option
standard directory for #include files
basic usage explanation
profiling library, see intro (3)
FORTRAN 77 library
inline expander of library calls
FORTRAN 77 library
math library
intrinsic functions and Pascal 110 library
startup code for combined Pascal and FORTRAN 77 programs
compiler front end
inline expansion templates for Pascal library
separate compilation consistency checker
FORTRAN 77 library
compiler temporary files
file produced for analysis by prof( 1)
file produced for analysis by gprof(l) intro(3)

SEE ALSO
pi(l), pxp(l), pxref(l)

Pascal Programmer's Guide
Floating-Point Programmer's Guide for the Sun Workstation
DIAGNOSTICS
For a basic explanation do
tutorial% pc
In the diagnostic output of the translator, lines containing syntax errors are listed with a flag indicating the
point of error. Diagnostic messages indicate the action which the recovery mechanism took in order to be
able to continue parsing. Some diagnostics indicate only that the input is 'malformed.' This occurs if the
recovery can find no simple correction to make the input syntactically valid
Semantic error diagnostics indicate a line in the source text near the point of error. Some errors evoke
more than one diagnostic to help pinpoint the error; the follow-up messages begin with an ellipsis ' ... '.
The first character of each error message indicates its class:
E
Fatal error; no code will be generated.
e
Nonfatal error.
w
Warning - a potential problem.
s
Nonstandard Pascal construct warning.

If a severe error occurs which inhibits further processing, the translator will give a diagnostic and then
'QUIT'.
Names whose definitions conflict with library definitions draw a warning. The library definition will be
replaced by the one supplied in the Pascal program. Note that this can have unpleasant side effects.
BUGS

The keyword packed is recognized but has no effect. The ISO standard requires packed and unpacked
structures to be distinguished for portability reasons.
Binary set operators are required to have operands with identical types; the ISO standard allows different
types, as long as the underlying base types are compatible.
The -z flag doesn't work for separately compiled files.

Sun Release 3.2

Last change: 29 May 1986

297

PERFMETER ( 1 )

USER COMMANDS

PERFMETER ( 1 )

NAME

perfmeter - meter display of system performance values
SYNOPSIS
perfmeter [ -s sample-time] [ -b h-hand-int] [ -m m-hand-int ]
[ -M smax minmax maxmax] [ -v value] [ hostname ]
DESCRIPTION
perfmeter starts a tool whose iconic form is a meter displaying a system performance value, and whose
open form is a strip chart of that value. By default, the meter is updated with a sample-time of 2 seconds.
The hour hand represents the average over a 20-second interval; the minute hand, an average over 2
seconds. The default value displayed is the percent of cpu being utilized.

These defaults can be modified with command line options, or dynamically after the tool has been started
using a popup menu.

If there is no hostname argument, then the data displayed will be for the local host In either case, the
rstatd(8C) daemon must be running on the machine for which statistics are being reported.
The maximum scale value for the strip chart will automatically double or halve to accommodate increasing
or decreasing values for the host machine. This scale can be restricted to a certain range with the -M
option.
OPTIONS

-s sample-time
Set the sample time to sample-time seconds.
-b h-hand-int
Set the hour-hand interval to h-hand-int seconds.
-m m-hand-int

Set the minute hand interval to m-hand-int seconds.

-M smax minmax maxmax
Set a range of maximum values for the strip chart. Values for each of the arguments should be
powers of 2. smax sets the starting maximum-value. minmax sets the lowest allowed maximumvalue for the scale. maxmax sets the highest allowed maximum-value.
-v value

Set the performance value to be monitored to one of:
cpu

percent of cpu being utilized

pkts

ethernet packets per second

page

paging activity in pages per second

swap

jobs swapped per second

intr

number of device interrupts per second

disk

disk traffic in transfers per second

cntxt

number of context switches per second

load

average number of jobs running on the server over the last minute

colls

collisions per second detected on the ethemet

errs

errors per second on receiving packets

COMMANDS

The value being displayed can be changed by clicking the tool with the rightmost mouse button, and then
selecting the appropriate menu item. The other meter parameters can be modified by moving the mouse
cursor into the tool (either open or closed), and typing:
m

298

decreases minutehandintv by one

Last change: 29 May 1986

Sun Release 3.2

PERFMETER ( 1 )

USER COMMANDS

M

increases minutehandintv by one

h

decreases hourhandintv by one

H

increases hourhandintv by one

1-9

Sets sampletime to a range from 1 to 9 seconds.

PERFMETER ( 1 )

FILES

/ etc/ servers

starts statistics server

SEE ALSO
perfmon(l), netstat(8C), vmstat(8), suntoo1s(l), rstatd(8C)

Sun Release 3.2

Last change: 29 May 1986

299

PERFMON(l)

USER COMMANDS

PERFMON(I)

NAME

perfmon - graphical display of general system statistics
SYNOPSIS

perfmon [statistic ] ...
DESCRIPTION

Perfmon provides a graphical display of the system-wide performance statistics and updates them approximately once a second It should be executed from a graphics tool inside the SunView system. The time
interval between updates can be adjusted by typing one of the following characters while the mouse is in
the graphics subwindow:

s

increases the interval by 0.05 seconds (small s means get slower by a little).

S

increases the interval by one second (capital S means get Slower by a lot).

f

decreases the interval by 0.05 seconds (small/means getfaster by a little).

F

decreases the interval by one second (capital F means get Faster by a lot).

R

resets the interval to the standard 1.05 seconds.

In addition, typing:
H, h or?
lists the characters that perfman is listening for.

Q or q causes perfman to cease executing.
If no statistic argument is given, perfmon displays all statistics. A tick is placed on the lines separating the
graphs once every fifteen seconds (due to scheduling vagaries, these ticks may not be evenly spaced).
Statistics
user

is the percentage of total CPU time spent in normal and low priority user processes.

system is the percentage of total CPU time attributed to system calls and overhead.
idle

is the percentage of total CPU time spent idle.

free

is the amount of available real memory (in Kbytes).

disk

is the total number of disk transfers performed.

interrupts
is the total number of interrupts serviced.
input

is the total number of input packets received.

output is the total number of output packets transmitted.
collision
is the total number of collisions between packets observed on the network.
SEE ALSO

netstat(8), perfmeter( 1), suntools{ 1), vmstat(8)
BUGS

Perfmon should use rstatd(8C).

300

Last change: 1 February 1985

Sun Release 3.2

PG( 1)

USER COMMANDS

PG( 1)

NAME

pg - file perusal filter for soft-copy terminals
SYNOPSIS

lusr/5binlpg [ -number] [ -p string] [ -cefns ] [ +linenumber ] [ +Ipatternl ] [files ••• ]
DESCRIPTION
Note:

Optional Software (System V Option). Refer to Installing
mation on how to install this command.

UNIX

on the Sun Workstation for infor-

The pg command is a filter which allows the examination of files one screenful at a time on a soft-copy terminal. Afile of -, or nofiles specified, indicates that pg should read from the standard input. Each screenful is followed by a prompt. If the user types a carriage return, another page is displayed; other possibilities are enumerated below.
This command is different from previous paginators in that it allows you to back up and review something
that has already passed. The method for doing this is explained below.
In order to determine terminal attributes, pg scans the terminfo(5V) data base for the terminal type
specified by the environment variable TERM. If TERM is not defined, the terminal type dumb is assumed
The responses that may be typed when pg pauses can be divided into three categories: those causing further
perusal, those that search, and those that modify the perusal environment.
Commands which cause further perusal normally take a preceding address, an optionally signed number
indicating the point from which further text should be displayed. This address is interpreted in either pages
or lines depending on the command. A signed address specifies a point relative to the current page or line,
and an unsigned address specifies an address relative to the beginning of the file. Each command has a
default address that is used if none is provided.
The perusal commands and their defaults are as follows:

(+1) or 
This causes one page to be displayed. The address is specified in pages.
(+1) I

With a relative address this causes pg to simulate scrolling the screen, forward or backward, the
number of lines specified. With an absolute address this command prints a screenful beginning at
the specified line.

(+1) d or AD
Simulates scrolling half a screen forward or backward.

The following perusal commands take no address .
• or AL

Typing a single period causes the current page of text to be redisplayed.

$

Displays the last windowful in the file. Use with caution when the input is a pipe.

The following commands are available for searching for text patterns in the text. The regular expressions
described in ed (1) are available. They must always be terminated by a , even if the -n option is
specified.

i/patternl
Search forward for the i th (default i = 1) occurrence of pattern. Searching begins immediately
after the current page and continues to the end of the current file, without wrap-around.
A

i"pattern
i?pattern?
Search backwards for the ith (default i=1) occurrence of pattern. Searching begins immediately
before the current page and continues to the beginning of the current file, without wrap-around.
The notation is useful for Adds 100 terminals which will not properly handle the ?
A

Sun Release 3.2

Last change: 17 April 1986

301

PG( 1)

USER COMMANDS

PG(l)

After searching, pg will normally display the line found at the top of the screen. This can be modified by
appending m or b to the search command to leave the line found in the middle or at the bottom of the window from now on. The suffix t can be used to restore the original situation.
The user of pg can modify the environment of perusal with the following commands:
io

Begin perusing the ith next file in the command line. The i is an unsigned number, default value
is 1.

ip

Begin perusing the ith previous file in the command line. i is an unsigned number, default is 1.

iw

Display another window of text. If i is present, set the window size to i.

sfilename
Save the input in the named file. Only the current file being perused is saved. The white space
between the s and filename is optional. This command must always be terminated by a , even if the -0 option is specified.
h

Help by displaying an abbreviated summary of available commands.

q or Q

Quitpg.

!command
Command is passed to the shell, whose name is taken from the SHELL environment variable. If
this is not available, the default shell is used. This command must always be terminated by a
, even if the -0 option is specified.
At any time when output is being sent to the terminal, the user can hit the quit key (normally control-\) or
the interrupt (break) key. This causes pg to stop sending output, and display the 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.
If the standard output is not a terminal, then pg acts just like cat (1 V), except that a header is printed before
each file (if there is more than one).
OPTIONS

The command line options are:
-number
An integer specifying the size (in lines) of the window that pg is to use instead of the default. (On
a terminal containing 24 lines, the default window size is 23).
-p string
Causes pg to use string as the prompt. If the prompt string contains a "%d", the first occurrence
of "%d" in the prompt will be replaced by the current page number when the prompt is issued.
The default prompt string is ":".

-c

Home the cursor and clear the screen before displaying each page. This option is ignored if
clear_screen is not defined for this terminal type in the terminfo(5V) data base.

-e

Causes p g not to pause at the end of each file.

-f

Normally, pg splits lines longer than the screen width, but some sequences of characters in the text
being displayed (e.g., escape sequences for underlining) generate undesirable results. The-f
option inhibits pg from splitting lines.

-0

Normally, commands must be terminated by a  character. This option causes an
automatic end of command as soon as a command letter is entered.

-s

Causes pg to print all messages and prompts in standout mode (usually inverse video).

+linenumber
Start up at linen umber .
+Ipatternl

302

Last change: 17 Apri11986

Sun Release 3.2

PG( 1)

USER COMMANDS

PG(1 )

Start up at the first line containing the regular expression pattern.
EXAMPLE
A sample usage of pg in reading system news would be
news I pg -p ,. (page %d):"
NOTES
While waiting for terminal input, pg responds to BREAK, DEL, and " by terminating execution. Between
prompts, however, these signals interrupt pg's current task and place the user in prompt mode. These
should be used with caution when input is being read from a pipe, since an interrupt is likely to terminate
the other commands in the pipeline.
Users of more (1) will find that the z and f commands are available, and that the terminal I, ", or ? may be
omitted from the searching commands.
FILES
893.sp 38u
lusr/lib/terminfol*
Terminal information data base
Itmplpg*
Temporary file when input is from a pipe
SEE ALSO
crypt( 1), ed( 1), grep( 1V), terminfo(4)
BUGS
If terminal tabs are not set every eight positions, undesirable results may occur.
When using pg as a filter with another command that changes the terminal I/O options (e.g., crypt(I», terminal settings may not be restored correctly.

Sun Release 3.2

Last change: 17 April 1986

303

PI( 1)

PI( I)

USER COMMANDS

NAME

pi - Pascal interpreter code translator
SYNOPSIS

pi [ -b ] [ -I] [ -L] [ -n] [ -0 name] [ -p] [ -s] [ -t] [ -u] [ -w] [ -z]
[ -i name. •• ] name.p
DESCRIPTION
Pi translates the program in the file name.p leaving interpreter code in the file obj in the current directory.
The interpreter code can be executed using px. Pix performs the functions of pi and px for 'load and go'

Pascal.
Both pi and pc (1) support ISO Levell Standard Pascal, including conformant array parameters. Deviations
from the ISO Standard are noted under BU GS below.
OPTIONS

The following flags are interpreted by pi; the associated options can also be controlled in comments within
the program; see the Pascal User's Manual in the Sun Fortran and Pascal
Manual for details.
-b

Buffer the file output in units of disk blocks, rather than lines.

-i name
Enable the listing for any specified procedures, functions, and include files.
-I

Make a program listing during translation.

-L

Map all identifiers and keywords to lower case.

-n

Begin each listed include file on a new page with a banner line.

-0

name

N arne the final output file name instead of a.out.
-p

Suppress the post-mortem control flow backtrace if an error occurs; suppress statement limit counting.

-s

Accept standard Pascal only; non-standard constructs cause warning diagnostics.

-t

Suppress runtime tests of subrange variables and treat assert statements as comments.

-u

Card image mode; only the first 72 characters of input lines are used.

-w

Suppress warning diagnostics.

-z

Allow execution profiling with pxp by generating statement counters, and arranging for the creation
of the profile data file prrwn.out when the resulting object is executed.

FILES

file.p
file.i
lusr/lib/pi3.*strings
lusrllib/howyi*

obj

input file
include file(s)
text of the error messages
basic usage explanation
interpreter code output

SEE ALSO

pix(l), px(l), pxp(l), pxref(l)
Pascal Programmer's Guide
DIAGNOSTICS

For a basic explanation do
tutorial% pi

304

Last change: 7 November 1984

Sun Release 3.2

PI( 1)

USER COMMANDS

PI( 1)

In the diagnostic output of the translator, lines containing syntax errors are listed with a flag indicating the
point of error. Diagnostic messages indicate the action which the recovery mechanism took in order to be
able to continue parsing. Some diagnostics indicate only that the input is 'malformed.' This occurs if the
recovery can find no simple correction to make the input syntactically valid.
Semantic error diagnostics indicate a line in the source text near the point of error. Some errors evoke
more than one diagnostic to help pinpoint the error; the follow-up messages begin with an ellipsis ' ... '.
The first character of each error message indicates its class:
E
e
w
s

Fatal error; no code will be generated.
Non-fatal error.
Warning - a potential problem.
Non-standard Pascal construct warning.

If a severe error occurs which inhibits further processing, the translator will give a diagnostic and then
'QUIT'.
BUGS

The keyword packed is recognized but has no effect. The ISO standard requires packed and unpacked
structures to be distinguished for portability reasons.
Binary set operators are required to have operands with identical types; the ISO standard allows different
types, as long as the underlying base types are compatible.
For clarity, semantic errors should be flagged at an appropriate place in the source text, and multiple
instances of the 'same' semantic error should be summarized at the end of a procedure or function rather
than evoking many diagnostics.
When include files are present, diagnostics relating to the last procedure in one file may appear after the
beginning of the listing of the next

Sun Release 3.2

Last change: 7 November 1984

305

PIX ( 1)

USER COMMANDS

PIX ( 1)

NAME

pix - Pascal translator and interpreter
SYNOPSIS
pix [ options] [ -i name ... ] name.p [ argument ... ]
DESCRIPTION
Pix is a 'load and go' version of Pascal which combines the functions of the translator pi and the interpreter
px. Pix uses pi to translate the program in the file name.p and, if there were no fatal errors during translation, calls px to execute the resulting interpretive code with the specified arguments. A temporary file is
used for the object code; the file obj is neither created nor destroyed

Options are as described under pi(I).
FILES

lusr/ucb/pi
/usr/ucb/px
/tmp/pix*
lusr/lib/howyix

Pascal translator
Pascal interpreter
temporary
basic explanation

SEE ALSO
The Pascal User's Manual in the Pascal/or the Sun Workstation Manual.
pi(I), px(l)
DIAGNOSTICS
For a basic explanation do
tutorial% pix

306

Last change: 7 November 1984

Sun Release 3.2

PLOT ( IG)

USER COMMANDS

PLOT ( IG)

NAME

plot, aedplot, bgplot, crtplot, dumbplot, gigiplot, hpplot, t300, t300s, t4013, t450, tek - graphics filters for
various plotters
SYNOPSIS

plot [ - Tterminal ]
DESCRIPTION
plot reads plotting instructions (see plot(5» from the standard input and produces plotting instructions suitable for a particular terminal on the standard output.

If no terminal is specified, the environment variable TERM is used. The default terminal is tek.

Except for ver, the following terminal-types can be used with Ipr -g to produce plotted output:
2648 \ 2648a \ h8 \ hp2648 \ hp2648a
Hewlett Packard 2648 graphics terminal.
300

DASI 300 or GSI terminal (Diablo mechanism).

300s\300S

DASI 300s terminal (Diablo mechanism).

450

DASI Hyterm 450 terminal (Diablo mechanism).

4013

Tektronix 4013 storage scope.

4014\ tek

Tektronix 4014 and 4015 storage scope with Enhanced Graphics Module. (Use 4013 for
Tektronix 4014 or 4015 without the Enhanced Graphics Module).

aed

AED 512 color graphics terminal.

bgplot \ bitgraph
BBN bitgraph graphics terminal.
crt

Any crt terminal capable of running vi(I).

dumb \ un \ unknown
Dumb terminals without cursor addressing or line printers.
gigi \ vtl25

DEC vt125 terminal.

h7 \ hp7 \ hp7221
Hewlett Packard 7221 graphics terminal.
var

Benson Varian printer-plotter

ver

Versatec D1200A printer-plotter. The output is scan-converted and suitable input to Ipr -v.

FILES

lusrlbinlt300
lusrlbinlt300s
lusrlbinlt4013
lusrlbinlt450
lusrlbinlaedplot
lusrlbinlcrtplot
Iusrlbinlgigiplot
lusrlbinlplot
lusrlbinlbgplot

lusr/binldumbplot
lusr/binlhpplot
Iusrlbinlvplot
lusr/binltek
lusr/binlt450
lusr/binlt300
lusr/binlt300s
lusr/binlvplot
lusrltmplvplot nnnnnn

SEE ALSO

graph(lG), lpr(l), plot(3X), plot(5), rasterfile(5)

Sun Release 3.2

Last change: 30 May 1986

307

PMERGE(I)

USER COMMANDS

PMERGE(I)

NAME

pmerge - pascal file merger
SYNOPSIS

pmerge name.p •••
DESCRIPTION
Pmerge assembles the named Pascal files into a single standard Pascal program. The resulting program is

listed on the standard output It is intended to be used to merge a collection of separately compiled
modules so that they can be run through pi, or exported to other sites.
FILES

lusr/tmp/MG*

default temporary files

SEE ALSO

pc(I), pi(I),
Pascal Programmer's Guide

BUGS
Very minimal error checking is done, so incorrect programs will produce unpredictable results. Block
comments should be placed after the keyword to which they refer or they are likely to end up in bizarre
places.

308

Last change: 11 November 1983

Sun Release 3.2

PR( IV)

USER COMMANDS

PR( IV)

NAME

pr - prepare file(s) for printing, perhaps in multiple columns
SYNOPSIS
pr [ -n ] [ +n] [ -b string] [ -wn] [ -f] [ -In] [ -t] [ -sc ] [ -m ] [file] ...
SYSTEM V SYNOPSIS

lusrlSbinlpr [ -r] [ -p ] [ -n] [ +n ] [ -b string] [ -nck] [ -eck ] [ -ick] [ -d ] [ -wn ]
[ -on ] [ -f] [ -In ] [ -t ] [ -sc ] [ -m ] [ -a ] [file] ...
DESCRIPTION
pr prepares one or morefiles for printing. By default, the output is separated into pages headed by a date,
the name of the file, and the page number. pr prints its standard input if there are no file arguments.
Formfeed characters in the input files cause page breaks in the output, as expected.

By default, columns are of equal width, separated by at least one space; lines that do not fit are truncated.
If the -s option is used, lines are not truncated and columns are separated by the separation character.
Inter-terminal messages via write are forbidden during apr.
OPTIONS
Options apply to all following files but may be reset betweenfiles:

-n

Produce n-column output For example:

Print
the
lines

of
one
file

in
three
columns.

Columns are not balanced; if, for example, there are as many lines in the file as there are lines
on the page, -only one column will be printed. Even if the -t option (see below) is specified,
blank lines will be printed at the end of the output to pad it to a full page.

+n

Begin printing with page n.

-b string Use string, instead of the file name, in the page header.

-wn

For multicolumn output, take the width of the page to be n characters instead of the default 72.

-f

Use formfeeds instead of NEWLINES to separate pages. A formfeed is assumed to use up two
blank lines at the top of a page. Thus this option does not affect the effective page length.

-In

Take the length of the page to be n lines instead of the default 66.

-t

Do not print the 5-line header or the 5-line trailer normally supplied for each page. Pages are
not separated when this option is used, even if the -f option was used. The -t option is
intended for applications where the results should be directed to a file for further processing.

-sc

Separate columns by the single character c instead of by the appropriate amount of white space.
A missing c is taken to be a tab.

-m

Print allfiles simultaneously, each in one column, for example:

Print
the
lines
of
file
one.

Print
the
lines
of
file
two.

The
third
file's
lines
go
here.

SYSTEM V OPTIONS
When the -n option is specified for multicolumn output, columns are balanced; for example, if there are as
many lines in the file as there are lines to be printed, and two columns are to be printed, each column will
contain half the lines of the file. If the -t option is specified, no blank lines will be printed to pad the last
page.

Sun Release 3.2

Last change: 17 July 1986

309

PR( IV)

USER COMMANDS

PR( IV)

The options -e and -i are assumed for multicolumn output. The -m option overrides the -k and -a
options.
The -f option does not assume that the formfeed uses up two blank lines; blank lines will be printed after
the formfeed, ifnecessary.
-r

Print no diagnostic reports if afile can't be opened, or if it is empty.

-p

Pause before beginning each page if the output is directed to a terminal (pr will ring the bell at the
terminal and wait for a carriage return).

-nck

Provide k-digit line numbering (default for k is 5). The number occupies the first k+l character
positions of each column of normal output or each line of -m output. If c (any non-digit character) is given, it is appended to the line number to separate it from whatever follows (default for c is
a tab).

-eck

Expand input tabs to character positions k+l, 2*k+l, 3*k+l, etc. If k is 0 or is omitted, default
tab settings at every eighth position are assumed. Tab characters in the input are expanded into
the appropriate number of spaces. If c (any non-digit character) is given, it is treated as the input
tab character (default for c is the tab character).

-ick

In output, replace white space wherever possible by inserting tabs to character positions k+l,
2*k+l, 3*k+I, etc. If k is 0 or is omitted, default tab settings at every eighth position are
assumed. If c (any non-digit character) is given, it is treated as the output tab character (default
for c is the tab character).

-d

Double-space the output.

-ok

Offset each line by k character positions. The number of character positions per line is the sum of
the width and offset

-a

When combined with the -n option, print multicolumn output across the page. For example:
Print
the
lines
of
one
file
in
three
columns.

EXAMPLES

Print a file called dreadnought on the printer - this is the simplest use of pr:
tutorial% pr dreadnought I Jpr
tutorial%
Produce three laminations of a file called ridings side by side in the output, with no headers or trailers, the
results to appear in the file called Yorkshire:
tutorial% pr -m -t ridings ridings ridings > Yorkshire
tutorial%
FILES

ldev/tty*

to suspend messages.

SEE ALSO

cat(IV),lpr(l)
DIAGNOSTICS

can't print 0 cols, using I instead.
-0 was specified as a -n option.
pr: bad key key
An illegal option was given.
pr: No room for columns.
The number of columns requested won't fit on the page.
pr: Too many args
More than 10 files were specified with the -m option.

310

Last change: 17 July 1986

Sun Release 3.2

PR( IV)

USER COMMANDS

PR( IV)

file: error
Afile could not be opened. This diagnostic is not printed if pr is printing on a terminal.
SYSTEM V DIAGNOSTICS

pr: bad option
An illegal option was given.
pr: width too small
The number of columns requested won't fit on the page.
pr: too many files
More than 10 files were specified with the -m option.
pr: page-buffer overflow
The formatting required is more complicated than pr can handle.
pr:outofspace
pr could not allocate a buffer it required.
pr: file -- empty file
The file was empty. This diagnostic is printed after all the files are printed if pr is printing on a
terminal.
pr: can't open file
A file could not be opened This diagnostic is printed after all the files are printed if pr is printing
on a terminal.
BUGS

The options described above interact with each other in strange and as yet to be defined ways.

Sun Release 3.2

Last change: 17 July 1986

311

PRINTENV ( 1 )

USER COMMANDS

PRINTENV ( 1 )

NAME

printenv - print out the environment
SYNOPSIS

printenv [ variable]
DESCRIPTION
printenv prints out the values of the variables in the environment. If a variable is specified, only its value is

printed.
DIAGNOSTICS
If a variable is specified and it is not defined in the environment, printenv returns an exit status of " l' , .
SEE ALSO

sh(l), environ(5V), csh(l), stty(l), tset(l)

312

Last change: 21 April 1986

Sun Release 3.2

PRMAIL( 1)

USER COMMANDS

PRMAIL(l)

NAME

prmail - display waiting mail
SYNOPSIS

prmail [ user] ...
DESCRIPTION
Prmail displays waiting mail for you, or the specified users. The mail is not disturbed.
FILES

lusrlspoollrnaill* waiting mail files
SEE ALSO
biff(l), mail(1), from(1), binmail(1)

Sun Release 3.2

Last change: 7 March 1984

313

PROF(l)

PROF(l)

USER COMMANDS

NAME

prof - display profile data
SYNOPSIS
prof [ -a ] [ -I ] [ -0 ] [ -s] [ -v [ -low [ -high] ] ] [ -z] [object-file [profile-file ... ] ]
DESCRIPTION
Pro/interprets the file produced by the monitor(3) subroutine. In the default case, the symbol table in the
named object file (object-file by default) is read and correlated with the profile file (profile-file by default).
For each external symbol, the percentage of time spent executing between that symbol and the next is
printed (in decreasing order), together with the number of times that routine was called and the number of
milliseconds per call. If more than one profile file is specified, the output represents the sum of the profiles.

To tally the number of calls to a routine, the program must be compiled with the -p option of cc ,f/7 or pc.
This option also means that the profile file is produced automatically.
Beware of quantization errors.
OPTIONS
-a

Report all symbols rather than just external symbols.

-I

Sort the output by symbol value.

-0

sort the output by number of calls.

-s

Produce a summary profile file in mon .sum. This is really only useful when more than one profile
file is specified.

-v [ -low [ -high ]]

Suppress all printing and produce a graphic version of the profile on the standard output for
display by the plot(IG) filters. When plotting, the numbers low and high, (by default 0 and 100),
select a percentage of the profile to be plotted, with accordingly higher resolution.
-z

Print routines which have zero usage (as indicated by call counts and accumulated time).

FILES

mon.out
a.out
mon.sum

for profile
for namelist
for summary profile

SEE ALSO
monitor(3), cc(IV), plot(IG), gprof(l)
BUGS

Pro/is confused by f/7 which puts the entry points at the bottom of subroutines and functions.

314

Last change: 8 October 1984

Sun Release 3.2

PRS(I)

USER eOMMANDS

PRS( 1)

NAME

prs - print an sees file
SYNOPSIS

lusrlsccs/prs [ -d [dataspec] ] [ -r [SID] ] [ -e ] [ -I ] [ -a ] filename •••
DESCRIPTION
prs prints, on the standard output, parts or all of an sees file (see sccsfile(5» in a user supplied format If
a directory is named, prs behaves as though each file in the directory were specified as a named file, except

that non-sees files (last component of the path name does not begin with s.), and unreadable files are
silently ignored. If a name of - is given, the standard input is read, in which case each line is taken to be
the name of an sees file or directory to be processed; non-sees files and unreadable files are silently
ignored.
OPTIONS

Options apply independently to each named file.
-d [ dataspec ]
Specifies the output data specification. The dataspec is a string consisting of sees file data keywords (see DATA KEYWORDS) interspersed with optional user supplied text.
-r [SID]

Specifies the sees ID entification SID string of a delta for which information is desired. If no SID
is specified, the SID of the most recently created delta is assumed.

-e

Requests information for all deltas created earlier than and including the delta designated via the
-r option.

-I

Requests information for all deltas created later than and including the delta designated via the -r
option.

-a

Requests printing of information for both removed, that is, delta type = R, (see rmdel(I» and
existing, that is, delta type = D, deltas. If the -a option is not specified, information for existing
deltas only is provided.

In the absence of the -d options, prs displays a default set of information consisting of: delta-type, release
number and level number, date and time last changed, user-name of the person who changed the file, lines
inserted, changed, and unchanged, the MR numbers, and the comments.
DATA KEYWORDS

Data keywords specify which parts of an sees file are to be retrieved and output All parts of an sees file
(see sccsfile(5» have an associated data keyword. There is no limit on the number of times a data keyword
may appear in a dataspec.
The information printed by prs consists of: 1) the user supplied text; and 2) appropriate values (extracted
from the sees file) substituted for the recognized data keywords in the order of appearance in the
dataspec. The format of a data keyword value is either Simple (S), in which keyword substitution is direct,
or Multi-line (M), in which keyword substitution is followed by a carriage return.
User supplied text is any text other than recognized data keywords. A tab is specified by \t and carriage
return/new-line is specified by \no

Sun Release 3.2

Last change: 18 February 1986

315

PRS( 1)

USER COMMANDS

Keyword
:Dt:
:DL:
:Li:
:Ld:
:Lu:
:DT:
:1:
:R:
:L:
:B:
:S:
:D:
:Dy:
:Dm:
:Dd:
:T:
:Th:
:Tm:
:Ts:
:P:
:DS:
:DP:
:DI:

:Dn:
:Dx:
:Dg:
:MR:
:C:
:UN:
:FL:
:Y:

:MF:
:MP:

:KF:
:BF:

:J:
:LK:
:Q:
:M:
:FB:
:CB:
:Ds:
:ND:

:FD:
:BD:
:GB:

:W:
:A:

:Z:
:F:
:PN:

TABLE 1. sces Files Data Keywords
Data Item
File Section Value
Delta information
Delta Table See below*
Delta line statistics
:Li:/:Ld:/:Lu:
Lines inserted by Delta
nnnnn
Lines deleted by Delta
nnnnn
Lines unchanged by Delta
nnnnn
Delta type
DorR
sces ID string (SID)
:R:.:L:.:B:.:S:
Release number
nnnn
Level number
nnnn
Branch number
nnnn
Sequence number
nnnn
Date Delta created
:Dy:/:Dm:/:Dd:
Year Delta created
nn
Month Delta created
nn
Day Delta created
nn
Time Delta created
:Th:::Tm:::Ts:
Hour Delta created
nn
Minutes Delta created
nn
Seconds Delta created
nn
Programmer who created Delta
Delta sequence number
nnnn
"
Predecessor Delta seq-no.
nnnn
Seq-no. of deltas incl.,
:Dn:/ :Dx:/:Dg:
excl., ignored
Deltas included (seq #)
:DS: :DS: •••
Deltas excluded (seq #)
:DS: :DS: •••
Deltas ignored (seq #)
:DS: :DS: •••
MR numbers for delta
text
Comments for delta
text
User names
User Names text
Flag list
Flags
text
Module type flag
text
MR validation flag
yes or no
MR validation pgm name
text
Keyword error/warning flag "
yes or no
Branch flag
yes or no
yes or no
Joint edit flag
Locked releases
:R: •••
User defined keyword
text
Module name
text
Floor boundary
:R:
Ceiling boundary
:R:
:1:
Default SID
yes or no
Null delta flag
Comments text
File descriptive text
Body
text
Body
text
Gotten body
:Z::M:\t:l:
A form of what string
N/A
A form of what string
N/A
:Z::Y: :M: :I::Z:
@(#)
what string delimiter
N/A
text
N/A
SCCS file name
N/A
text
SCCS file path name
* :Dt:

316

=

PRS(I)

Format
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
lognameS
S
S
S
S
S
S
M
M
M
M
S
S
S
S
S
S
S
S
S
S
S
S
S
M
M
M
S
S
S
S
S

:DT: :1: :D: :T: :P: :DS: :DP:

Last change: 18 February 1986

Sun Release 3.2

PRS(I)

USER COMMANDS

PRS(I)

EXAMPLES

/usr/sccs/prs -d"Users and/or user IDs for :F: are:\n:UN:" s.file
may produce on the standard output:
Users and/or user IDs for s.file are:
xyz
131
abc

lusr/sccs/prs -d"Newest delta for pgm :M:: :1: Created :D: By :P:" -r s.file
may produce on the standard output:
Newest delta for pgm main.c: 3.7 Created 77/1211 By cas
As a special case:

/usrlsccs/prs s.fiIe
may produce on the standard output:

D 1.1 77/1211 00:00:00 cas 1 000000/00000100000
MRs:

b178-12345
b179-54321
COMMENTS:

this is the comment line for s.file initial delta
for each delta table entry of the "D" type. The only option argument allowed to be used with the special
case is the -a option.
FILES

Itmp/pr?????
SEE ALSO

sccs(I), admin(I), delta(I), get(I), help(1), sccsfile(5)
Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

Use help for explanations.

Sun Release 3.2

Last change: 18 February 1986

317

PRT( 1)

USER COMMANDS

PRT(1 )

NAME

prt - print SCCS file
SYNOPSIS

lusrlsccs/prt [-d] [-s] [-a] [-i] [-u] [-f] [-t] [-b] [-e] [-y[SID]] [-c[cutoffJ] [-r[rev-cutoff]] file•••
DESCRIPTION

N.B.: The prt command is an older version of prs(l) that in most circumstances is more convenient to use,
but is less flexible than prs.
Prt prints part or all of an sees file in a useful format. If a directory is named, prt behaves as though each
file in the directory were specified as a named file, except that non-sees files (last component of the pathname does not begin with s.) and unreadable files are silently ignored. If a name of - is given, the standard input is read; each line of the standard input is taken to be the name of an sees file to be processed.
Again, non-sees files and unreadable files are silently ignored.

The keyletter arguments are as follows. Each is explained as though only one named file is to be processed, but the effects of any keyletter argument apply independently to each named file.
-d

This keyletter normally causes the printing of delta table entries of the D type.

-s

Causes only the first line of the delta table entries to be printed; that is, only up to the statistics.
This keyletter is effective only if the d keyletter is also specified (or assumed).

-a

Causes those types of deltas nonnally not printed by the d keyletter to be printed. These are types
R (removed). This keyletter is effective only if the d keyletter is also specified (or assumed).

-i

Causes the printing of the serial numbers of those deltas included, excluded, and ignored. This
keyletter is effective only if the d keyletter is also specified (or assumed).
The following fonnat is used' to print those portions of the sees file as specified by the above
keyletters. The printing of each delta table entry is preceded by a newline character.
•
•

•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•

•

318

Type of delta (D or R).
Space.
sees identification string (SID).

Tab.
Date and time of creation (in the form YY/MM/DD HH:MM:SS).
Space.
Creator.
Tab.
Serial number.
Space.
Predecessor delta's serial number.
Tab.
Statistics (in the form inserted/deleted/unchanged).
Newline.
"Included: tab" , followed by SID's of deltas included, followed by newline (only if there were
any such deltas and if i key letter was supplied).
"Excluded: tab' " followed by SID's of deltas excluded, followed by newline (see note above).
"Ignored:tab", followed by SID's of deltas ignored, followed by newline (see note above).
"MRs:tab", followed by MR numbers related to the delta, followed by newline (only if any
MR numbers were supplied).
Lines of comments (delta commentary), followed by newline (if any were supplied).

-u

Causes the printing of the login-names and/or numerical group IDs of those users allowed to make
deltas.

-f

Causes the printing of the flags of the named file.

-t

Causes the printing of the descriptive text contained in the file.

Last change:

Sun Release 3.2

PRT( 1)

USER COMMANDS

-b

Causes the printing of the body of the sees file.

-e

This keyletter implies the d, i,

U,

PRT( 1)

r, and t keyletters and is provided for convenience.

-y[SID] This keyletter will cause the printing of the delta table entries to stop when the delta just printed
has the specified SID. If no delta in the table has the specified SID, the entire table is printed. If no
SID is specified, the first delta in the delta table is printed. This keyletter will cause the entire delta

table entry for each delta to be printed as a single line (the newlines in the normal multi-line format of the d keyletter are replaced by blanks) preceded by the name of the sees file being processed, followed by a :, followed by a tab. This keyletter is effective only if the d keyletter is also
specified (or assumed).

-c[euto.ff]
This keyletter will cause the printing of the delta table entries to stop if the delta about to be
printed is older than the specified cutoff date-time (see get(l) for the format of date-time). If no
date-time is supplied, the epoch 0000 GMT Jan. 1, 1970 is used. As with the y keyletter, this
keyletter will cause the entire delta table entry to be printed as a single line and to be preceded by
the name of the sees file being processed, followed by a :, followed by a tab. This keyletter is
effective only if the d keyletter is also specified (or assumed).
-r[rev-euto.ff]
This keyletter will cause the printing of the delta table entries to begin when the delta about to be
printed is older than or equal to the specified cutoff date-time (see get(l) for the format of datetime). If no date-time is supplied, the epoch 0000 GMT Jan. 1, 1970 is used. (In this case, nothing will be printed). As with the y keyletter, this keyletter will cause the entire delta table entry to
be printed as a single line and to be preceded by the name of the sees file being processed, followed by a :, followed by a tab. This keyletter is effective only if the d key letter is also specified
(or assumed).
If any keyletter but y, c, or r is supplied, the name of the file being processed (preceded by one newline and
followed by two newlines) is printed before its contents.
If none of the u, r, t, or b keyletters is supplied, the d keyletter is assumed.
Note that the s and i keyletters, and the c and r keyletters are mutually exclusive; therefore, they may not
be specified together on the same prt command.
The form of the delta table as produced by the y, c, and r keyletters makes it easy to sort multiple delta
tables by time order. For example, the following will print the delta tables of all sees files in directory
sees in reverse chronological order:
prt -c sees

I grep • I sort ..-rttOO' +2 -3

When both the y and c or the y and r keyletters are supplied, prt will stop printing when the first of the two
conditions is met
SEE ALSO
sccs(I), admin(1), get(I), delta(I), prs(1), what(I), help(I), sccsfile(5)

Programming Utilities/or the Sun Workstation.
DIAGNOSTICS
Use he/p(1) for explanations.

Sun Release 3.2

Last change:

319

PS( 1)

USER COMMANDS

PS( 1)

NAME

ps - process status
SYNOPSIS
ps [ acCegklsStuvwx] [num] [kernel_name] [ c_dumpJt.le] [ swapyle ]
DESCRIPTION
ps displays information about processes. Normally, only those processes that are started by you and are
attached to a con~I1ing terminal (see termio(4V» are shown. Additional categories of processes can be
added to the display using various options. In particular, the a option allows you to include processes that
are not owned by you (that do not have your user ID), and the x option allows you to include processes
without control tenninals. When you specify both a and x, you get processes owned by anyone, with or
without a control terminal. ps displays the process id, under PID; the control terminal (if any), under TT;
the cpu time used by the process so far, including both user and system time), under CPU; the state of the
process, under STAT; and finally, an indication of the COMMAND that is running.

The state is given by a sequence of four letters, for example, 'RWNA'.

First letter

indicates the runnability of the process:
R Runnable processes,
T Stopped processes,
P Processes in page wait,
D Processes in disk (or other short term) waits,
S Processes sleeping for less than about 20 seconds,
I Processes which are idle (sleeping longer than about 20 seconds).
Z A child processes that has terminated and is waiting for its parent process to do a
wait.

Second letter

indicates whether a process is swapped out;
blank
(that is, a space) in this position indicates that the process is loaded (in memory).
W Process is swapped out
> Process has specified a soft limit on memory requirements and has exceeded that
limit; such a process is (necessarily) not swapped.

Third letter

indicates whether a process is running with altered CPU scheduling priority (nice):
blank
(that is, a space) in this position indicates that the process is running without special
treatment
N The process priority is reduced,
< The process priority has been raised artificially.

Fourth letter

indicates any special treatment of the process for virtual memory replacement. The
letters correspond to options to the vadvise (2) system call. Currently the possibilities
are:
blank
(that is, a space) in this position stands for VA_NORM.
A Stands for VA_ ANOM. An A typically represents a program which is doing garbage collection.
S Stands for VA_SEQL. An S is typical of large image processing programs which
are using virtual memory to sequentially address voluminous data.

Kernel_name specifies the location of the system namelist. If the k option is given, c_dumpyle tells ps
where to look for core. Otherwise, the core dump is located in the file Ivmcore and this argument is
ignored. Swap yle gives the location of a swap file other than the default, Idevldrum.
OPTIONS
a

c

320

Include information about processes owned by others.
Display the command name, as stored internally in the system for purposes of accounting, rather than

Last change: 8 rune 1986

Sun Release 3.2

PS(l)

USER COMMANDS

PS(l)

the command arguments, which are kept in the process' address space. This is more reliable, if less
informative, since the process is free to destroy the latter information.
C

Display raw CPU time in the %CPU field instead of the decaying average.

e

Display the environment as well as the arguments to the command.

g

Display all processes. Without this option, ps only prints 'interesting' processes. Processes are
deemed to be uninteresting if they are process group leaders. This normally eliminates top-level
command interpreters and processes waiting for users to login on free terminals.

k

Normally, kernel_name, defaults to /vmunix, c_dumpJtle is ignored, and swapJtle defaults to
Idev/drum. With the k option in effect, these arguments default to /vmunix, /vmcore, and Idev/drum,
re spec ti vel y.
Display a long listing, with fields PPID, CP, PRI, NI, ADDR, SIZE, RSS and WCHAN as described
below.

s

Adds the size SSIZ of the kernel stack of each process (for use by system maintainers) to the basic
output format.

S

Display accumulated CPU time used by this process and all of its reaped children.

tx

Restrict output to processes whose controlling terminal is x (which should be specified as printed by
ps, for example, t3 for tty3, tco for console, tdO for ttydO, t? for processes with no terminal, etc).
This option must be the last one given.

u

Display user-oriented output. This includes fields USER, %CPU, NICE, SIZE, and RSS as described
below.

v

Display a version of the output containing virtual memory. This includes fields RE, SL, PAGEIN,
SIZE, RSS, LIM, TSIZ, TRS, %CPU and %MEM, described below.

w

Use a wide output format (132 columns rather than 80); if repeated, that is, ww, use arbitrarily wide
output. This information is used to decide how much of long commands to print.

x

Include processes with no controlling terminal.

num A process number may be given, in which case the output is restricted to that process. This option
must also be last.
DISPLAY FORMATS

Fields which are not common to all output formats:
USER
name of the owner of the process
%CPU
cpu utilization of the process; this is a decaying average over up to a minute of previous (real)
time. Since the time base over which this is computed varies (since processes may be very
young) it is possible for the sum of all %CPU fields to exceed 100%.
(or NI) process scheduling increment (see setpriority(2) and nice(3C).
NICE
virtual size of the process (in kilobyte units)
SIZE
real memory (resident set) size of the process (in kilobyte units)
RSS
soft limit on memory used, specified via a call to getrlimit(2); if no limit has been specified
LIM
then shown as xx
size of text (shared program) image
TSIZ
size of resident (real memory) set of text
TRS
percentage of real memory used by this process.
%MEM
residency time of the process (seconds in core)
RE
sleep time of the process (seconds blocked)
SL
PAGEIN number of disk i/o's resulting from references by the process to pages not loaded in core.
numerical user-id of process owner
UID
numerical id of parent of process
PPID
short-term cpu utilization factor (used in scheduling)
CP
process priority (non-positive when in non-interruptible wait)
PRI

Sun Release 3.2

Last change: 8 JUne 1986

321

PS( 1)

USER COMMANDS

ADDR
WCHAN

F

PS(l)

page fram number or swap area position
event on which process is waiting (an address in the system), with the initial part of the address
trimmed off, for example, 80004000 prints as 4000.

flags associated with process as in :
SLOAD
0000001 in core
SSYS
0000002 swapper or pager process
SLOCK
0000004 process being swapped out
SSWAP
0000008 save area flag
STRC
0000010 process is being traced
SWTED
0000020 another tracing flag
SULOCK
0000040 user settable lock in core
SPAGE
0000080 process in page wait state
SKEEP
0000100 another flag to prevent swap out
SOMASK
0000200 restore old mask after taking signal
SWEXIT
0000400 working on exiting
SPHYSIO
0000800 doing physical i/o (bio.c)
SVFORK
0001000 process resulted from vforkO
SVFDONE 0002000 another vfork flag
SNOVM
0004000 no vm, parent in a vforkO
SPAGI
0008000 init data space on demand, from inode
SSEQL
0010000 user warned of sequential vm behavior
SUANOM
0020000 user warned of anomalous vm behavior
STIMO
0040000 timing out during sleep
SOUSIG
0100000 using old signal mechanism
SOWEUPC 0200000 owe process an addupcO call at next ast
SSEL
0400000 selecting; wakeup/waiting danger
SLOGIN
0800000 a login process (legit child of init)
SPTECHG
1000000 pte's for process have changed

A process that has exited and has a parent, but has not yet been waited for by the parent is marked
; a process which is blocked trying to exit is marked ; ps makes an educated guess as to
the file name and arguments given when the process was created by examining memory or the swap area.
The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be counted on too much.
FILES

system namelist
Ivmunix
/devlkmem kernel memory
Idev/drum swap device
core file
Ivrncore
searched to find swap device and terminal names
Idev
SEE ALSO

kill(I), w(I), pstat(8), termio(4V)

BUGS
Things can change while ps is running; the picture it gives is only a close approximation to the current
state.

322

Last change: 8 JUne 1986

Sun Release 3.2

PTI(l)

USER COMMANDS

PTI(l)

NAME

pti - phototypesetter interpreter
SYNOPSIS
pti [ file ••• ]
DESCRIPTION
Pti shows the commands in a stream from the standard output of troff(l) using troff s -t option, interpreting them as they would act on the typesetter. Horizontal motions shows as counts in internal units and are
marked with '<' and '>' indicating left and right motion. Vertical space is called leading and is also indicated.

The output is really cryptic unless you are an experienced C/AfT hardware person. It is better to use

troff -a.
SEE ALSO
troff(l)

Sun Release 3.2

Last change: 21 August 1985

323

PTX( 1)

USER COMMANDS

PTX(l)

NAME

ptx - permuted index
SYNOPSIS
ptx [ -f] [ -t ] [ -w n ] [ -g n ] [ -0 only] [ -i ignore] [ -b break] [ -r] [input [ output] ]
DESCRIPTION

Ptx generates a permuted index of the contents of file input onto file output (defaults are standard input and
output). Ptx has three phases: the first does the permutation, generating one line for each keyword in an
input line. The keyword is rotated to the front. The permuted file is then sorted. Finally, the sorted lines
are rotated so the keyword comes at the middle of the page. Ptx produces output in the form:
.xx "tail" "before keyword" "keyword and after" "head"
where .xx may be an nroff(1) or troff(l) macro for user-defined formatting. The before keyword and keyword and after fields incorporate as much of the line as will fit around the keyword when it is printed at the
middle of the page. Tail and head, at least one of which is an empty string "", are wrapped-around pieces
small enough to fit in the unused space at the opposite end of the line. When original text must be discarded, 'I' marks the spot.
OPTIONS
-f

Fold upper and lower case letters for sorting.

-t

Prepare the output for the phototypesetter; the default line length is 100 characters.

-wn

Use the next argument, n, as the width of the output line. The default line length is 72 characters.

-gn

Use the next argument, n, as the number of characters to allow for each gap among the four parts
of the line as finally printed. The default gap is 3 characters.

-oonly Use as keywords only the words given in the only file.
-iignore
Do not use as keywords any words given in the ignore file. If the -i and -0 options are missing,
use /usrllib/eign as the ignore file.

-bbreak
Use the characters in the break file to separate words. In any case, tab, newline, and space characters are always used as break characters.
-r

Take any leading nonblank characters of each input line to be a reference identifier (as to a page
or chapter) separate from the text of the line. Attach that identifier as a 5th field on each output
line.

FILES

Ibin/sort
lusr/libl eign
BUGS

Line length counts do not account for overstriking or proportional spacing.

324

Last change: 1 November 1983

Sun Release 3.2

PWD(I)

USER COMMANDS

PWD(I)

NAME

pwd - print working directory name
SYNOPSIS

pwd
DESCRIPTION
Pwd prints the pathname of the working (current) directory.

If you are using csh(I), you can use the dirs builtin command to do the same job more quickly; BUT dirs
can give a different answer in the rare case that the current directory or a containing directory was moved
after the shell descended into it. This is because pwd searches back up the directory tree to report the true
pathname, whereas dirs remembers the pathname from the last cd command. The example below illustrates the differences.

% cd /usr/wendy/january/reports
%pwd
lusr/wendy/j anuary/reports

%dirs
-/januaryIreports

% mv -/january -/february
%pwd
lusr/wendy/february/reports
% dirs
-/januaryIreports
%
pwd and mrs also give different answers when you change directory through a symbolic link. For example:

% cd lusr/wendy/january/reports
%pwd
lusr/wendy/j anuary/reports

%dirs
-/januaryIreports
% Is -l/usr/wendy/january
Irwxrwxrwx 1 wendy
17 Jan 30 1983/usr/wendy/january -> /usr/wendy/1984/jan/

% cd lusr/wendy/january
%pwd
lusr/wendy/1984/j an

% dirs
lusr/wendy/january
SEE ALSO
cd(I), csh(l)

Sun Release 3.2

Last change: 1 February 1985

325

PX(l)

USER COMMANDS

PX(l)

NAME

px - Pascal interpreter
SYNOPSIS

px [ obj [ argument . .. ] ]
DESCRIPTION

px interprets the abstract machine code generated by pi. The first argument is the file to be interpreted, and
defaults to obj; remaining arguments are available to the Pascal program using the built-ins argv and argc.
px is also invoked by pix when running 'load and go' .
If the program terminates abnormally an error message and a control flow backtrace are printed. The
number of statements executed and total execution time are printed after normal termination. The p option
of pi suppresses all of this except the message indicating the cause of abnormal termination.
FILES

obj
pmon.out

default object file
profile data file

SEE ALSO

pie 1), pix(1)
Pascal Programmer's Guide
DIAGNOSTICS

Most run-time error messages are self-explanatory. Some of the more unusual ones are:
Reference to an inactive file
A file other than input or output was used before a call to reset or rewrite.
Statement count limit exceeded
The limit of 500,000 executed statements (which prevents excessive looping or recursion) has been
exceeded.
Bad data found on integer read
Bad data found on real read
Usually, non-numeric input was found for a number. For reals, Pascal requires digits before and
after the decimal point so that numbers like '.1' or '21.' evoke the second diagnostic.
panic: Some message
Indicates a internal inconsistency detected in px probably due to a Pascal system bug.
BUGS

Post-mortem traceback is not limited; infinite recursion leads to almost infinite traceback.

326

Last change: 29 April 1986

Sun Release 3.2

PXP( 1)

USER COMMANDS

PXP( 1)

NAME

pxp - Pascal execution profiler
SYNOPSIS

pxp [ -acdefjLnstuw_] [ -23456789 ] [ -z [ name ... ] ] name.p
DESCRIPTION

pxp can be used to obtain execution profiles of Pascal programs or as a pretty-printer. To produce an execution profile all that is necessary is to translate the program specifying the z option to pc, pi, or pix, execute the program, and then type the command
tutorial% pxp -z name.p
pxp generates a reformatted listing if none of the c, t, or z options are specified; thus
tutorial% pxp old.p > new.p
places a pretty-printed version of the program in old.p in the file new.p.
OPTIONS

The use of the following options of pxp is discussed in the Pascal User's Manual in the Sun Pascal
Manual.
-a

Print the bodies of all procedures and functions in the profile; even those which were never executed.

-c

Extract profile data from the file core.

-d

Include declaration parts in a profile.

-e

Eliminate include directives when reformatting a file; the include is replaced by the reformatted contents of the specified file.

-f

Fully parenthesize expressions.

-j

Left justify all procedures and functions.

-L

Map all identifiers and keywords to lower case.

-n

Eject a new page as each file is included; in profiles, print a blank line at the top of the page.

-s

Strip comments from the input text.

-t

Print a table summarizing procedure and function call counts.

-u

Card image mode; only the first 72 characters of input lines are used.

-w

Suppress warning diagnostics.

-z [ name ... ] name .p
Generate an execution profile. If no names are given the profile is of the entire program. If a list of
names is given, then only the specified procedures or functions and the contents of the specified
include files will appear in the profile.
Underline keywords.

-d

Use d spaces (where d is a digit, 2 ~ d ~ 9) as the basic indenting unit. The default is 4.

FILES

name.p
input file
name.i
include file(s)
name.h
include file(s)
pmon.out
profile data
core
profile data source for -c option
/usr/lib/howyxp information on basic usage

Sun Release 3.2

Last change: 7 November 1984

327

USER COMMANDS

PXP( 1)

PXP( 1)

SEE ALSO
pc(I), pi(I), px(l)

Pascal Programmer's Guide
DIAGNOSTICS
For a basic explanation do
tutorial% pxp

Error diagnostics include ~No profile data in file' with the c option if the z option was not enabled to pi;
~Not a Pascal system core file' if the core is not from a px execution; 'Program and count data do not
correspond' if the program was changed after compilation, before profiling; or if the wrong program is
specified.
BUGS

Does not place multiple statements per line.
Procedures and functions as parameters are printed without nested parameter lists, as in the obsolete Jensen'
and Wirth syntax.

328

Last change: 7 November 1984

Sun Release 3.2

PXREF( 1)

USER COMMANDS

PXREF( 1)

NAME

pxref - Pascal cross-reference program
SYNOPSIS

pxref [ - ] name
DESCRIPTION

Pxref makes a line numbered listing and a cross reference of identifier usage for the program in name. The
optional '-' argument suppresses the listing. The keywords goto and label are treated as identifiers for the
purpose of the cross reference. Include directives are not processed, but cause the placement of an entry
indexed by '-include' in the cross reference.
SEE ALSO

Pascal Programmer's Guide
BUGS

Identifiers are trimmed to 10 characters.

Sun Release 3.2

Last change: 11 November 1983

329

QUOTA(1)

USER COMMANDS

QUOTA(1)

NAME

quota - display disk usage and limits
SYNOPSIS
quota [ -y ] [ user]
DESCRIPTION

quota displays users' disk usage and limits. Only the super-user may use the optional user argument to
view the limits of users other than himself.
quota without options displays only warnings about mounted file systems where usage is over quota.
Remotely mounted file systems which are mounted with the "noquota" option (seefstab(5)) are ignored.
OPTIONS
-y

display user's quotas on all mounted file systems where quotas exist.

FILES

quotas

quota file at the file system root

letclmtab

list of currently mounted filesystems

SEE ALSO

quotactl(2), quotaon(8), edquota(8), rquotad(8C), fstab(5)

330

Last change: 21 August 1985

Sun Release 3.2

RANLIB( 1)

USER COMMANDS

RANLIB( 1)

NAME

ranlib - convert archives to random libraries
SYNOPSIS

ranlib [ -t] archive ...
DESCRIPTION

ranlib converts each archive to a form that can be linked more rapidly. ran lib does this by adding a table
of contents called __.SYMDEF to the beginning of the archive. ranlib uses ar(l) to reconstruct the
archive. Sufficient temporary file space must be available in the file system that contains the current directory.
OPTIONS
-t

option, ran lib only "touches" the archives and does not modify them. This is useful after copying
an archive or using the -t option of make(l) in order to avoid having ld(l) complain about an
"out of date" symbol table.

SEE ALSO

ld( 1), ar(l), lorder( 1), make( 1)
BUGS

Because generation of a library by ar and randomization of the library by ranlib are separate processes,
phase errors are possible. The linker, ld, warns when the modification date of a library is more recent than
the creation date of its dictionary; but this means that you get the warning even if you only copy the
library.

Sun Release 3.2

Last change: 8 April 1986

331

RASFILTER8TO I ( IG)

USER COMMANDS

RASFILTER8TOI ( I G)

NAME

rasfilter8toI- convert an 8-bit deep rasterfile to a I-bit deep raster:file
SYNOPSIS

rasfiIter8toi [ -r threshold] [ -g threshold] [ -b threshold] [ -a threshold]
DESCRIPTION
Rasfilter8tol reads an 8-bit deep rasterfile from standard input and converts it to a I-bit deep rasterfile on
standard output. The format is Sun standard raster:file format (see lusrlincludelrasterfile.h). This is useful

for displaying 8-bit raster images on devices that can only handle monochrome raster:file images.
OPTIONS

Options can be specified to control thresholding of color values. There can be more than one threshold
option set, in which case all threshold options specified must be met.
All options take a threshold value which can range from 0 to 255. Pixels, whose threshold conditions
exceed the threshold value are given a value of 0 in the I-bit rasterfile. Those that don't are given a value
of 1. The default option is -a 128.
-r threshold

The threshold condition is the red component of the pixel value.
-g threshold

The threshold condition is the green component of the pixel value.
-b threshold
The threshold condition is the blue component of the pixel value.

-a threshold
The average of the red, green, and blue components is tested against the threshold value.
EXAMPLE

The command:
tutorial% screendump -f Idev/cgtwoO \ rasfilter8toI\lpr -Pversatec -v
prints a monochromatic representation of the IdevlcgtwoO frame buffer on the printer named "versatec"
using the flv" output filter. (see letclprintcap).
FILES

ldevlcgtwoO

Default name of the Sun-2 color display frame buffer.

SEE ALSO

lpr(l), rastrepl(I), screendump(l), screenload(I)
pr_dump in Programmer's Reference Manual for Sun Windows

332

Last change: 28 April 1986

Sun Release 3.2

RASTREPL ( 1 )

USER COMMANDS

RASTREPL ( 1 )

NAME

rastrepl- magnify a raster image by 2 times
SYNOPSIS

rastrepl [ input-file [ output-file ]]
DESCRIPTION
Rastrepl reads input-file (or the standard input if input-file is not specified) which should be in rasterfile format (see /usr/include/rasterfile.h), replicates each pixel in both the x and y directions, and writes the resulting rasterfile to output-file (or the standard output if output-file is not specified).
EXAMPLES

tutoria1% screendump

I rastrepl I Ipr -Pversatec -v

sends a rasterfile containing the current frame buffer to the Versatec plotter, doubling the size of the image
so that it fills a single page.
SEE ALSO
screendump( 1), screenload( 1), lpr( 1)

Sun Release 3.2

Last change: 5 November 1984

333

RATFOR( 1)

USER COMMANDS

RATFOR(1)

NAME

ratfor - rational FORTRAN dialect
SYNOPSIS

ratfor [ -6c ] [ -c ] [-b ] [ filename .•• ]

DESCRIPTION

ratfor converts the rational FORTRAN dialect into ordinary FORTRAN 77. It provides control flow constructs essentially identical to those in C. See the FORTRAN 77 Programmer's Guide for a description of the
Ratfor language.
OPTIONS

-6c

Use the character c as the continuation character in column 6 when translating to FORTRAN. The
default is to use the & character as a continuation character.

-C

Pass Ratfor comments through to the translated code.

-b

Translate Ratfor string constants to Hollerith constants of the form nnn b string. Otherwise just
pass the strings through to the translated code.

SEE ALSO

t77(l)
Ratfor in the FORTRAN Pro grammer's Guide

334

Last change: 21 December 1983

Sun Release 3.2

RCP( IC)

USER COMMANDS

RCP( IC)

NAME

rcp - remote file copy
SYNOPSIS

rep filel file2
rep [ -r ] file ... directory
DESCRIPTION

rep copies files between machines. Eachfile or directory argument is either a remote file name of the fonn
"rhostpath", or a local file name (containing no ':' characters, or a 'I' before any ':'s.)
If the -r is specified and any of the source files are directories, rep copies each subtree rooted at that name;
in this case the destination must be a directory.

If path is not a full path name, it is interpreted relative to your login directory on rhost. A path on a remote
host may be quoted (using \, ", or') so that the metacharacters are interpreted remotely.
rep does not prompt for passwords; your current local user name must exist on rhost and allow remote
command execution via rsh(IC).
rep handles third party copies, where neither source nor target files are on the current machine. Hostnames
may also take the form' 'rhost.marne" to use rname rather than the current user name on the remote host.

Please note: rep is meant to copy from one host to another; if by some chance you try to copy a file on top
of itself, you will end up with a severely corrupted file (for example, if you executed the following command from host george: 'george% rep testfile george:/usr/meltestfile'). Remember where you are at all
times (putting your hostname in your prompt helps with this)!
SEE ALSO

ftp(IC), rsh(IC), rlogin(IC)
BUGS

Doesn't detect all cases where the target of a copy might be a file in cases where only a directory should be
legal.
Is confused by any output generated by commands in a .login, .profile, or .cshrc file on the remote host.
rep doesn't copy ownership, mode, and timestamps to the new files.
rep requires that the source host have permission to execute commands on the remote host when doing
third-party copies.

If you forget to quote metacharacters intended for the remote host you get an incomprehesible error message.

Sun Release 3.2

Last change: 23 September 1985

335

RDIST( 1)

RDIST( 1)

USER COMMANDS

NAME

rdist - remote file distribution program
SYNOPSIS

rdist [-nqbRhivwy] [ -f distfile] [ -d var=value] [ -m host] [name ... ]
rdist [ -nqbRhivwy ] -c name ... [login@]host[:dest]
DESCRIPTION
Rdist is a program to maintain identical copies of files over multiple hosts. It preserves the owner, group,
mode, and mtime of files if possible and can update programs that are executing. Rdist reads commands
from distfile to direct the updating of files and/or directories. If distfile is '-', the standard input is used. If
no -f option is present, the program looks first for 'distfile', then 'Distfile' to use as the input. If no names
are specified on the command line, rdist will update all of the files and directories listed in distfile. Otherwise, the argument is taken to be the name of a file to be updated or the label of a command to execute. If
label and file names conflict, it is assumed to be a label. These may be used together to update specific files
using specific commands.

The -c option forces rdist to interpret the remaining arguments as a small distfile. The equivalent distfile is
as follows.

( name ... ) -> [login@]host
install [dest];
Other options:

336

-d

Define var to have value. The -d option is used to define or override variable definitions in the
distfile. Value can be the empty string, one name, or a list of names surrounded by parentheses
and separated by tabs and/or spaces.

-m

Limit which machines are to be updated. Multiple -m arguments can be given to limit updates to
a subset of the hosts listed in the distfile.

-0

Print the commands without executing them. This option is useful for debugging distfile.

-q

Quiet mode. Files that are being modified are normally printed on standard output. The -q option
suppresses this.

-R

Remove extraneous files. If a directory is being updated, any files that exist on the remote host
that do not exist in the master directory are removed. This is useful for maintaining truely identical copies of directories.

-b

Follow symbolic links. Copy the file that the link points to rather than the link itself.

-i

Ignore unresolved links. Rdist will normally try to maintain the link structure of files being
transfered and warn the user if all the links cannot be found.

-v

Verify that the files are up to date on all the hosts. Any files that are out of date will be displayed
but no files will be changed nor any mail sent.

-w

Whole mode. The whole file name is appended to the destination directory name. Normally, only
the last component of a name is used when renaming files. This will preserve the directory structure of the files being copied instead of flattening the directory structure. For example, renaming a
list of files such as ( dirllfl dir2!f2 ) to dir3 would create files dir3/dirl/fl and dir3/dir2lf2 instead
of dir3/fl and dir3/f2.

-y

Younger mode. Files are normally updated if their mtime and size (see stat(2) disagree. The-y
option causes rdist not to update files that are younger than the master copy. This can be used to
prevent newer copies on other hosts from being replaced. A warning message is printed for files
which are newer than the master copy.

-b

Binary comparison. Perform a binary comparison and update files if they differ rather than

Last change: 17 July 1986

Sun Release 3.2

RDIST( 1)

USER COMMANDS

RDIST( 1)

comparing dates and sizes.

Distfile contains a sequence of entries that specify the files to be copied, the destination hosts, and what
operations to perform to do the updating. Each entry has one of the following formats.
 '=' 
[label: ]  '->'  
[label: ]  '::'  
The first format is used for defining variables. The second format is used for distributing files to other
hosts. The third format is used for making lists of files that have been changed since some given date. The
source list specifies a list of files and/or directories on the local host which are to be used as the master
copy for distribution. The destination list is the list of hosts to which these files are to be copied. Each file
in the source list is added to a list of changes if the file is out of date on the host being updated (second format) or the file is newer than the time stamp file (third format).
Labels are optional. They are used to identify a command for partial updates.
Newlines, tabs, and blanks are only used as separators and are otherwise ignored. Comments begin with
'-' and end with a newline.
Variables to be expanded begin with '%' followed by one character or a name enclosed in curly braces (see
the examples at the end).
The source and destination lists have the following format:

or
'('  ')1
The shell meta-characters '[" ']" '{', '}t, '.', and'1' are recognized and expanded (on the local host only)
in the same way as csh(l). They can be escaped with a backslash. The ,-, character is also expanded in
the same way as csh but is expanded separately on the local and destination hosts. When the -w option is
used with a file name that begins with '-', everything except the home directory is appended to the destination name. File names which do not begin with 'I' or ,-, use the destination user's home directory as the
root directory for the rest of the file name.
The command list consis ts of zero or more commands of the following format.
'install'  opt_dest_name ';'
'notify' ';'
'except' ';'
'exceptyat'
';'
string ';'
'special'
The install command is used to copy out of date files and/or directories. Each source file is copied to each
host in the destination list. Directories are recursively copied in the same way. Opt_dest_name is an
optional parameter to rename files. If no install command appears in the command list or the destination
name is not specified, the source file name is used. Directories in the path name will be created if they do
not exist on the remote host. To help prevent disasters, a non-empty directory on a target host will never be
replaced with a regular file or a symbolic link. However, under the '-R' option a non-empty directory will
be removed if the corresponding filename is completely absent on the master host. The options are '-R',
'-h', '-i', '-v', '-w', '-y', and '-b' and have the same semantics as options on the command line except
they only apply to the files in the source list. The login name used on the destination host is the same as the
local host unless the destination name is of the format "login@host".

Sun Release 3.2

Last change: 17 July 1986

337

RDIST( 1)

USER COMMANDS

RDIST( 1)

The notify command is used to mail the list of files updated (and any errors that may have occured) to the
listed names. If no '@' appears in the name, the destination host is appended to the name (e.g.,
namel@host, name2@host, ... ).
The except command is used to update all of the files in the source list except for the files listed in name
list. This is usually used to copy everything in a directory except certain files.
The exceptyat command is like the except command except that pattern list is a list of regular expressions
(see ed(l) for details). If one of the patterns matches some string within a file name, that file will be
ignored. Note that since '\' is a quote character, it must be doubled to become part of the regular expression. Variables are expanded in pattern list but not shell file pattern matching characters. To include a
'%', it must be escaped with '\'.
The special command is used to specify sh(l) commands that are to be executed on the remote host after
the file in name list is updated or installed. If the name list is omitted then the shell commands will be executed for every file updated or installed. The shell variable 'FILE' is set to the current filename before executing the commands in string. String starts and ends with "" and can cross multiple lines in distjile. Multiple commands to the shell should be separated by';'. Commands are executed in the user's home directory on the host being updated. The special command can be used to rebuild private databases, etc. after a
program has been updated.
The following is a small example.
HOSTS = ( matisse root@arpa )
FILES

= (

Ibin !lib lusrlbin lusrl games
lusr/include! { *.h, {stand,sys,vax *,pascal, machine}I*.h}
lusr/lib lusr/man/man? lusr/ucb lusr/locallrdist)

EXLIB

=

(Mai1.rc aliases aliases.dir aliases.pag crontab dshrc
sendmail.cf sendmail.fc sendmai1.hf sendmail.st uucp vfont )

%{FILES} -> %{HOSTS}
install-R;
except lusrllib/%{EXLIB} ;
except lusr/games/lib ;
special lusr/lib/sendmail "/usr/lib/sendmail-bz" ;
srcs:
lusrlsrc/bin -> arpa

exceptyat (\\.0\% ISCCS\%) ;
IMAGEN = (ips dviimp catdvi)
imagen:
lusr/local/%{IMAGEN} -> arpa
install lusrllocal/lib ;
notify ralph ;
%{FILES} :: stamp.cory
notify root@cory ;
FILES

distfile
Itmplrdist*

338

input command file
temporary file for update lists

Last change: 17 July 1986

Sun Release 3.2

RDIST( 1)

USER COMMANDS

RDIST( 1)

SEE ALSO

sh(1), csh(1), stat(2)
DIAGNOSTICS

A complaint about mismatch of rdist version numbers may really stem from some problem with starting
your shell, e.g., you are in too many groups.
BUGS

Source files must reside on the local host where rdist is executed.
There is no easy way to have a special command executed after all files in a directory have been updated.
Variable expansion only works for name lists; there should be a general macro facility.

Rdist aborts on files which have a negative mtime (before Jan 1, 1970).
There should be a 'force' option to allow replacement of non-empty directories by regular files or symlinks. A means of updating file modes and owners of otherwise identical files is also needed.

Sun Release 3.2

Last change: 17 July 1986

339

REFER ( 1)

USER COMMANDS

REFER(I)

NAME

refer - find and insert literature references in documents
SYNOPSIS
refer [ -ar] [ -b] [ -cstring ] [ -e ] [ -kx] [ -lm,n ] [ -p file] [ -n] [ -skeys] file

000

DESCRIPTION
Refer is a preprocessor for nroff(I), or trojf(I), that finds and formats references. The input files (standard
input by default) are copied to the standard output, except for lines between and command lines, Such
lines are assumed to contain keywords as for lookbib(I), and are replaced by information from a bibliographic data base. The user can avoid the search, override fields from it, or add new fields. The reference
data, from whatever source, is assigned to a set of troJ! strings. Macro packages such as ms(7) print the
finished reference text from these strings. A flag is placed in the text at the point of reference. By default,
the references are indicated by numbers.
0 [

0]

When refer is used with eqn(I), neqn(l), or tbl(I), refer should be used first in the sequence, to minimize
the volume of data passed through pipes.
OPTIONS
-ar

-b

Reverse the first r author names (Jones, J. A. instead of J. A. Jones). If r is omitted, all author
names are reversed.
Bare mode - do not put any flags in text (neither numbers or labels).

-cstring
Capitalize (with SMALL CAPs) the fields whose key-letters are in string.

-e

Accumulate references instead of leaving the references where encountered, until a sequence of
the form:
.[
%LIST%
.]
is encountered, and then write out all references collected so far. Collapse references to the same
source.

-kx

Instead of numbering references, use labels as specified in a reference data line beginning with the
characters %x; By default, x is L.

-Jm,n

Instead of numbering references, use labels from the senior author's last name and th~ year of
publication. Only the first m letters of the last name and the last n digits of the date are used. If
either of m or n is omitted, the entire name or date, respectively, is used.

-p

Take the next argument as a file of references to be searched. The default file is searched last.

-0

Do not search the default file.

-skeys Sort references by fields whose key-letters are in the key~ string, and permute reference numbers
in the text accordingly. Using this option implies the -e option. The key-letters in keys may be
followed by a number indicating how many such fields are used, with a + sign taken as a very
large number. The default is AD, which sorts on the senior author and date. To sort on all authors
and then the date, for instance, use the options -sA+ T.
FILES

lusr/dict/papers
lusrllib/refer

directory of default publication lists and indexes
directory of programs

SEE ALSO
addbib(l), indxbib(l), lookbib(l), roffbib(l), sortbib(l)

340

Last change: 29 April 1983

Sun Release 3.2

REV ( 1)

USER COMMANDS

REV(1)

NAME

rev - reverse lines of a file
SYNOPSIS

rev [file] ...
DESCRIPTION
Rev copies the named files to the standard output, reversing the order of characters in every line. If no file
is specified, the standard input is copied.

Sun Release 3.2

Last change: 16 March 1983

341

RLOGIN(IC)

USER COMMANDS

RLOGIN( IC)

NAME

rlogin - remote login
SYNOPSIS

rlogin rhost [ -ec] [ -I username] [ -7] [ -8]
rhost [ -ec] [ -I username] [ -7] [ -8]
DESCRIPTION

rlogin connects your terminal on the current local host system lhost to the remote host system rhost.
Host names are given in the file letclhosts. Each host has one standard name (the first name given in the
file), which is unambiguous, and optionally one or more nicknames. The host names for machines to
which your machine is networked are also found in the directory lusr/hosts, as symbolic links to rsh. If you
put this directory in your search path then the rlogin can be omitted.
Additionally, each host has a file letclhosts.equiv which contains a list of rhost's with which it shares
account names. When you rlogin on a host specified in your letclhosts.equiv (and if the remote host, in
turn, specifies your host in its /etclhosts.equiv) you don't need to give a password.
Each user may also have a private equivalence list in a file .rhosts in his login directory. Each line in this
file should contain an rhost and a username separated by a space, giving additional cases where logins
without passwords are to be permitted. If the originating user and host is not found in these files, the
remote machine will prompt for a password
To avoid some security problems, the Jhosts file must be owned by either the remote user or root and may
not be a symbolic link.
Your remote terminal type is the same as your local terminal type (as given in your environment TERM
variable). All echoing takes place at the remote site, so that (except for delays) the rlogin is transparent.
Flow control via AS and AQ and flushing of input and output on interrupts are handled properly.
ESCAPES

Lines that you type which start with the tilde character are 'escape sequences' (the escape character can be
changed via the -e options):
Disconnect from the remote host - this is not the same as a logout, because the local host breaks
the connection with no warning to the remote end.
Suspend the login session (only if you are using the C-Shell). susp is your 'suspend' characterusually AZ - see tty(1).
dsusp

Suspend the input half of the login, but output will still be seen (only if you are using the C-Shell).
dsusp is your 'deferred suspend' character - usually Ay - see tty(l).

OPTIONS

-I

Specifies a different user name (username, in the synopsis) for the remote login. If you do not use
this option, the remote usemame used is the same as your local usemame.

-e

Specifies a different escape character (c, in the synopsis) for the line used to disconnect from the
remote host.

-8

Pass eight-bit data across the net instead of seven-bit data.

SEE ALSO

rsh(IC), stty(IV)
FILES

lusr/hosts/*
I etc/hos ts.eq ui v
-/.rhosts

for rhost version of the command
list of rhost s with shared account names
private list of rhost s with shared account names

BUGS

342

Last change: 23 September 1985

Sun Release 3.2

RLOGIN(lC)

USER COMMANDS

RLOGIN(lC)

This implementation can only use the TCP network service.
More terminal characteristics should be propagated.

Sun Release 3.2

Last change: 23 September 1985

343

RM(I)

USER COMMANDS

RM(l)

NAME

no, nndir - remove (unlink) files or directories
SYNOPSIS
rm [ -r ] [ -f] [ -i] [ - ] filename ...

rmdir directory . ..
DESCRIPTION
Rm
rm removes (directory entries for) one or more files. If an entry was the last link to the file, the contents of
that file are lost. (See In(l) for more information about multiple links to files.)

To remove a file, you must have write permission in its directory; but you don't need read or write permission on the file itself. If you don't have write permission on the file and the standard input is a terminal, rm
displays the file's pennissions and waits for you to type in a response. If your response begins with 'y' the
file is deleted; otherwise the file is left alone.
Rmdir
rmdir removes each named directory, which must be empty.
OPTIONS

-r

Force files to be removed without displaying permissions, asking questions or reporting errors.

-r

Recursively delete the contents of a directory, its subdirectories, and the directory itself.

-i

Ask whether to delete each file, and, under -r, whether to examine each directory. Sometimes
called the interactive option.
Treat the following arguments as filenames minus.

so that you can specify filenames starting with a

WARNING
It is forbidden to remove the file' .. ' to avoid the antisocial consequences of inadvertently doing something
like 'rm -r .*'.
SEE ALSO
In(l)

344

Last change: 1 Aug 1986

Sun Release 3.2

USER eOMMANDS

RMDEL(I)

RMDEL(I)

NAME

rmdel- remove a delta from an sees file
SYNOPSIS

lusrlsccs/rmdel-rSID file •••
DESCRIPTION

Rmdel removes the delta specified by the SID from each named sees file. The delta to be removed must be
the newest (most recent) delta in its branch in the delta chain of each named sees file. In addition, the SID
specified must not be that of a version being edited for the purpose of making a delta (that is, if ap-file (see
get (1» exists for the named sees file, the SID specified must not appear in any entry of the p-file).
If a directory is named, mulel behaves as though each file in the directory were specified as a named file,
except that non-SCeS files (last component of the path name does not begin with s.) and unreadable files
are silently ignored. If a name of - is given, the standard input is read; each line of the standard input is
taken to be the name of an sees file to be processed; non-sees files and unreadable files are silently
ignored

The exact permissions necessary to remove a delta are documented in the Source Code Control System
User's Guide. Simply stated, they are either 1) if you make a delta you can remove it; or 2) if you own the
file and directory you can remove a delta.
FILES

x-file
z-file

(see delta(l»
(see delta(l»

SEE ALSO

sccs(I), delta(I), get(I), help(I), prs(I), sccsfile(5).
Programming Utilities for the Sun Workstation.
DIAGNOSTICS

Use help(l) for explanations.

Sun Release 3.2

Last change: 17 February 1986

345

ROFFBIB( 1)

USER COMMANDS

ROFFBm(l)

NAME

roftbib - run off bibliographic database
SYNOPSIS
roftbib [ -e ] [ -b] [ -m name ] [ -np ] [ -oUst] [ -Q
[ -x] [filename] ...

] [ -raN] [ -sN]

[ - Tterm] [ -V]

DESCRIPTION

Roffbib prints out all records in a bibliographic database, in bibliography format rather than as footnotes or
endnotes. Generally it is used in conjunction with sortbib:
sortbib database I roftbib
OPTIONS

Roffbib accepts all options understood by nroff(l) except -i and -q.

-e

Produce equally-spaced words in adjusted lines using full terminal resolution.

-b

Use output tabs during horizontal spacing to speed output and reduce output character count. Tab
settings are assumed to be every 8 nominal character widths.

-m

Prepend the macro file lusrllibltrlUlcltrlUlc .name to the input files. There should be a space
between the -m and the macro filename. This set of macros will replace the ones defined in
lusrnib/tmac/tmac.bib.

-np

Number first generated page p .

-olist

Print only page numbers that appear in the comma-separated list of numbers and ranges. A range
N-M means pages N through M; an initial -N means from the beginning to page N; a final Nmeans from page N to end

-Q

Queue output for the phototypesetter. Page offset is set to 1 inch.

-raN

Set register a (one-character) to N. The command-line argument -rNl will number the references starting at 1.
Four command-line registers control formatting style of the bibliography, much like the number
registers of ms(7). The flag -rV2 will double space the bibliography, while -rVl will double
space references but single space annotation paragraphs. The line length can be changed from the
default 6.5 inches to 6 inches with the -rL6i argument, and the page offset can be set from the
default of 0 to one inch by specifying -rOli (capital 0, not zero).

-sN

Halt prior to every N pages for paper loading or changing (default N =1). To resume, enter a newline or carriage return.

-T

Specify term as the terminal type.

-V

Send output to the Versatec. Page offset is set to 1 inch.

-x

If abstracts or comments are entered following the %X field key, roffbib will format them into
paragraphs for an annotated bibliography. Several %X fields may be given if several annotation
paragraphs are desired.

FILES

lusrnib/tmac/tmac.bib

file of macros used by nroffltroff

SEE ALSO

refer(l), addbib(I), sortbib(I), indxbib(I), lookbib(I), nroff(l)

"Refer" in ForrlUltting Documents on the Sun Workstation
BUGS

Users have to rewrite macros to create customized formats.

346

Last change: 21 August 1985

Sun Release 3.2

RPCGEN(l)

USER COMMANDS

RPCGEN(l)

NAME

rpcgen - an RPC protocol compiler
SYNOPSIS
rpcgen -h [-0 outfile] [inputfile]
rpcgen -c [-0 outfile] [infile]
rpcgen infile
rpcgen [-s transport]* [-0 outfileJ [infile]
DESCRIPTION
rpcgen is a tool that generates C code to implement an RPC protocol. The input to rpcgen is a language
with striking similarity to C known as RPCL (Remote Procedure Call Language). rpcgen operates in four
modes. The first mode is used to convert RPCL definitions into C definitions for use as a header file. The
second mode compiles the XDR routines required to serialize the protocol described by RPCL. The third
mode compiles both, leaving the header file in a file named infile with a .h extension and the XDR routines
in infile with a .c extension. The fourth mode is used to compile an RPC server skeleton, so that all you
have to do is write local procedures that know nothing about RPC in order to implement an RPC server.

The input may contain C-style comments and preprocessor directives. Comments are ignored, while the
directives are simply stuffed uninterpreted in the output header file.
You can customize some of your XDR routines by leaving those data types undefined. For every data type
that is undefined, rpcgen will assume that there exists a routine with the name 'xdr_' prepended to the
name of the undefined type.
OPTIONS
-c

Compile XDR routines.

-h

Compile C data-definitions (a header file)

-ooutfile
Specify the name of the output file. If none is specified, standard output is used (-c, -h and -s
modes only).

-s transport
Compile a server, using the the given transport. The supported transports are udp and tcp. This
option may be invoked more than once so as to compile a server that serves multiple transports.
USAGE
RPCL Syntax Summary
This summary of RPCL syntax, which is used for rpcgen input, is intended more for aiding comprehension
than as an exact statement of the language.

Primitive Data Types
[ unsigned] char
[unsigned] short
[ unsigned] int
[ unsigned] long
unsigned
float
double
void
bool
Except for the added boolean data-type bool, RPCL is identical to C. rpcgen converts bool declarations to
int declarations in the output header file (literally it is converted to a boott, which has been -define'd to
be an int). Also, void declarations may appear only inside of union and program definitions. For those
averse to typing the prefix unsigned, the abbreviations u_char, u_short, u_int and u_long are available.

Sun Release 3.2

Last change: 11 March 1986

347

RPCGEN(I)

USER COMMANDS

RPCGEN(1)

Declarations
RPCL allows only three kinds of declarations:

declaration:
simple-declaration
pointer-declaration
vector-declaration
simple-declaration:
type-name object-ident
pointer-declaration:
type-name *object-ident
vector-declaration:
type-name object-ident[size]
(size can be either an integer or a symbolic constant)
RPCL declarations contain both limitations and extensions with respect to C. The limitations are that you
cannot declare multidimensional arrays or pointers-to-pointers in-line (You can still declare them though,
using typedef). There are two extensions:
Opaque data is declared as a vector as follows:

opaque object-ident [ size]
In the protocol, this results in an object of size bytes. Note that this is not the same as a declaration
of size characters, since XDR characters are 32-bits. Opaque declarations are compiled in the output header file into character array declarations of size bytes.
Strings are special and are declared as a vector declaration:

string object-ident [ rruzx-size ]
If max-size is unspecified, then there is essentially no limit to the maximum length of the string.
String declarations get compiled into the following:
char *object-ident
Type Definitions
The only way to generate an XDR routine is to define a type. For every type zetype you define, there is a
corresponding XDR routine named xdr_zetype.

There are six ways to define a type:

type-definition:
typedef
enumeration-de!
structure-deJ
variable-length-array-def
discriminated-union-de!
program-de!
The first three are very similar to their C namesakes. C does not have a formal type mechanism to define
variable-length arrays and XDR unions are quite different from their C counterparts. Program definitions
are not really type definitions, but they are useful nonetheless.
You may not nest XDR definitions. For example, the following will cause rpcgen to choke:
struct dontdoit {
struct ididit {
intoops;
} sorry;
enum ididitagain { OOPS, WHOOPS} iapologize;

348

Last change: 11 March 1986

Sun Release 3.2

RPCGEN(l)

USER COMMANDS

RPCGEN(l)

};
Typedefs
An XDR typeder looks as follows:

typedef'

typeder declaration;
The object-ident part of declaration is the name of the new type, whereas the type-name part is the name of
the type from which it is derived.
Enumeration Types
The syntax is:
enumeration-def'
enum enum-ident {
enum-list
};

enum-list:
enum-symbol-ident [ = assignment]
enum-symbol-ident [ = assignment] , enum-list
(assignment may be either an integer or a symbolic constant)
If there is no explicit assignment, then the implicit assignment is the value of the previous enumeration plus
1. If not explicitly assigned, the first enumeration receives the value O.
Structures

structure-def'

struct struct-ident {
declaration-list

};
declaration-list:
declaration ;
declaration ; declaration-list
Variable-Length Arrays

variable-length-array-def'
array array-ident {
unsigned length-identifer ;
vector-declaration ;
};

A variable length array definition looks much like a structure definition. Here's an example:
array mp_ int {
unsigned len;
short val[MAX_MP_LENGTII];
};
This is compiled into:
struct mp_ int {
unsigned len;
short *val;
};
typedef struct mp_int mp_int;
Disriminated Unions

discriminated-union-def:
union union-ident switch ( discriminant-declaration) {
case-list
[ default: declaration; ]

Sun Release 3.2

Last change: 11 March 1986

349

RPCGEN(I)

USER COMMANDS

RPCGEN(1)

};

case-list:

case case-ident : declaration;
case case-ident : declaration ; case-list
discriminant-declaration:
declaration
The union definition looks like a cross between a C-union and a C-switch. An example:
union net_object switch (net_kind kind) {
case MACHINE:
struct sockaddrIn sin;
case USER:
int uid;
default:
string whatisit;
};
Compiles into:
struct net_object {
net_kind kind;
union {
struct sockaddr_in sin;
int uid;
char *whatisit;
} net_object;
};
typedef struct net_object net_object;
Note that the name of the union component of the output struct is the same as the name of the type itself.
Program Definitions

pro gram-def.·

program program-ident {
version-list
}=program-number;
version-list:
version
version version-list
version:
version version-ident {
procedure-list
}=version-number ;
procedure-list:
procedure-declaration
procedure-declaration procedure-list
procedure-declaration:
type-name procedure-ident ( type-name)

=procedure-number ;

Program definitions look like nothing you've ever seen before, so we turn to an example to explain them.
Suppose you wanted to create server that could get or set the date. It's declaration might look like this:
program DATE_PROG {
version DATE_VERS {
date DATE_GET(timezone) = 1;
1* Greenwich mean time *1
voidDATE_SET(date) = 2;

} = 1;
} =

350

100;

Last change: 11 March 1986

Sun Release 3.2

RPCGEN(l)

USER COMMANDS

RPCGEN(l)

In the header file, this compiles into the following:
-defineDATE PROG 100
-define DATE VERS 1
-defineDATE GET 1
-define DATE SET 2
These define's are intended for use by the client program to reference the remote procedures.

If you are using rpcgen to compile your server, then there are some important things for you to know. The
server interlaces to your local procedures by expecting a C function with the same name as that in the program definition, but in all lower-case letters and followed by the version number. Here is the local procedure that implements DATE_GET:
date * /* always returns a pointer to the results */
date_get_l(tz)
timezone *tz;
/* always takes a a pointer to the arguments */
{

static date d;

/* must be static! */

/*

* figure out the date
* and store it in d

*/
return(&d);
}
The name of the routine is the same as the -define'd name, but in all lower case letters and followed by the
version number. XDR will recursively free the argument after getting the results from your local procedure,
so you should copy from the argument any data that you will need between calls. However, XDR neither
allocates nor frees your results. You must take care of their storage yourself.

Make Inference Rules For Compiling XDR Headers
It is possible to set up suffix transformation rules in make (1) for compiling XDR routines and header files.
The convention is that RPCL protocol files have the extension oX. The make rules to do this are:
.SUFFIXES: .x
.x.c:
rpcgen -c %< -0 %@

.x.h:
rpcgen -h %< -0 %@
SEE ALSO

Remote Procedure Call: Programming Guide and External Data Representation: Protocol Specification in
Networking on the Sun Workstation
BUGS

Name clashes can occur when using program definitions, since the apparent scoping does not really apply.
Most of these can be avoided by giving unique names for programs, versions, procedures and types.

Sun Release 3.2

Last change: 11 March 1986

351

RSH(lC)

USER COMMANDS

RSH( IC)

NAME

rsh - remote shell
SYNOPSIS

rsh host [ -I username ] [ -0] command
host [ -I username ] [ -0 ] command
DESCRIPTION
rsh connects to the specified host, and executes the specified command. rsh copies its standard input to the

remote command, the standard output of the remote command to its standard output, and the standard error
of the remote command to its standard error. Interrupt, quit and terminate signals are propagated to the
remote command; rsh normally terminates when the remote command does.
If you omit command, instead of executing a single command, rsh logs you in on the remote host using 710gin.

Shell metacharacters which are not quoted are interpreted on the local machine, while quoted metacharacters are interpreted on the remote machine. Thus the command:
tutorial% rsh lizard cat lizard.file » tutorial. file
appends the remote file lizard.file from the machine called lizard to the file called tutorial file on the
machine called tutorial, while the command:
tutorial% rsh lizard cat lizard.file "»" another.lizard.file
appends the file lizardfile on the machine called lizard to the file another.lizard.fi1e. which also resides on
the machine called lizard.
Host names are given in the file letclhosts. Each host has one standard name (the first name given in the
file), which is rather long and unambiguous, and optionally one or more nicknames. The host names for
machines to which your machine is networked are also found in the directory lusrlhosts, as symbolic links
to rsh. If you put this directory in your search path then the rsh can be omitted.
OPTIONS
-I username

use username as the remote username instead of your local usemame. In the absence of this
option, the remote usemame is the same as your local usemame, This remote name must be
equivalent to the originating account. No provision is made for specifying a password with a command, and none is necessary - if your usemame is known at the remote end you will be admitted,
otherwise you will be prompted for a password.
-n

redirect the input of rsh to !devlnull. You sometimes need this option to avoid unfortunate
interactions between rsh and the shell which invokes it For example, if you are running csh and
invoke a rsh in the background without redirecting its input away from the terminal, it will block
even if no reads are posted by the remote command. The -n option will prevent this.

The type of remote shell (sh or csh) is determined by the user's entry in the file letclpasswd on the remote
system.
FILES

letclhosts
lusrlhostsl*
SEE ALSO

rlogin (Ie)
BUGS

You cannot run an interactive command (like vi; use rio gin if you wish to do so.)
Stop signals stop the local rsh process only; this is arguably wrong, but currently hard to fix for reasons too
complicated to explain here.

352

Last change: 23 September 1985

Sun Release 3.2

RSH(IC)

USER COMMANDS

RSH( IC)

The current local environment is not passed to the remote shell.
Sometimes the -n option is needed for reasons that are less than obvious. For example, the command:
rsh somehost dd if=/dev/nrmtO bs=20b I tar xvpBf •
will put your shell into a strange state. Evidently, what happens is that the tar tenninates before the rsh.
The rsh then tries to write into the "broken pipe" and, instead of terminating neatly, proceeds to compete
with your shell for its standard input. Invoking rsh with the -n option avoids such incidents.
Note, however, that this bug occurs only when rsh is at the beginning of a pipeline and is not reading standard input. Don't use the -n if the rsh actually needs to read standard input. For example,
tar cf - • I rsh sundial dd of=ldev/rmtO obs=20b
doesn't produce the bug. If you were to use the -n in a case like this, the rsh would incorrectly read from
ldevlnull instead of from the pipe.

Sun Release 3.2

Last change: 23 September 1985

353

RUP( lC)

USER COMMANDS

RUP( lC)

NAME

rup - show host status of local machines (RPC version)
SYNOPSIS
rup [ -b ] [ -I] [ -t] [ host. •• ]
DESCRIPTION
Rup gives a status similar to uptime for remote machines; It broadcasts on the local network, and displays
the responses it receives.

Normally, the listing is in the order that responses are received, but this order can be changed by specifying
one of the options listed below.
When host arguments are given, rather than broadcasting rup will only query the list of specified hosts.
A remote host will only respond if it is running the rstatd daemon, which is normally started up from
inetd(8C).
OPTIONS
-b sort the display alphabetically by host name.

-I sort the display by load average
-t sort the display by up time.

FILES

/ etc! servers
SEE ALSO
ruptime(IC), inetd(8C), rstatd(8C)
BUGS

Broadcasting does not work through gateways.

354

Last change: 5 July 1985

Sun Release 3.2

RUPTIME( lC)

USER COMMANDS

RUPTIME( lC)

NAME

ruptime - show host status of local machines
SYNOPSIS
ruptime [ -a ] [ -I ] [ -t] [ -u ]
DESCRIPTION

Ruptime gives a status line like uptime for each machine on the local network; these are formed from packets broadcast by each host on the network once a minute.
Machines for which no status report has been received for 5 minutes are shown as being down.
Normally, the listing is sorted by host name, but this order can be changed by specifying one of the options
listed below.
OPTIONS

-a count even those users who have been idle for an hour or more.
-I sort the display by load average.
-t sort the display by up time.
-u sort the display by number of users.

FILES
lusrlspoollrwho/whod. *

data files

SEE ALSO
rwho(IC)

Sun Release 3.2

Last change: 7 March 1984

355

RUSERS(IC)

USER COMMANDS

RUSERS( lC)

NAME

rusers - who's logged in on local machines (RPC version)
SYNOPSIS

rusers [ -a ] [ -b ] [ -i ] [ -I] [ -u ] [ host ••• ]
DESCRIPTION
The rusers command produces output similar to users(1) and who(1). but for remote machines. It broadcasts on the local network, and prints the responses it receives. Normally, the listing is in the order that
responses are received, but this order can be changed by specifying one of the options listed below. When
host arguments are given, rather than broadcasting rusers will only query the list of specified hosts.

The default is to print out a listing in the style of users(1) with one line per machine. When the -I flag is
given, a rwho(1) style listing is used. In addition, if a user hasn't typed to the system for a minute or more,
the idle time is reported.
A remote host will only respond if it is running the rusersd daemon, which is normally started up from
inetd.
OPTIONS

-a

gives a report for a machine even if no users are logged on.

-b

sort alphabetically by host name.

-i

sort by idle time.

-I

Give a longer listing in the style of who(1).

-u

sort by number of users.

FILES

tete/servers
SEE ALSO
rwho(IC), inetd(8C), rusersd(8C)
BUGS

Broadcasting does not work through gateways.

356

Last change: 5 July 1985

Sun Release 3.2

RWALL(lC)

USER COMMANDS

RWALL(lC)

NAME

rwall- write to all users over a network
SYNOPSIS

rwall hostname ...
rwall-n netgroup ...
rwall-h host .,..n netgroup
DESCRIPTION

Rwall reads a message from standard input until end-of-file. It then sends this message, preceded by the
line uBroadcast Message ... ", to all users logged in on the specified host machines. With the -n option, it
sends to the specified network groups, which are defined in netgroup(5).
A machine can only receive such a message if it is running rwalld(8), which is normally started up from
tetclservers by the daemon inetd(8).
FILES

fetc/servers
SEE ALSO
wall(l), netgroup(5), rwalld(8C), shutdown(8)
BUGS

The timeout is fairly short in order to be able to send to a large group of machines (some of which may be
down) in a reasonable amount of time. Thus the message may not get thru to a heavily loaded machine.

Sun Release 3.2

Last change: 4 August 1986

357

RWHO(IC)

USER COMMANDS

RWHO(lC)

NAME

rwho - who's logged in on local machines
SYNOPSIS

rwho [-a]
DESCRIPTION
The rwho command produces output similar to who(l), but for all machines on your network. If no report
has been received from a machine for 5 minutes, rwho assumes the machine is down, and does not report

users last known to be logged into that machine.
If a user hasn't typed to the system for a minute or more, rwho reports this idle time. If a user hasn't typed
to the system for an hour or more, the user is omitted from the output of rwho unless the -a flag is given.
OPTIONS

-a

report all users whether or not they have typed to the system in the past hour.

FILES

lusrlspoo1/rwho/whod. *

information about other machines

SEE ALSO

ruptime( IC), rwhod(8C)
BUGS

Does not work through gateways.
This is unwieldy when the number of machines on the local net is large.

358

Last change: 8 March 1984

Sun Release 3.2

SACT( 1)

USER COMMANDS

SACT( 1)

NAME

sact - print current SCCS file editing activity
SYNOPSIS

lusrlsccs/sact file .••
DESCRIPTION
Sact informs the user of any sees files which have had one or more get -e commands applied to them, that
is, there are files out for editing, and deltas are pending. If a directory is named on the command line, sact
behaves as though each file in the directory were specified as a named file, except that non-sees files and
unreadable files are silently ignored. If a name of - is given, the standard input is read with each line being
taken as the name of an sees file to be processed. The output for each named file consists of five fields
separated by spaces.

Field 1

specifies the SID of a delta that currently exists in the sees file to which changes will
be made to make the new delta.

Field 2

specifies the SID for the new delta to be created.

Field 3

contains the logname of the user who will make the delta (that is, executed a get for
editing).

Field 4

contains the date that get -e was executed.

Field 5

contains the time that get -e was executed.

SEE ALSO
sccs(l), delta(l), get(l), unget(l).

Programming Utilities/or the Sun Workstation.
DIAGNOSTICS
Use help (1) for explanations.

Sun Release 3.2

Last change: 6 March 1984

359

SCCS( 1)

USER COMMANDS

SCCS(l)

NAME
sccs - front end for the SCCS subsystem

SYNOPSIS
sees [ -r ] [ -dprefixpath] [ -pfinalpath ] command [ SCCS-flags ... ] [file ... ]
DESCRIPTION
The secs command is a front end to the utility programs of the Source Code Control System (sees).
secs normally prefixes each file, or the last component of each file, with the string sees/s., because YOll
normally keep your sees database files in a directory called sees, and each database file starts with an s.
prefix. If the environment variable PROJECTDIR is set, and is an absolute pathname (Le., begins with a
slash) sees will search for sees files in the directory given by that variable. If it is a relative pathnarne
(Le., does not begin with a slash), it is treated as the name of a user, and secs will search in that user's
home directory for a directory named sre or source. If that directory is found, sccs will search for sees
files in the directory given by that variable.
secs program options must appear before the command argument. Flags to be passed to the actual sees
command (utility program) must appear after the command argument. These flags are specific to the command being used, and are discussed in Programming Utilities/or the Sun Workstation.
secs also includes the capability to run 'set user id' to another user to provide additional protection. Certain commands (such as admin) cannot be run 'set user id' by all users, since this would allow anyone to
change the authorizations. Such commands are always run as the real user.

OPTIONS
-r

Runs secs as the real user rather than as whatever effective user sccs is 'set user id' to.

-dprefixpath
Defines the prefix portion of the pathname for the sees database files. The default prefix portion
of the pathname is the current directory. prefixpath is prefixed to the entire pathname. For example:
tutorial% sees -dlusr/include get syslinode.h
converts to:
get lusr/include/syslSeeS/s.inode.h
The intent here is to create aliases such as:
alias syssces sees -dlusrlsre
which will be used as:
tutorial% syssces get emdlwho.e
This flag overrides any directory specified by the PROJECTDIR environment variable.
-pfinalpath
Defines the name of a lower directory in which the sees files will be found; sees is the default
ftnalpath is appended before the final component of the pathname. For example:
tutorial% sees -pprivate get usr/include/stdio.h
converts to:
get usr/include/private/s.stdio.h
ADDnnONALSCCSCO~ANDS

Several 'pseudo-commands' are available in addition to the usual sees commands. These are:

360

create

create is used when creating new s. files. For example, given a C source language file called
obscure.c, create would perform the following actions: (1) create the s. file called s.obscure.e in
the sees directory; (2) rename the original source file to ,obscure.c; (3) do an sees get on
obscure .c. Compared to the sees admin command, create does more of the startup work for you
and should be used in preference to admin.

enter

enter is just like create, except that it does not do the final sees get. It is usually used if an sees
edit is to be performed immediately after the enter.

edit

Get a file for editing.

Last change: 17 July 1986

Sun Release 3.2

SCCS( 1)

delget

USER COMMANDS

SCCS( 1)

Perform a delta on the named files and then get new versions. The new versions have id keywords expanded, and so cannot be edited.

deledit Same as delget, but produces new versions suitable for editing. deledit is useful for making a
'checkpoint' of your current editing phase.

fix

Removes the named delta, but leaves you with a copy of the delta with the changes that were in it.
must be followed by a -r flag. fix is useful for fixing small compiler bugs, etc. Since fix
doesn't leave audit trails, use it carefully.

fix
clean

Removes everything from the current directory that can be recreated from SCCS files. clean
checks for and does not remove any files being edited. If clean -b is used, branches are not
checked to see if they are currently being edited. Note that -b is dangerous if you are keeping the
branches in the same directory.

unedit

'Undoes' the last edit or get -e and returns a file to its previous condition. If you unedit a file
being edited, all changes made since the beginning of the editing session are lost

info

Displays a list of all files being edited. If the -b flag is given, branches (that is, SID's with two or
fewer components) are ignored. If the -u flag is given (with an optional argument), only files
being edited by you (or the named user) are listed.
.

check

Checks for files currently being edited, like info, but returns an exit code rather than a listing:
nothing is printed if nothing is being edited, and a non-zero exit status is returned if anything is
being edited. check may thus be included in an 'install' entry in a makefile, to ensure that everything is included in an sees file before a version is installed.

tell

Displays a list of files being edited on the standard output Filenames are separated by newlines.
Takes the -b and -u flags like info and check.

diffs

Compares (in diff-like format) the current version of the program you have out for editing and the
versions in sees format. diffs accepts the same arguments as diff, except that the -c flag must be
specified as -C instead, because the -c flag is taken as a flag to get indicating which version is to
be compared with the current version.

print

Print verbose information about the named files. print does an sees prs -e followed by an sees
get -p -m on each file.

EXAMPLES
To put a file called myprogram.c into
directory already existing:

sees format for the first time, assuming

also that there is no sees

sees

tutorial% mkdir
tutorial% sees create myprogram.e
myprogram.c:
1.1
14 lines
after you have verified that everything is all right
you remove the version of the file that starts with a comma:
tutorial% rm ,myprogram.e
tutorial%
To get a copy of myprogram.c for editing, edit that file, then place it back in the sees database:
tutorial% sees edit myprogram.e
1.1
new delta 1.2
14 lines
tutorial% vi myprogram.e
your editing session

Sun Release 3.2

Last change: 17 July 1986

361

SCCS( 1)

USER COMMANDS

SCCS( 1)

tutorial% sees delget myprogram.e
comments? Added abusive responses for compatibility with rest of system
1.2
7 inserted
7 deleted
7 unchanged
1.2
14 lines
tutorial%
To get a file from another directory:
tutorial% sees -p/usrlsrclsecsl get ee.e
or:
tutorial% sees get lusrlsrclseeslee.e
To make a delta of a large number of files in the current directory:
tutorial% sees delta *.e
To get a list of files being edited that are not on branches:
tutorial% sees info -b
To delta everything that you are editing:
tutorial% sees delta 'sees tell-u'
In a makefile, to get source files from an sees file if it does not already exist
SRCS = 
%(SRCS):
sccs get %(REL) %@
REGULARSeeSeO~ANDS

The 'regular' sees commands are described very briefly below. It is unlikely that you ever need to use
these commands because the user interface is so complicated, and the sees front end command does 99.9%
of the interesting tasks for you.

admin

Creates new sees files and changes parameters of existing sees files. You can use sees create to
create new sees files, or use sees admin to do other things.

cdc

Changes the commentary material in an sees delta

comb

Combines sees deltas and reconstructs the sees files.

delta

Permanently introduces changes that were made to a file previously retrieved via sees get. You
can use sees delget as the more useful version of this command since sees delget does all of the
useful work and more to boot.

get

Extracts a file from the sees database, either for compilation, or for editing when the -e option is
used Use sees get if you really need it, but sees delget will normally have done this job for you.
Use sees edit instead of get with the -e option.

help

Supposed to help you interpret sees error messages, but usually just parrots the messaage and is
generally not considered very helpful.

prs

Displays information about what is happening in an sees file.

rmdel

Removes a delta from an sees file.

sccsdiff Compares two versions of an sees file and generates the differences between the two versions.

unget

362

Undoes the work of a previous get -e command or a sees edit command. Use the sees unedit
command as a useful alternative.

Last change: 17 July 1986

Sun Release 3.2

SCCS( 1)

USER COMMANDS

SCCS( 1)

val

Determines if a given sees file meets specified criteria. If you use the sees command, you
shouldn't need to use val, because its user interface is unbelievable.

what

Displays sees identification information.

FILES

lusrlsces/*
SEE ALSO

admin(1), cdc(1), eomb(l), delta(1), get(1), help(1), prs(1), rmdel(1), sact(1), sccsdiff(1), unget(l), val(I),
vvhat(1), sccsfile(5)
Programming Utilities/or the Sun Workstation

Sun Release 3.2

Last change: 17 July 1986

363

SCCSDIFF ( 1 )

USER COMMANDS

seeSDIFF ( 1 )

NAME

sccsdiff - compare two versions of an sees file
SYNOPSIS

lusrlsccs/sccsdifT -r SID 1 -r SID2 [ -p ] [ -ditTopts ] filenames
DESCRIPTION

sccsdiff compares two versions of an sees file and generates the differences between the two versions.
Any number of sees files may be specified, but options apply to all files.
OPTIONS
-rSID?

SID1 and SID2 specify the deltas of an
passed to diff in the order given.

sees

file that are to be compared. Versions are

-p

pipe output for each file through pr.

-diffopts

the -1:, -e, -f, -b, -b and -D options of diff can be specified here.

FILES

Itmp/get????? Temporary files
SEE ALSO

sccs(I), diff(I), get(I), help(l)
Programming Utilities/or the Sun Workstation.
DIAGNOSTICS

"file: No differences"
Use help for explanations.

364

If the two versions are the same.

Last change: 23 September 1985

Sun Release 3.2

SCREENBLANK ( 1 )

USER COMMANDS

SCREENBLANK ( 1 )

NAME

screenblank - tum off video when the mouse and keyboard are idle
SYNOPSIS

screenblank [ -m ] [ -k ] [ -d interval] [ -e interval ] [ -f frame_buffer]
DESCRIPTION

screenblank turns off the display when the mouse and keyboard are idle for an extended period (the default
is 10 minutes).
OPTIONS

-m

Do not check whether the mouse has been idle.

-k

Do not check whether the keyboard has been idle.

-d interval
Disable after interval seconds. interval is a number of the form xxx..n:x where each x is a decimal
digit The default is 600 seconds (10 minutes).

-e interval
Enable within interval seconds. interval is the time between successive polls for keyboard or
mouse activity. If a poll detects keyboard or mouse activity, the display is resumed interval is a
number of seconds, of the form xxx..n:x where each x is a decimal digit The default is 0.25
seconds.
-f frame _buffer
frame_buffer is the path name of the frame buffer on which video disabling/enabling applies. The
defaults is /dev/fb.
SEE ALSO

lockscreen( 1)
BUGS

When not running suntools(l), only the RETURN key resumes video display.

Sun Release 3.2

Last change: 21 June 1986

365

SCREENDUMP ( 1 )

USER COMMANDS

SCREENDUMP ( 1 )

NAME

screendump - dump frame buffer image
SYNOPSIS
screendump [ -f display] [ -e] [ -t type] [ output-file ]
DESCRIPTION
Screendump reads out the contents of a frame buffer on any model of Sun Workstation and outputs the
display image in Sun standard rasterfile format (see lusrlindudelrasterfile.h) on output-file (or on the standard output if output-file is not specified).

By default, screendump attempts to output the contents of the console frame buffer (Idevlfb). The-f
option explicitly sets the name of the desired frame buffer device.
The utility program screen load displays Sun standard rasterfiles on an appropriate Sun Workstation monitor. Output filters exist for printing standard monochrome rasterfiles on Versatec V-80 electrostatic
plotters.
OPTIONS
-f display
Use display as the device name of the display.

-e

Shorthand for -t 2.

-t type Specify the type of the rasterfile to write:

o

1
2
65535

Old format files compatible with Release 1.1 software.
Standard format.
Run-length encoding of bytes.
To experiment with private encodings.

EXAMPLES

tutorial% screendump >save.this.image
writes the current contents of the console frame buffer into the file save .this. image .
tutorial% screendump -f Idev/cgoneO >save.color.image
writes the current contents of the frame buffer ldevlcgoneO into the file save.color.image.
tutorial% screen dump

I Ipr -Pversatec -v

sends a rasterfile containing the current frame buffer to the lineprinter, selecting the printer named' 'versatec" and the "v" output filter (see letc!printcap).
FILES

ldev/tb
Idev/cgoneO
Idev/cgtwoO
lusrllib/rasfilters/*

Default name of console display frame buffer.
Default name of the Sun-l color display frame buffer.
Default name of the Sun-2 color display frame buffer.
Filters for the raster file

SEE ALSO
lpr( 1), rastrepl( 1), screenload( 1)

pr_dump in SunView Programmer's Guide and Sun View System Programmer's Guide

366

Last change: 1 February 1985

Sun Release 3.2

SCREENLOAD ( 1 )

USER COMMANDS

SCREENLOAD ( 1 )

NAME

screenload - restore frame buffer image
SYNOPSIS
screenload [ -d] [ -f display] [ -iindex] [ -b ] [ -g] [ -p ] [ -w] [ -b hex-constants [ input-file ]
DESCRIPTION
Screenload accepts input in Sun standard rasterfile format (see lusrlincludelrasterfile.h) and attempts to
display the input on the appropriate monitor (monochrome or color). Screen load normally displays
rasterfiles on the console display, but displays them on some heuristically determined color display if it
finds no console display. Screenload displays color rasterfiles only on a color monitor. Screenload is able
to display monochrome rasters on a color display.

If the dimensions of the image contained in the input data are smaller than the actual resolution of the
display (for example, loading a 1024-by-800 Sun-l image on a 1152-by-900 Sun-2 display), screenload
centers the image on the actual workstation screen and fills the border area with solid black (by default).
Various options may be used to change the fill pattern.
If the dimensions of the image contained in the input data are larger than the actual resolution of the
display, screenload clips the right and bottom edges of the input image.
If there is an optional filename argument, screen load reads its input data from that file. If no filename
argument is given, screenload reads its input data from the standard input.
The utility program screendump creates Sun standard rasterfiles from the display on a Sun Workstation
monitor.
OPTIONS
-d

Verify that display dimensions and input data image dimensions match, and print warning messages if they do not.

-f display
Use display as the name of the frame buffer device.

-iindex If the image is smaller than the display, use index (0 <= index < 256) as the index value into the
color map for the foreground color of the border fill pattern. The default index value is 255.
-b

If the input data dimensions are smaller than the display dimensions, fill the border with a pattern
of solid ones (default). On a monochrome display this results in a black border; on a color display
the color map value selected by the -i option determines the border color.

-g

If the input data dimensions are smaller than the display dimensions, fill the border with a pattern
of "desl(top grey". On a monochrome display this results in a border matching the background
pattern used by SunView; on a color display the color map value selected by the -i option determines the foreground border color, though the pattern is the same as on a monochrome display.

-p

Wait for a newline to be typed on the standard input before exiting.

-w

If the input data dimensions are smaller than the display dimensions, fill the border with a pattern
of solid zeros. On a monochrome display this results in a white border; on a color display the
color map value at index 0 determines the border color.

-b hex-constants
If the input data dimensions are smaller than the display dimensions, fill the border with the bit
pattern described by the following # 16-bit hexadecimal constants. Note that a "I" bit is black
and a "0" bit is white on the monochrome display; on a color diplay the color map value selected
by the -i option determines the border foreground color. The number of hex constants in the pattern is limited to 16.
EXAMPLES

tutorial% screenload saved.display.image
reloads the raster image contained in the file saved.display.image on the display type indicated by the

Sun Release 3.2

Last change: 6 February 1985

367

SCREENLOAD ( 1 )

USER COMMANDS

SCREENLOAD ( 1 )

rasterfile header in that file.
tutorial% screenload -f/dev/cgoneO monochrome.image
reloads the raster image in the file monochrome. image on the frame buffer device /dev/cgoneO.
tutorial% screenload -hI fflT sun_I.saved.image
is equivalent to the -b option (fill border with black), while
tutorial% screenload -h4 8888 8888 2222 2222 sun_I.saved.image
is equivalent to the -g option (fill border with desktop grey).
FILES

/dev/tb
/dev/cgoneO
/dev/cgtwoO
/usrllib/rasfilters/*

Default name of console display frame buffer
Default name of Sun-l color display frame buffer
Default name of the Sun-2 color display frame buffer.
Filters for the raster file

SEE ALSO
screendump( 1)
pr_load in SunView Programmer's Guide and SunView System Programmer's Guide

368

Last change: 6 February 1985

Sun Release 3.2

SCRIPT ( 1)

USER COMMANDS

SCRIPT ( 1)

NAME

script - make typescript of terminal session
SYNOPSIS
script [ -a] [file]
DESCRIPTION

Script makes a typescript of everything printed on your terminal. The typescript is written to file, or
appended to file if the -a option is given. It can be sent to the line printer later with lpr. If no file name is
given, the typescript is saved in the file typescript.
The script ends when the forked shell exits.
OPTIONS
Append the script to the specified file instead of writing over it.

BUGS
Script places everything in the log file. This is not what the naive user expects.

Sun Release 3.2

Last change: 24 March 1983

369

SDIFF( 1)

USER COMMANDS

SDIFF( 1)

NAME

sdiff - side-by-side difference program
SYNOPSIS

sdifT [ -I] [ -0 outfile ] [ -5 ] [ -w n ] filel file2
DESCRIPTION
sdiff uses the output of diff to produce a side-by-side listing of two files indicating those lines that are different Each line of the two files is printed with a blank gutter between them if the lines are identical, a < in

the gutter if the line only exists infilel , a> in the gutter if the line only exists infile2, and a I for lines that
are different
For example:
x
a
b
c
d

y
a
<
<
>

OPTIONS
-w n

d
c

Use n as the width of the output line. The default line length is 130 characters.

-I

Only print the left side of any identical lines.

-s

Silent Do not print identical lines.

-0

outfile
Use the next argument, output, as the name of an output file created as an interactively controlled
merging of filel and file2. Identical lines of filel and file2 are copied to output. Sets of differences, as produced by diff, are printed; where a set of differences share a common gutter character. After printing each set of differences, sdiff prompts with a % and waits for you to type one of
the following commands:

append the left column to the output file
r

append the right column to the output file

s

turn on silent mode; do not print identical lines

v

turn off silent mode

eI

call the ed(1) with the left column

er

call ed (1) with the right column

eb

call ed (1) with the concatenation of left and right columns

e

call ed (1) with a zero length file
On exit from ed(l), the resulting file is concatenated to the named output file.

q

exit from the program

SEE ALSO

diff(l), ed(l)

370

Last change:

Sun Release 3.2

SED ( IV)

USER COMMANDS

SED ( IV)

NAME

sed - stream editor
SYNOPSIS

sed [ -0] [ -e script] [ -f sfile] [file] •••
DESCRIPTION
Sed copies the named files (standard input default) to the standard output, edited according to a script of
commands.
OPTIONS
-e

script is an edit command for sed. If there is just one -e option and no -f's, the -e flag -e may be
omitted

-f

Take the script from sfile.

-0

Suppress the default output.

USAGE
SED SCRIPTS
sed scripts consist of editing commands, one per line, of the following form:

[ address [, address] ] function [ arguments]
In normal operation sed cyclically copies a line of input into a pattern space (unless there is something left
after a D command), sequentially applies all commands with addresses matching that pattern space until
reaching the end of the script, copies the pattern space to the standard output (except under -0), and finally,
deletes the pattern space.
Some commands use a hold space to save all or part of the pattern space for subsequent retrieval.
An address is either a decimal number linecount, which is cumulative across input files, a % that addresses
the last input line, or a context address, or Iregular expressionl in the style of ed(l) with the following
exceptions:

\n

Matches a newline embedded in the pattern space.
Matches any character except the newline ending the pattern space.

null

A command line with no address selects every pattern space.

addr

Selects each pattern space that matches.

addr1,addr2
Selects the inclusive range from the first pattern space matching addr1 to the first pattern
space matching addr2. Selects only one line if addrl is greater than or equal to addr2.
Comments
If the first nonwhite character in a line is a pound sign (-), sed treats that line as a comment, and ignores it.
If, however, the first such line is of the form
-0

sed runs as if the -0 flag were specified.
Functions
The maximum number of permissible addresses for each function is indicated in parentheses in the list
below.

An argument denoted text consists of one or more lines, all but the last of which end with \ to hide the newline. Backslashes in text are treated like backslashes in the replacement string of an s command, and may
be used to protect initial blanks and tabs against the stripping that is done on every script line.
An argument denoted rfile or wfile must terminate the command line and must be preceded by exactly one
blank. Each wfile is created before processing begins. There can be at most 10 distinct wfile arguments.

(l)a\

Sun Release 3.2

Last change: 11 April 1986

371

SED ( IV)

USER COMMANDS

SED ( IV)

text
Append: Place text on the output before reading the next input line.
(2) b label
Branch to the : command bearing the label. Branch to the end of the script if label is empty.

(2)c\

text
Change: Delete the pattern space. With 0 or 1 address or at the end of a 2-address range, place
text on the output. Start the next cycle.
(2) d

Delete the pattern space. Start the next cycle.

(2) D

Delete the initial segment of the pattern space through the first newline. Start the next cycle.

(2) g

Replace the contents of the pattern space by the contents of the hold space.

(2) G

Append the contents of the hold space to the pattern space.

(2) h

Replace the contents of the hold space by the contents of the pattern space.

(2) H

Append the contents of the pattern space to the hold space.

(1) i\

text
Insert: Place text on the standard output
(2) I

List the pattern space on the standard output in an unambiguous form. Non-printing characters are
spelled in two-digit ASCII and long lines are folded

(2) n

Copy the pattern space to the standard output Replace the pattern space with the next line of
input.

(2) N

Append the next line of input to the pattern space with an embedded newline. (The current line
number changes.)

(2) p

Print Copy the pattern space to the standard output.

(2) P

Copy the initial segment of the pattern space through the first newline to the standard output.

(1) q

Quit Branch to the end of the script Do not start a new cycle.

(2) r rfile
Read the contents of rfile. Place them on the output before reading the next input line.

(2) slregular expressionlreplacementljlags
Substitute the replacement string for instances of the regular expression in the pattern space. Any
character may be used instead of /. For a fuller description see ed(l). Flags is zero or more of

g

Global: Substitute for all nonoverlapping instances of the regular expression rather than
just the first one.

p

Print the pattern space if a replacement was made.

w wfile Write: Append the pattern space to wfile if a replacement was made.

(2) t label
Test: Branch to the : command bearing the label if any substitutions have been made since the
most recent reading of an input line or execution of a t. If label is empty, branch to the end of the
script.

(2)wwfile
Write: Append the pattern space to wfile.
(2) x

Exchange the contents of the pattern and hold spaces.

(2) y/stringllstring21
Transform: Replace all occurrences of characters in string1 with the corresponding character in

372

Last change: 11 April 1986

Sun Release 3.2

SED ( IV)

USER COMMANDS

SED ( IV)

string2. The lengths of string1 and string2 must be equal.
(2)! function

Don't Apply the/unction (or group, if/unction is {) only to lines not selected by the address(es).
(0): label
This command does nothing; it bears a label for b and t commands to branch to. Note that the
maximum length of label is seven characters.

(1) =

Place the current line number on the standard output as a line.

(2) {

Execute the following commands through a matching} only when the pattern space is selected.

(0)

An empty command is ignored

SYSTEM V SED SCRIPTS

The following additional rule applies to addresses:
In a context address, the construction \?regular expression?, where? is any character, is identical
to Iregular expression I. Note that in the context address \xabc\xdefx, the second x stands for
itself, so that the regular expression is abcxdef.

The following additionaljlag applies to the s command:
n

n= 1 - 512. Substitute for just the nth occurrence of the regular expression.

SEE ALSO

ed(I), grep(I), awk(I), lex(I)
Using UNIX Text Utilities on the Sun Workstation
Editing Text Files on the Sun Workstation

Sun Release 3.2

Last change: 11 April 1986

373

SETKEYS( I}

USER COMMANDS

SETKEYS(l}

NAME

setkeys - modify the interpretation of keyboard keys
SYNOPSIS
setkeys [ reset I nosunview I [ [lefty] [noarrows ] ] ] [sunIl sun21 sun3 ]
DESCRIPTION

Setkeys changes the kernel's keyboard translation tables, converting a keyboard to one of a number of commonly desired configurations. It takes an indication of the modifications to be performed, and optionally,
the kind of keyboard attached to the user's machine. It affects all keyboard input for the machine it is run
on (in or out of the window system) until that effect is superseded by rebooting, or by running "setkeys
reset".
Setkeys has been superseded by the Input category in defaultsedit(l}, and by the program
input_from_defaults(l}. It is retained for backwards compatibility.
OPTIONS

modifications

Empty, or one of "reset", "nosunview", or some combination of "lefty" and "noarrows". By default, the keyboard is set to produce the SunView function-key codes
(Stop, Props, Front, Oose, Find, Again, Undo, Put, Get and Erase; ). On Sun2 and Sun3 keyboards, this is a no-op; on the
Sun1, those functions are assigned to two columns of the right numeric I function
pad.

Lefty

indicates the SunView functions are to be produced from keys on the right side of
the keyboard, convenient for using the mouse in the left hand

On the Sun2 and Sun3, the SunView functions are reflected to the outside columns
of the right function pad; those right-side functions are distributed in a more complicated fashion dictated by keeping the arrow keys together; see below. Also, the
Line Feed key, immediately below Return, is converted to a second Control.
On the Sunl, "lefty" is the same as the default, since there is no left function pad
Noarrows

Reassigns the keys with cursor arrows on their caps to produce simple function
codes (so they may be used with filters in the textsw, or mapped input in the
ttysw).

Nosunview

Valid only on a Sun2 or Sun3 keyboard, and incompatible with "lefty", "noarrows", or ''''reset'' This option assigns new codes to keys F1 and L2 - LIO, codes
that are not normally produced anywhere on the keyboard. These codes may be
selected by a mapi or mapo operation defined in a user's .ttyswrc file.
This option supports a measure of backwards compatibility to programs that apply
some other interpretation to the affected function keys. It allows them to access
the new codes when the standard codes would be preempted by SunView functions (e.g. in a tty subwindow).

Reset

is incompatible with "lefty", "noarrows", or "nosunview"; it causes the keyboard
to be reset to its original interpretation.

keyboard-type

One of "Sun1", "Sun2", or "Sun3". Normally, this option is omitted; the type of
keyboard attached to the system is obtained from the kernel. If included, the
option is believed in preference to the kernel's information. Setkeys treats Sun2
and Sun3 keyboards identically except when the modification is "reset."
Note: the keyboard type is not necessarily the same as the machine type. A Sunl
keyboard is the VT100-style keyboard shipped with Model 100Us, while Sun2
and Sun3 keyboards may be attached interchangeably to Sun-2 and Sun-3
machines. A Sun3 keyboard is distinguished by its aerodynamic housing, and the
presence of Caps and Alternate keys.

374

Last change: 29 April 1986

Sun Release 3.2

SETKEYS( 1)

USER COMMANDS

SETKEYS( 1)

Options may appear in any order, and case is not significant. The accompanying charts show the exact distribution of codes for each combination of keyboard and arguments to setkeys.
EXAMPLES

setkeys lefty noarrows
puts the SunView functions on the right pad of the keyboard, replacing arrow keys by the corresponding
right-function codes, and displacing right-function codes to the left pad
setkeys sunl reset
restores a Sunl keyboard to its original arrangement
SEE ALSO
defaultsedit(1 )
inputJrom_ defaults(1)
kb(4S)
Editing and the Text Facility, in Windows and Window-Based Tools, Beginner's Guide
BUGS
DIAGRAMS
Sunl,

reset:
A

V <
standard ]
typing
array

>

TFl
]
]
]

TF2
7
4
1

TF3
8
5
2

TF4
9
6
3

RFI
Undo
Put
Get
Delete

Stop
RF3
RF5
RF7
Find

RF2
Props
Front
Close

RF4
RF6
RF8

RFl
Undo
Put
Get
Delete

Stop
RF3
RF5

RF2
Props
Front
Close

RF4
RF6
RF8

0

Enter

default / lefty:
A

[
[
[
[

V <
standard]
typing
array

>

Again
]
]
]

default / lefty, noarrow:

[
[
[
[

Sun Release 3.2

TFITF2TF3TF4
Again
standard ]
]
typing
]
array
]

RF7

Find

Last change: 29 April 1986

375

SETKEYS(l)

USER COMMANDS

SETKEYS(l)

Sun2&Sun3,
reset I default

Stop
Props
Front
Close
Find

Again
Undo
Put
Get
Delete

TFl TF2 ...
[ standard
[
typing
[
array
[
[

RFl
RF4
RF7

RF2
RF5

<

RFll

RF13

V

RF3
RF6
RF9
>
RF15

RFl
RF4
RF7
RFIO
RF13

RF2
RF5
RF8
RFll
RF14

RF3
RF6
RF9
RF12
RF15

Retn
Ctrl

Again <
Undo
>
Put
RFll
Get
Delete V

Stop
Props
Front
Close
Find

Ret
Ctrl

Again
Undo
Put
Get
Delete

RF2
RF5
RF8
RFll
RF14

Stop
Props
Front
Close
Find

RFl
RF4
RF7

RF2
RF5

RF3
RF6
RF9
>
RF15

Retn
LF

noarrows (only):

Stop
Props
Front
Close
Find

Again
Undo
Put
Get
Delete

TFl TF2 ...
[ standard
[
typing
[
array
[
[

Retn

LF

lefty:

Stop
RF6
RF9
RF12
RF15

RFI
RF4
RF7
RFI0
RF13

TFl TF2 ...
[ standard
[
typing
[
array
[
[

]
]
]
]

lefty, noarrows

Stop
RF6
RF9

RF12
RF15

RFl
RF4
RF7
RFIO
RF13

TFl TF2 ...
[ standard
[
typing
[
array
[
[

nosunview:

Stop
LF12
LF13
LF14
LF15

376

TFll
TF12
TF13
TF14
TF15

LFll TF2 ...
[ standard
[
typing
[
array
[
[

Ret
LF

<

RFll

RF13

Last change: 29 April 1986

V

Sun Release 3.2

SH( 1)

USER COMMANDS

SH(I)

NAME

sh - shell, the standard UNIX command interpreter and command-level language
SYNOPSIS

sh [ -acetbiknstuvx ] [ arguments]
DESCRIPTION

sh, the Bourne shell, is the standard UNIX command interperter. It executes commands read from a terminal or a file.
Definitions

A blank is a TAB or a SPACE character. A name is a sequence of letters, digits, or underscores beginning
with a letter or underscore. A parameter is a name, a digit, or any of the characters *, @, -, ?, -, %, and

!.
Invocation
If the shell is invoked through exec(2) and the first character of argument zero is -, commands are initially
read from %HOMEI.profile, if such a file exists and is owned by you. Thereafter, commands are read as
described below, which is also the case when the shell is invoked as Ibinlsh.
OPTIONS

The flags below are interpreted by the shell on invocation only; unless the -c or -s flag is specified, the first
argument is assumed to be the name of a file containing commands, and the remaining arguments are
passed as positional parameters for use with the commands that file contains.

-c string

-s
-i

If the -c flag is present commands are read from string.
If the -s flag is present or if no arguments remain commands are read from the standard input.
Any remaining arguments specify the positional parameters. Shell output (except for Special
Commands) is written to file descriptor 2.
If the -i flag is present or if the shell input and output are attached to a terminal, this shell is
interactive. In this case TERMINATE is ignored (so that kill 0 does not kill an interactive
shell) and INTERRUPT is caught and ignored (so that wait is interruptible). In all cases, QUIT
is ignored by the shell.

The remaining flags and arguments are described under the set command, under Special Commands,
below.
USAGE

Refer to Doing More With UNIX Beginner's Guide for more information about using the shell as a programming language.
Commands
A simple command is a sequence of nonblank words separated by blanks. The first word specifies the
name of the command to be executed Except as specified below, the remaining words are passed as arguments to the invoked command The command name is passed as argument 0 (see exec (2». The value of
a command is its exit status if it terminates normally, or (octal) 200+status if it terminates abnormally (see
sigvec(2) for a list of status values).
A pipeline is a sequence of one or more commands separated by I (or, for historical compatibility, by'').
The standard output of each command but the last is connected by a pipe (2) to the standard input of the
next command. Each command is run as a separate process; the shell normally waits for the last command
to terminate before prompting for or accepting the next input line. The exit status of a pipeline is the exit
status of its last command.
A list is a sequence of one or more simple commands or pipelines, separated by;, &, &&, or II, and
optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower
than that of && and II. The symbols && and II also have equal precedence. A semicolon (;) causes
sequential execution of the preceding pipeline; an ampersand (&) causes asynchronous execution of the
preceding pipeline (the shell does not wait for that pipeline to finish). The symbols && and II are used to
indicate condition execution of the list that follows. With && , list is executed only if the preceding

Sun Release 3.2

Last change: 7 July 1986

377

SH( 1)

USER COMMANDS

SH( 1)

pipeline (or command) returns a zero exit status. With I I, list is executed only if the preceding pipeline (or
command) returns a nonzero exit status. An arbitrary number of NEWLINEs may appear in a list, instead of
semicolons, to delimit commands.
A command is either a simple command or one of the following constructions. Unless otherwise stated, the
value returned by a command is that of the last simple command executed in the construction.

for name [ in word. .. ] do list done
Each time a for command is executed, name is set to the next word taken from the in word list. If
in word. .. is omitted, then the for command executes the do list once for each positional parameter that is set (see Parameter Substitution below). Execution ends when there are no more words
in the list
case word in [pattern[ I pattern] ... ) list ;; ] ... esac
A case command executes the list associated with the first pattern that matches word. The form
of the patterns is the same as that used for filename generation (see Filename Generation) except
that a slash, a leading dot, or a dot immediately following a slash need not be matched explicitly.
if list then list [ ellf list then list ] ... [ else list ] fi
The list following if is executed and, if it returns a zero exit status, the list following the first then
is executed. Otherwise, the list following ellf is executed and, if its value is zero, the list following the next then is executed. Failing that, the else list is executed. If no else list or then list is
executed, then the if command returns a zero exit status.
while list do list done
A while command repeatedly executes the while list and, if the exit status of the last command in
the list is zero, executes the do list; otherwise the loop terminates. If no commands in the do list
are executed, then the while command returns a zero exit status; until may be used in place of
while to negate the loop termination test.
(list)
Execute list in a subshell.
{list;} list is simply executed.
name 0 {list;}

Define a function which is referenced by name. The body of the function is the list of commands
between { and }. Execution of functions is described below (see Execution ).
The following words are only recognized as the first word of a command and when not quoted:

if then else elif fi case esac for while until do done { }
Comments

A word beginning with - causes that word and all the following characters up to a NEWLINE to be ignored.
Command Substitution'

The standard output from a command enclosed in a pair of grave accents (, , ) may be used as part or all of
a word; trailing NEWLINE s are removed.
Parameter Substitution
The character % is used to introduce substitutable parameters. There are two types of parameters, positional and keyword. If parameter is a digit, it is a positional parameter. Positional parameters may be

assigned values by set. Keyword parameters (also known as variables) may be assigned values by writing:
name=value [ name=value ] ...

Pattern-matching is not performed on value. There cannot be a function and a variable with the same
name.
% {parameter}

The value, if any, of the parameter is substituted. The braces are required only when parameter is
followed by a letter, digit, or underscore that is not to be interpreted as part of its name. If parameter is * or @, all the positional parameters, starting with % 1, are substituted (separated by
spaces). Parameter %0 is set from argument zero when the shell is invoked.

378

Last change: 7 July 1986

Sun Release 3.2

SH( 1)

USER COMMANDS

SH( 1)

If the colon (:) is omitted from the following expressions, the shell only checks whether parameter is set or

not
% {parameter:-word}

If parameter is set and is nonnull, substitute its value; otherwise substitute word.
% {parameter:=word}
If parameter is not set or is null set it to word; the value of the parameter is substituted. Positional
parameters may not be assigned to in this way.
% {parameter:?word}
If parameter is set and is nonnull, substitute its value; otherwise, print word and exit from the
shell. If word is omitted, the message "parameter null or not set" is printed.
% {parameter:+word}
If parameter is set and is nonnull, substitute word; otherwise substitute nothing.
In the above, word is not evaluated unless it is to be used as the substituted string, so that, in the following
example, pwd is executed only if d is not set or is null:
echo %{ d:-' pwd' }
The following parameters are automatically set by the shell:
The number of positional parameters in decimal.
Flags supplied to the shell on invocation or by the set command.
?
The decimal value returned by the last synchronously executed command
%
The process number of this shell.
The process number of the last background command invoked.
The following parameters are used by the shell:
HOME The default argument (home directory) for the cd command.
PATH The search path for commands (see Execution below).
CDPATH
The search path for the cd command.
MAIL If this parameter is set to the name of a mail file and the MAILPATH parameter is not set,
the shell informs the user of the arrival of mail in the specified file.
MAILCHECK
This parameter specifies how often (in seconds) the shell will check for the arrival of
mail in the files specified by the MAILPATH or MAIL parameters. The default value is
600 seconds (10 minutes). If set to 0, the shell will check before each prompt.
MAILPATH
A colon (:) separated list of filenames. If this parameter is set, the shell informs the user
of the arrival of mail in any of the specified files. Each filename can be followed by %
and a message that will be printed when the modification time changes. The default message is you have mail.
PSt
Primary prompt string, by default" % ".
PS2
Secondary prompt string, by default' '> ".
IFS
Internal field separators, normally SPACE, TAB. and NEWLINE.
SHELL When the shell is invoked, it scans the environment (see Environment below) for this
name. If it is found and there is an 'r' in the filename part of its value, the shell becomes
a restricted shell.
The shell gives default values to PATH, PSI, PS2, MAILCHECK and IFS. HOME and MAIL are set by
login (1).
Blank Interpretation
After parameter and command substitution, the results of substitution are scanned for internal field separator characters (those found in IFS) and split into distinct arguments where such characters are found
Explicit null arguments (tt" or ,,) are retained. Implicit null arguments (those resulting from parameters
that have no values) are removed.

Sun Release 3.2

Last change: 7 July 1986

379

SH( 1)

USER COMMANDS

SH( 1)

Filename Generation
Following substitution, each command word is scanned for the characters *, ?, and [. If one of these characters appears the word is regarded as a pattern. The word is replaced with alphabetically sorted filenames
that match the pattern. If no filename is found that matches the pattern, the word is left unchanged. The
character. at the start of a filename or immediately following a /, as well as the character / itself, must be
matched explicitly.

*
?
[ ... ]

Matches any string, including the null string.
Matches any single character.
Matches anyone of the enclosed characters. A pair of characters separated by - matches
any character lexically between the pair, inclusive. If the first character following the
opening "[" is a "!" any character not enclosed is matched.

Quoting
The following characters have a special meaning to the shell and cause termination of a word unless
quoted:

I

; & ( )

A

< > NEWLINE SPACE TAB

A character may be quoted (i.e., made to stand for itself) by preceding it with a \. The pair \NEWLINE is
ignored All characters enclosed between a pair of single quote marks (, '), except a single quote, are
quoted. Inside double quote marks (" "), parameter and command substitution occurs and \ quotes the characters \ "', ", and %. "%*" is equivalent to "%1 %2 ...", whereas "%@" is equivalent to "%1"

"%2" ....
Prompting
When used interactively, the shell prompts with the value of PSI before reading a command. IT at any time
a NEWLINE is typed and further input is needed to complete a command, the secondary prompt (i.e., the
value of PS2) is issued.
Input/Output
Before a command is executed, its input and output may be redirected using a special notation interpreted
by the shell. The following may appear anywhere in a simple command or may precede or follow a command and are not passed on to the invoked command; substitution occurs before word or digit is used:

word
> >word
< <[ - ] word

<&digit

<&-

Use file word as standard input (file descriptor 0).
Use file word as standard output (file descriptor 1). If the file does not exist it is created;
otherwise, it is truncated to zero length.
Use file word as standard output. If the file exists output is appended to it (by first seeki(lg to the end-of-file); otherwise, the file is created.
The shell input is read up to a line that is the same as word, or to an end-of-file. The
resulting document becomes the standard input If any character of word is quoted, no
interpretation is placed upon the characters of the document; otherwise, parameter and
command substitution occurs, (unescaped) \NEWLINE is ignored, and \ must be used to
quote the characters \ %, "', and the first character of word. If - is appended to < <, all
leading TABs are stripped from word, and from the document.
Use the file associated with file descriptor digit as standard input. Similarly for the standard output using >&digit.
The standard input is closed. Similarly for the standard output using >&-.

If any of the above is preceded by a digit, the file descriptor which will be associated with the file is that
specified by the digit (instead of the default 0 or 1). For example:
... 2>&1

associates file descriptor 2 with the file currently associated with file descriptor 1.
The order in which redirections are specified is significant The shell evaluates redirections left-to-right
For example:

380

Last change: 7 July 1986

Sun Release 3.2

SH( 1)

USER COMMANDS

SH(I)

... l>xu2>&1

first associates file descriptor 1 with file xu. It associates file descriptor 2 with the file associated with file
descriptor 1 (i.e. xu). If the order of redirections were reversed, file descriptor 2 would be associated with
the terminal (assuming file descriptor 1 had been) and file descriptor 1 would be associated with file xu.
If a command is followed by & the default standard input for the command is the empty file /dev/null.
Otherwise, the environment for the execution of a command contains the file descriptors of the invoking
shell as modified by input/output specifications.
Redirection of output is not allowed in the restricted shell.
Environment
The environment (see environ(5V» is a list of name-value pairs that is passed to an executed program in
the same way as a normal argument list. The shell interacts with the environment in several ways. On
invocation, the shell scans the environment and creates a parameter for each name found, giving it the
corresponding value. If the user modifies the value of any of these parameters or creates new parameters,
none of these affects the environment unless the export command is used to bind the shell's parameter to
the environment (see also set -a). A parameter may be removed from the environment with the unset command. The environment seen by any executed command is thus composed of any unmodified name-value
pairs originally inherited by the shell, minus any pairs removed by unset, plus any modifications or additions, all of which must be noted in export commands.

The environment for any simple command may be augmented by prefixing it with one or more assignments
to parameters. Thus:
TERM=450 cmd
and
(export TERM; TERM=450; cmd)
are equivalent (as far as the execution of cmd is concerned).
If the -k flag is set, all keyword arguments are placed in the environment, even if they occur after the command name. The following first prints a=b c and c:
echo a=b c
set -k
echo a=b c
Signals
The INTERRUPT and QUIT signals for an invoked command are ignored if the command is followed by &;
otherwise signals have the values inherited by the shell from its parent, with the exception of signal 11 (but
see also the trap command below).
Execution
Each time a command is executed, the above substitutions are carried out. If the command name matches
one of the Special Commands listed below, it is executed in the shell process. If the command name does
not match a Special Command, but matches the name of a defined function, the function is executed in the
shell process (note how this differs from the execution of shell procedures). The positional parameters
% 1, % 2, .. .. are set to the arguments of the function. If the command name matches neither a Special
Command nor the name of a defined function, a new process is created and an attempt is made to execute
the command via exec (2).

The shell parameter PATH defines the search path for the directory containing the command. Alternative
directory names are separated by a colon (:). The default path is :/bin:/usr/bin (specifying Ibin, and
lusrlbin, in addition to the current directory). Directories are searched in order. The the current directory
is specified by a null path name, which can appear immediately after the equal sign (PATH=: ... ) or
between the colon delimiters ( ... :: ... ) anywhere else in the path list If the command name contains a I
the search path is not used; such commands will not be executed by a restricted shell. Otherwise, each
directory in the path is searched for an executable file. If the file has execute permission but is not an

Sun Release 3.2

Last change: 7 July 1986

381

SHe 1)

USER COMMANDS

SH(1 )

binary executable (see a.out(S) for details) it is assumed to be a file containing shell commands. A subshell is spawned to read it. A parenthesized command is also executed in a subshell.
The location in the search path where. a command was found is remembered by the shell (to help avoid
unnecessary execs later). If the command was found in a relative directory, its location must be redetermined whenever the current directory changes. The shell forgets all remembered locations whenever
the PATH variable is changed or the hash -r command is executed (see below).
Special Commands

Input/output redirection is now permitted for these commands. File descriptor 1 is the default output location.
No effect; the command does nothing. A zero exit code is returned.
Read and execute commands from file and return. The search path specified by PATH is used to
find the directory containing file .
break [ n ]
Exit from the enclosing for or while loop, if any. If n is specified break n levels.
continue [ n ]
Resume the next iteration of the enclosing for or while loop. If n is specified resume at the n-th
enclosing loop.
cd [ arg]
Change the current directory to arg. The shell parameter HOME is the default arg. The shell
parameter CDPATH defines the search path for the directory containing arg. Alternative directory
names are separated by a colon (:). The default path is  (specifying the current directory).
Note that the current directory is specified by a null path name, which can appear immediately
after the equal sign or between the colon delimiters anywhere else in the path list. If arg begins
with a I the search path is not used. Otherwise, each directory in the path is searched for arg.
echo [ arg ... ]
Echo arguments. See echo(IV) for usage and description.
eval [ arg ... ]
The arguments are read as input to the shell and the resulting command(s) executed.
exec [ arg ... ]
The command specified by the arguments is executed in place of this shell without creating a new
process. Input/output arguments may appear and, if no other arguments are given, cause the shell
input/output to be modified
exit [ n ]
Causes a shell to exit with the exit status specified by n. If n is omitted the exit status is that of the
last command executed (an end-of-file will also cause the shell to exit.)
export [ name... ]
The given names are marked for automatic export to the environment of subsequently-executed
commands. If no arguments are given, a list of all names that are exported in this shell is printed
Function names may not be exported.
hash [ -r ] [ name... ]
For each name, the location in the search path of the command specified by name is determined
and remembered by the shell. The -r option causes the shell to forget all remembered locations.
If no arguments are given, information about remembered commands is presented. Hits is the
number of times a command has been invoked by the shell process. Cost is a measure of the work
required to locate a command in the search path. There are certain situations which require that
the stored location of a command be recalculated. Commands for which this will be done are
indicated by an asterisk (*) adjacent to the hits information. Cost will be incremented when the
recalculation is done.
login [ arg . .. ]
Equivalent to exec login arg .... See login(l) for usage and description.
pwd
Print the current working directory. See pwd(l) for usage and description.
read [ name... ]
• file

382

Last change: 7 July 1986

Sun Release 3.2

SH( 1)

USER COMMANDS

SH( 1)

One line is read from the standard input and the first word is assigned to the first name, the second
word to the second name, etc., with leftover words assigned to the last name. The return code is 0
unless an end-of-file is encountered.
readonly [ name . .. ]
The given names are marked readonly and the values of the these names may not be changed by
subsequent assignment If no arguments are given, a list of all readonly names is printed.
return [ n ]
Causes a function to exit with the return value specified by n. If n is omitted, the return status is
that of the last command executed.
set [ -aefbkntuvx- [ arg . .. ] ]
-a
Mark variables which are modified or created for export
-e
Exit immediately if a command exits with a nonzero exit status.
-r
Disable filename generation
-h
Locate and remember function commands as functions are defined (function commands
are normally located when the function is executed).
-k
All keyword arguments are placed in the environment for a command, not just those that
precede the command name.
-n
Read commands but do not execute them.
-t
Exit after reading and executing one command.
-u
Treat unset variables as an error when substituting.
-v
Print shell input lines as they are read.
-x
Print commands and their arguments as they are executed.
Do not change any of the Bags; useful in setting % 1 to -.
Using + rather than - causes these Bags to be turned off. These Bags can also be used upon invocation of the shell. The current set of Bags may be found in %-. The remaining arguments are
positional parameters and are assigned, in order, to % 1, % 2, and so on. If no arguments are
given, the values of all names are printed.
shift [ n ]
The positional parameters are shifted to the left, from position n+ 1 to position 1, and so on. Previous values between % 1 and %n are discarded. If n is not given, it is assumed to be 1.
test
Evaluate conditional expressions. See test(1V) for usage and description.
times Print the accumulated user and system times for processes run from the shell.
trap [ arg ] [ n ] ...
The command arg is to be read and executed when the shell receives signal(s) n. (Note that arg is
scanned once when the trap is set and once when the trap is taken.) Trap commands are executed
in order of signal number. Any attempt to set a trap on a signal that was ignored on entry to the
current shell is ineffective. An attempt to trap on signal 11 (memory fault) produces an error. If
arg is absent all trap(s) n are reset to their original values. If arg is the null string this signal is
ignored by the shell and by the commands it invokes. If n is 0 the command arg is executed on
exit from the shell. The trap command with no arguments prints a list of commands associated
with each signal number.
type [ name ... ]
For each name, indicate how it would be interpreted if used as a command name.
umask [ 000 ]
The user file-creation mode mask is set to 000. The three octal digits refer to read/write/execute
permissions for owner, group, and others, respectively. The value of each specified digit is subtracted from the corresponding 'digit' specified by the system for the creation of a file. For example, umask 022 removes group and others write permission (files normally created with mode 777
become mode 755; files created with mode 666 become mode 644). The current value of the
mask is printed if 000 is omitted.
unset [ name ... ]
For each name, remove the corresponding variable or function. The variables PATH, PSt, PS2,
MAILCHECK and IFS cannot be unset

Sun Release 3.2

Last change: 7 July 1986

383

USER COMMANDS

SH(l)

SH(l)

wait [ n ]
Wait for the specified process and report its termination status. If n is not given all currently
active child processes are waited for and the return code is zero.
EXIT STATUS

Errors detected by the shell, such as syntax errors, cause the shell to return a nonzero exit status. If the
shell is being used noninteractively execution of the shell file is abandoned. Otherwise, the shell returns
the exit status of the last command executed (see also the exit command above).
FILES
%HOMEI.profiie
Itmplsh*

ldev/null
SEE ALSO

csh(1), cd(l), echo(lV), login(I), pwd(l), test(IV), dup(2), exec(2), fork(2), pipe(2), signal(2), umask(2),
wait(2), aout(5), profile(5), environ(5).
CAVEATS
If a command is executed, and a command with the same name is installed in a.directory in the search path
before the directory where the original command was found, the shell will continue to exec the original

command Use the hash command to correct this situation.
If you move the current directory or one above it, pwd may not give the correct response. Use the cd command with a full path name to correct this situation.

384

Last change: 7 July 1986

Sun Release 3.2

SHELLTOOL ( 1 )

USER COMMANDS

SHELLTOOL (1 )

NAME

shelltool- Run a shell (or other program) in the SunView environment
SYNOPSIS
shelltool [ -C] [ -B boldstyle] [ -I command] [program [args ]]
DESCRIPTION

shelltool is a standard tool provided with the SunView environment.
When invoked, shelltool runs a program, (usually a shell) in an interactive terminal emulator based on a tty
subwindow. Keystrokes typed to the shelltool are passed to the program running in the shelltool. If this
program is a shell, it accepts commands and runs programs in the usual way. For its scrolling and editting
capabilities, you may prefer to use cmdtool instead of shelltool. See cmdtool(l), suntools(I), Terminal
Emulators, and Windows and Window-Based Tools: Beginner's Guide for more information.
To run graphics programs, use gfxtool- see gfxtool(l).
DEFAULTS OPTIONS
/TtylBold_style
For programs that use emphasized text, shell tool supports bolding as well as inverse video. To set
the emphasis style, choose the category Tty in defaultsedit and choose one of the following for the
Bold_style entry:
None
disables emphasis
Offset X
thicken character horizontally
Offset Y
thicken character vertically
Offset X and Y
thicken character both horizontally and vertically
- - Offset XY
thicken character diagonally
Offset X and XY
thicken character both horizontally and diagonally
- - Offset Y and XY
thicken character both vertically and diagonally
- - Offset- X - and Y and- XY
thicken character horizontally, vertically and diagonally
display emphasis as inverse video, the standard default
Invert

/Tty/Retained
No is the standard default; it specifies that tty subwindows are not retained. If Yes is chosen, tty
sub windows are retained; this enhances display speed at the expense of memory consumption.
Repaint speed when the window is uncovered is greatly enhanced.
COMMANDLINE OPTIONS
-C
Redirect system console output to this instance of the shelltool.

-B boldstyle
Sets the boldstyle for this instance of shelltool. Boldstyle may be any of the choices for the
defaults database entry for ITty/Bold_style, or it may be a number from 0 to 8. The numbers
mean:
o
None
1
Offset X
Offset Y
2
3
Offset_X_and_ Y
(means Offset_XI Offset_Y)
4
Offset XY
5
Offset_X_and_XY
(means Offset_X I Offset_XY)
6
Offset_Y_and_ XY
(means Offset_Y I Offset_XY)
Offset_X_and_ Y_and_ XY (means Offset_XI Offset_Y I Offset_XY)
7
8
Invert
-I command
Input a command to the shell. Spaces in the command must be escaped.

shelltool also takes generic tool arguments; see suntools(l) for a list of these arguments.

Sun Release 3.2

Last change: 30 September 1985

385

SHELLTOOL ( 1 )

USER COMMANDS

SHELLTOOL ( 1 )

If a program argument is present, shelltool runs it. If there are no arguments, shelltool runs the program
corresponding to your SHELL environment variable. If this environment variable is not available, then
shelltool runs Ibin/sh.
THE TERMINAL EMULATOR
The tty subwindow of shelltool is a terminal emulator. Whenever a tty subwindow is created, the startup
file -I.ttyswrc is parsed for tty subwindow-specific parameters. A sample .ttyswrc file may be found in
lusrllib/ttyswrc. The command format of this file is:

Comment
Turn on the specified variable.
When key is typed pretend text was input
When key is typed pretend text was output.

#

set variable
mapi key text
mapo key text

The only currently defined "variable" is "pagemode". "Key" is one of LI-L15, FI-F15, TI-T15, RI-R15,
LEFT, or RIGHT (see note below). "Text" may contain escapes such as \E, \n, AX, etc. (escape, newline,
control-X, respectively). See termcap(5) for the format of the string escapes that are recognized. Note that
"mapi" and "mapo" may be replaced by another keymapping mechanism in the future.
NOTE: When using the default kernel keyboard tables, the keys Ll, LEFT, RIGHT, BREAK, R8, RIO,
R12, and R14 cannot be mapped in this way because they send special values to the tty subwindow. Also,
when using the default kernel keyboard tables, LI-LIO are now used by SunView. See setkeys(l) and
kbd(5) for more information on how to change the behavior of the keyboard.
It is possible to have terminal-based programs drive the tool in which its tty subwindow resides by sending
it special escape sequences. These escape sequences may also be sent by typing a key appropriately
mapped using the "mapo" function described above. The following functions pertain to the tool in which
the tty subwindow resides, not the tty subwindow itself.
\E[lt
\E[2t
\E[3t
\E[3;TOP;LEFTt
\E[4t
\E[4;WIDTH;HTt
\E[St
\E[6t
\E[7t
\E[8;ROWS;COLSt
\E[llt
\E[13t
\E[14t
\E[18t
\E[20t
\E [21t
\E]l\E\
\E]I\E\
\E]L

Navigation menu