AR(1) HP-UX 5.0 AR(1) NAME ar - archive and library maintainer for portable archives SYNOPSIS ar key [ posname ] afile [name] ... HP-UX COMPATIBILITY Level: HP-UX/STANDARD Origin: System V 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. It can be used, though, 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. 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. The portable archive format and structure is described in detail in ar(4). The archive symbol table (described in ar(4)) is used by the link editor (ld(1)) to effect multiple passes over libraries of object files in an efficient manner. An archive symbol table is only created and maintained by ar 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 to the user. Whenever the ar(1) command is used to create or update the contents of such an archive, the symbol table is rebuilt. The s option described below will force the symbol table to be rebuilt. Key must be present, and is an optional -, followed by one character from the set drqtpmx, optionally concatenated with one or more of vuaibcls. Afile is the archive file. The names are constituent files in the archive file. The meanings of the key characters for operations on an archive are: d Delete the named files from the archive file. r Replace the named files, or add a new file to the archive. 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 copies of the named 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. Ar will create afile if it does not already exist. If there are no file names, ar will create an empty archive file whose only contents is the archive header (see ar(5)). q Quickly append the named files to the end of the archive file. Optional positioning characters are invalid. The command does not check 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 will create 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 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. 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 meanings of the remaining optional modifying characters are: 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, it gives a long listing of all information about the files. When used with the d, m, p, q, and x options, the verbose option causes ar to print the key letter and file name associated with each file for that operation. For the r operation, ar will show an "a" if it added a new file, or an "r" if it replaced an existing one. c Create. Normally ar will create afile when it needs to (for the r and q operations). The create option suppresses the normal message that is produced when afile is created. 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 /tmp. Only the d, m, r and s options use temporary files. s Force the regeneration of the archive symbol table even if ar(1) is not invoked with a command which will modify the archive contents. This command is useful to restore the archive symbol table after the strip(1) command has been used on the archive. Only the following combinations are meaningful: d: v, l r: u, v, c, l, and a | b | i q: v, c t: v, s p: v, s m: v, l, and a | b | i x: v, s For other combinations of modifiers with operations not shown in the above table, the modifier has no effect. EXAMPLES The command ar r newlib.a f3 f2 f1 f4 will create a new file (if one does not already exist) in archive format with its constituents entered in the order shown in the above command line. If you want to replace files f2 and f3 such that the new copies follow file f1, the commands ar ma f2 newlib.a f3 ar ma f1 newlib.a f2 f3 ar r newlib.a f2 f3 will produce the desired effect. The archive will now be ordered newlib.a: f1 f2' f3' f4 where the single quote marks indicate updated files. FILES /tmp/ar* temporaries SEE ALSO arcv(1), ld(1), lorder(1), strip(1). tmpnam(3S), a.out(5), ar(5), ranlib(5). WARNING If you are the super-user, ar will alter any archive file, even if it is write-protected. NOTES This archive format is new to this release. The arcv(1) command can be used to change an older archive file into an archive file that is recognized by this ar command. BUGS If the same file is mentioned twice in an argument list, it may be put in the archive twice. 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.