AR(1) UNIX Programmer's Manual AR(1) NAME ar - archive and library maintainer SYNOPSIS ar key [ posname ] afile name ... HP-UX COMPATIBILITY Level: HP-UX/STANDARD Origin: System III DESCRIPTION _A_r maintains groups of files combined into a single archive file. Its main use is to create and update library files for use by the link editor. It can be used, though, for any similar purpose. The archive file format is consistent across all HP-UX implementations. It is only useful to port source archives. Individual files are inserted without conversion into the archive file. Note that _a_r files from other UNIX systems are not readable on HP-UX, even if those files contain ASCII text. _K_e_y must be present, and is one character from the set drqtpmx, optionally concatenated with one or more of vuaibcl. _A_f_i_l_e is the archive file. The _n_a_m_e_s are consti- tuent files in the archive file. The meanings of the _k_e_y characters for operations on an archive are: d Delete the named constituents 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 modified dates later than the archive files are replaced. If an optional positioning character from the set abi is used, then the _p_o_s_n_a_m_e argument must be present and specifies that new copies of the named files are to be placed after (a) or before (b or i) _p_o_s_n_a_m_e. In the absence of a positioning char- acter, new files are placed at the end. _A_r will create _a_f_i_l_e if it does not already exist. If there are no file _n_a_m_es, _a_r may create an empty archive file whose only contents is the archive magic number (see _m_a_g_i_c(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. _A_r will create _a_f_i_l_e 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 _p_o_s_n_a_m_e argu- ment 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 _i_n _t_h_e _s_a_m_e _o_r_d_e_r that they currently appear in the archive, _n_o_t 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. When used with t, it gives a long listing of all information about the files from the archive headers. When used with the d, m, p, q, and x options, the verbose option causes _a_r to print the key letter and file name associated with each file for that opera- tion. For the r operation, _a_r will show an "a" if it added a new file, or an "r" if it replaced an existing one. c Create. Normally _a_r will create _a_f_i_l_e when it needs to (for the r and q operations). The create option suppresses the normal message that is produced when _a_f_i_l_e is created. l Local. Normally _a_r places its temporary files in the directory /tmp. This option causes them to be placed in the current working directory. Only the d, m, and r options use temporary files. Only the following combinations are meaningful: d: v, l r: u, v, c, l, and a | b | i q: v, c t: v p: v m: v, l, and a | b | i x: v 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 ra f1 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. The first command says "move f3 after f2 in newlib.a", thus creating the order f2 f3 f1 f4 The second command above says "replace files f2 and f3 in newlib.a, and put the new copies after f1". Note that the new files must be replaced in the same order as they already occur in the archive. This is why the first command above is used to create a new order that will be preserved in the replace operation. Thus, the two commands above cannot be replaced by ar ra f1 newlib.a f2 f3 because the previous order of f2 and f3 in the archive will be preserved (no matter how the files are specified on the command line), producing the following archive: newlib.a: f1 f3' f2' f4 FILES /tmp/v* temporary files SEE ALSO ld(1), lorder(1), ranlib(1), ar(5).