HPUX ar[1]

ar in anderen Kapiteln des hpux Handbuch:
ar.4
ar(1) ar(1)
NAME
ar - maintain portable archives and libraries
SYNOPSIS
ar key [posname] afile [name] ...
DESCRIPTION
ar maintains groups of files combined into a single archive file. Its
main use is to create and update library files as used by the link
editor (see ld(1). It can be used, however, for any similar purpose.
The magic string and file headers used by ar consist of printable
ASCII characters. If an archive is composed of printable files, the
entire archive is printable.
Individual files are inserted without conversion into the archive
file. When ar creates an archive, it creates headers in a format that
is portable across all machines. See ar(4) for a detailed description
of the portable archive format and structure. The archive symbol
table (described in ar(4)) is used by the link editor (see ld(1)) to
search repeatedly and efficiently through libraries of object files.
An archive symbol table is created and maintained by ar only when the
archive contains at least one object file. 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 to the user.
Whenever the ar(1) command is used to create or update the contents of
an archive, the symbol table is rebuilt. The s modifier described
below forces the symbol table to be rebuilt.
key must be present, and consists of an optional -, followed by one
operation character from the set drqtpmx, optionally concatenated with
one or more modifier characters from the set vuaibcls. afile is the
archive file. Constituent files in the archive file are specified by
name arguments.
The TMPDIR environment variable can be set to specify a directory for
temporary files (see tmpnam(3S)). The l modifier overrides the TMPDIR
variable, and TMPDIR overrides the default directory /usr/tmp
The following key operation characters are recognized:
d Delete the named files from the archive file.
r Replace the named files, or add a new file to the
archive:
o If the modifier u is used with the operation character
r, only those files with dates of modification later
than the archive files are replaced.
o If an optional positioning character from the set abi
is used, the posname argument must be present and
Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992
ar(1) ar(1)
specifies that new files are to be placed after (a) or
before (b or i) posname. In the absence of a
positioning character, new files are placed at the
end.
o ar creates afile if it does not already exist.
o If no name is specified and:
o the specified archive file does not exist, ar
creates an empty archive file containing only the
archive header (see ar(4)).
o the archive contains one or more files whose names
match names in the current directory, each matching
archive file is replaced by the corresponding local
file without considering which file may be newer
unless the u modifier is also specified.
q Quickly append the named files to the end of the archive
file. Positioning characters are invalid. The operation
does not check to determine whether the added members are
already in the archive. This is useful only to avoid
quadratic behavior when creating a large archive piece-
by-piece. ar creates afile if it does not already exist.
t Print a table of contents of the archive file. If no
names are given, all files in the archive are described.
If names are given, information about only those files
appears.
p Print the named files in the archive.
m Move the named files. By default, the files are moved to
the end of the archive. If a positioning character is
present, the posname argument must be present and, as in
r, posname specifies where the files are to be moved.
Note that, when used with a positioning character, the
files are moved in the same order that they currently
appear in the archive, not in the order specified on the
command line. See EXAMPLES.
x Extract the named files. If no names are given, all
files in the archive are extracted. In neither case does
x alter (i.e., delete entries from) the archive file.
The following optional modifiers are recognized:
c Create. For r and q operations, ar normally creates
afile if it does not already exist. The c modifier
suppresses the message normally produced when afile is
Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992
ar(1) ar(1)
created.
f Force. Truncate filenames to 14 characters before
comparing with existing filenames in the archive, which
are already truncated to 14 characters. When used with
the r operation, the first existing file that matches the
truncated filename is replaced. The f modifier can also
be used with other operations to allow the full filenames
to be specified, rather than the truncated filenames.
l Local. Place temporary files in the local current
working directory rather than in the directory specified
by the environment variable TMPDIR or in the default
directory /usr/tmp. Only the d, m, and r operations and
the s modifier use temporary files.
s Force the regeneration of the archive symbol table even
if ar is not invoked with an operation that modifies the
archive contents. This modifier is useful for restoring
the archive symbol table after the strip command has been
used on the archive (see strip(1)).
u Update. (r operations only) Do not copy the local file
to the archive unless the local file is newer than the
corresponding existing file in the archive.
v Verbose. Give a verbose file-by-file description of the
making of a new archive file from the old archive and the
constituent files. When used with t, v gives a long
listing of all information about the files. When used
with the d, m, p, q, or x operations, the verbose
modifier causes ar to print each key operation character
and file name associated with that operation. For the r
operation, ar shows an a if it adds a new file or an r if
it replaces an existing one.
A Suppress warning messages regarding optional access
control list entries. ar(1) does not archive optional
access control list entries in a file's access control
list (see acl(5)). Normally, a warning message is
printed for each file having optional access control list
entries.
Only the following combinations are meaningful; no other combination
of modifiers with operations have any effect on the operation:
d: v, f, l
r: u, v, c, f, l, A, and a | b | i
q: v, c
t: v, s
Hewlett-Packard Company - 3 - HP-UX Release 9.0: August 1992
ar(1) ar(1)
p: v, f, s
m: v, f, l, and a | b | i
x: v, f, s
EXTERNAL INFLUENCES
Environment Variables
LC_TIME determines the format and contents of date and time strings.
If LC_TIME is not specified in the environment or is set to the empty
string, the value of LANG is used as a default for each unspecified or
empty variable. If LANG is not specified or is set to the empty
string, a default of "C" (see lang(5)) is used instead of LANG. If
any internationalization variable contains an invalid setting, ar
behaves as if all internationalization variables are set to "C". See
environ(5).
DIAGNOSTICS
phase error on file name
The named file was modified by another process while ar
was copying it into the archive. When this happens, ar
exits and the original archive is left untouched.
ar write error: file system error message
ar could not write to a temporary file or the final
output file. If ar was trying to write the final
output file, the original archive is lost.
ar reports cannot create file.a, where file.a is an ar-format archive
file, even if file.a already exists. This message is triggered when
file.a is write-protected or inaccessible.
EXAMPLES
Create a new file (if one does not already exist) in archive format
with its constituents entered in the order indicated:
ar r newlib.a f3 f2 f1 f4
Replace files f2 and f3 such that the new copies follow file f1, and
f3 follows f2:
ar ma f1 newlib.a f2 f3
ar ma f2 newlib.a f3
ar r newlib.a f2 f3
The archive is then ordered:
newlib.a: f1 f2' f3' f4
where the single quote marks indicate updated files. The first
command says ``move f2 and f3 after f1 in newlib.a'', thus creating
the order:
Hewlett-Packard Company - 4 - HP-UX Release 9.0: August 1992
ar(1) ar(1)
f1 f3 f2 f4
Note that the relative order of f2 and f3 has not changed. The second
command says ``move f3 after f2 in newlib.a'', creating the order:
f1 f2 f3 f4
The third command then replaces files f2 and f3. Since files f2 and
f3 both already existed in the archive, this sequence of commands
could not be simply replaced by:
ar ra f1 newlib.a f2 f3
because the previous position and relative order of f2 and f3 in the
archive are preserved (no matter how the files are specified on the
command line), producing the following archive:
newlib.a: f3' f2' f1 f4
WARNINGS
If you are a user who has appropriate privileges, ar alters any
archive file, even if it is write-protected.
If the same file is mentioned twice in an argument list, it might be
put in the archive twice.
ar automatically creates an archive symbol table, a task performed in
early HP-UX versions by ranlib. If a ranlib command is executed, the
following message is displayed:
ranlib: ar already did it for you, see ar(1).
Access Control Lists
Access control list descriptions in this entry apply only to standard
HP-UX operating systems. If HP-UX BLS software has been installed,
access control lists are handled differently. Refer to HP-UX BLS
documentation for information about access control lists in the HP BLS
environment.
FILES
/usr/tmp/ar* temporary files
SEE ALSO
ld(1), lorder(1), strip(1), tmpnam(3S), a.out(4), ar(4), acl(5).
STANDARDS CONFORMANCE
ar: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company - 5 - HP-UX Release 9.0: August 1992