AR(1) BSD AR(1)
NAME
ar - archive and library maintainer
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, you can use ar for any similar purpose. The magic
string and the file headers that ar uses 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 various machines running UNIX. The portable archive
format and structure is described in ar(5). The link editor uses the
archive symbol table to effect multiple passes over libraries of object
files efficiently. The link editor is further described in ld(1).
ar creates and maintains an archive symbol table and module table only
when there is at least one object file in the archive. The archive symbol
table is in a specially named file that 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 BSD 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.
The command key is a required part of ar's command line. key is an
optional dash (-) followed by one character from the drqtpmx set,
optionally concatenated with one of more characters from the vuaibcls
set. The dtmx keys can be used with the BSD key argument A to act on
module names. posname is the name of an optional positioning character.
afile is the archive file. The names are constituent files in the
archive file.
KEY CHARACTERS
d Delete named files from the archive file.
r Replace named files in the archive file. If you use the optional
character u with r, only those files with modification dates later
than the archive files are replaced. If you use an optional
positioning character from the set abi , 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 append 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. This option is useful for
avoiding quadratic behavior when you create a large archive piece by
piece. Unchecked, the file can grow exponentially up to the second
degree.
t Print a table of contents of the archive file. If you do not
specify names, table all files. If you specify names, table only
those files named.
p Print named files in the archive.
m Move named files to the end of the archive. If a positioning
character is present, the posname argument must be present and, as
in r, specifies where the files are to be moved.
x Extract named files. If you do not specify names, all files in the
archive are extracted. In neither case does x alter the archive
file.
KEY ARGUMENTS
v Give 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 Create afile and suppress the message produced by default when afile
is created.
l Place temporary files in the local (current working) directory
rather than in the default temporary directory, /tmp.
s Force the regeneration of the archive symbol table even if you do
not invoke ar(1) with a command that modifies the archive contents.
This option is useful for restoring the archive symbol table after
you use the strip(1) command on the archive.
A Can be used with the keys dtmx to respectively delete, print a table
of contents, move, or extract by module names.
NOTES
ranlib(1) is not necessary in Domain/OS.
BUGS
If the same file is mentioned twice in an argument list, it may be put in
the archive twice.
FILES
/tmp/v* Temporaries
SEE ALSO
ld(1), lorder(1), ranlib(1), ar(5)