AR(1) SysV AR(1)
NAME
ar - archive and library maintainer for portable archives
SYNOPSIS
ar key [posname] afile [name] . . .
DESCRIPTION
ar maintains groups of files combined into a single archive file.
Although its main use is to create and update library files as used by
the link editor, ar can be used for any similar purpose. The magic
string and the file headers used by ar consist of printable ASCII
characters. If an archive is composed of printable files, the entire
archive is printable.
When ar creates an archive, it produces headers in a format that is
portable across all machines. The portable archive format and structure
is described in detail in ar(4). The link editor uses the archive symbol
table to effect multiple passes over libraries of object files in an
efficient manner. The link editor is further described in ld(1).
ar creates and maintains an archive symbol table and module name table
only when there is at least one object file in the archive. The archive
symbol table is in a specially named file which is always the first file
in the archive. This file is never mentioned or accessible. Whenever ar
creates or updates the contents of such an archive, it also rebuilds the
symbol table. Domain/OS SysV ar builds a module name table and a long
name table in addition to the symbol table; these tables are stored in
files that are never mentioned or accessible.
key is an optional dash (-) followed by one character from the drqtpmx
set, optionally concatenated with one of more characters from the vclsho
set. posname is the name of an optional positioning character. afile is
the archive file.
OPTION
A This option may or may not begin with a dash (-), and is used with
the mxtd keys to move, extract, list or delete by module name.
KEY CHARACTERS
d Deletes named files from the archive file.
r Replaces named files in the archive file. If the optional character
u is used with r, then only those files with dates of modification
later than the archive files are replaced. If an optional
positioning character from the set abi is used, then the posname
argument must be present and specifies that new files are to be
placed after (a) or before (b or i) posname. Otherwise new files
are placed at the end.
q Quickly appends named files to the end of the archive file.
Optional positioning characters are invalid. Do not check whether
the added members are already in the archive. Useful for avoiding
quadratic behavior when creating a large archive piece-by-piece.
Unchecked, the file can grow exponentially up to the second degree.
t Prints a table of contents of the archive file. If no names are
given, table all files. If names are given, table only those files
named.
p Prints named files in the archive.
m Moves named files to the end of the archive. If a positioning
character is present, then the posname argument must be present and,
as in r, specifies where the files are to be moved.
x Extracts named files. If no names are given, all files in the
archive are extracted. In neither case does x alter the archive
file.
KEY ARGUMENTS
v Gives a file-by-file description of the making of a new archive file
from the old archive and the constituent files. When used with t,
give a long listing of all information about the files. When used
with x, precede each file with a name.
c Creates afile and suppress the message produced by default when
afile is created.
l Places temporary files in the local (current working) directory
rather than in the default temporary directory, TMPDIR.
s Forces the regeneration of the archive symbol table even if ar(1) is
not invoked with a command that modifies the archive contents.
Useful for restoring the archive symbol table after the strip(1)
command has been used on the archive.
h Sets the modification times in the member headers of the named files
to the current date and time. If you do not specify any filenames,
ar sets the time stamps of all member headers.
o When used with the x key, sets the modification time of the copied
file to the modification time of the archive member, instead of the
current time.
NOTES
If the same file is mentioned twice in an argument list, it may be put in
the archive twice.
FILES
$TMPDIR/* Temporary files
$TMPDIR is usually /usr/tmp but can be redefined by setting the
environment variable TMPDIR [see tempnam() in tmpnam(3S)].
SEE ALSO
ld(1), lorder(1), strip(1), tmpnam(3S), a.out(4), ar(4) in the SysV
Programmer's Reference.