a

ar(1)

ar(1)

NAME

ar - create and maintain portable archives and libraries

SYNOPSIS

ar [-]key [-][modi®er ...] [posname] a®le [name ...]

DESCRIPTION

The ar command maintains groups of ®les combined into a single archive ®le. Its main use is to create and update library ®les as used by the link editor (see ld(1)). It can be used, however, for any similar purpose. The magic string and ®le headers used by ar consist of printable ASCII characters. If an archive is composed of printable ®les, the entire archive is printable.

Individual ®les are inserted without conversion into the archive ®le. 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 to search repeatedly and ef®ciently through libraries of object ®les. An archive symbol table is created and maintained by ar only when the archive contains at least one object ®le. The archive symbol table is in a specially named ®le that is always the ®rst ®le in the archive. This ®le is never mentioned or accessible to the user. Whenever ar is used to create or update the contents of an archive, the symbol table is rebuilt (unless the z modi®er is used). The s modi®er described below forces the symbol table to be rebuilt.

One key operation character from the set, drqtpmx, is required and can be optionally preceded by a hyphen (-). The required key operation character can be speci®ed with one or more modi®er characters from the set abcfFilsuvzACT. posname is used with the r and m key operations and the a, b, and i modi®ers to specify a position in the archive. a®le is the archive ®le. Constituent ®les in the archive ®le are speci®ed by name arguments.

The following list describes the key operation characters:

dDelete the named ®les from the archive ®le.

rReplace the named ®les, or add a new ®le to the archive:

If the u modi®er is used with the operation character r, only those ®les with modi®cation dates later than those of the corresponding member ®les are replaced.

If an optional positioning character from the set abi is used, the posname argument must be present and speci®es that new ®les are to be placed after (a) or before (b or i) posname. In the absence of a positioning character, new ®les are placed at the end.

ar creates a®le if it does not already exist.

If no name is speci®ed and:

the speci®ed archive ®le does not exist, ar creates an empty archive ®le containing only the archive header (see ar(4)).

the archive contains one or more ®les whose names match names in the current directory, each matching archive ®le is replaced by the corresponding local ®le without considering which ®le may be newer unless the u modi®er is also speci®ed.

qQuickly append the named ®les to the end of the archive ®le. Positioning characters are invalid. The operation does not check to determine whether the added members are already in the archive. ar creates a®le if it does not already exist.

tPrint a table of contents of the archive ®le to the standard output. If no names are given, all ®les in the archive are described. If names are given, information about only those ®les appears.

pPrint the named ®les in the archive to the standard output. If no names are speci®ed, the con- tents of all ®les are printed in the order that they appear in the archive.

mMove the named ®les. By default, the ®les are moved to the end of the archive. If a positioning character is present, the posname argument must be present and, as in the r operation, posname speci®es where the ®les are to be moved. Note that, when used with a positioning char- acter, the ®les are moved in the same order that they currently appear in the archive, not in the order speci®ed on the command line. See EXAMPLES.

xExtract the named ®les. If no names are given, all ®les in the archive are extracted. In neither case does x alter entries from the archive ®le.

Section 120

− 1 −

HP-UX Release 11i: December 2000