2 .\" Copyright 1989 AT&T
3 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
4 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
7 .\" are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical
8 .\" and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\" This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
11 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
12 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH AR 1 "Sep 10, 2013"
15 ar \- maintain portable archive or library
19 \fB/usr/bin/ar\fR \fB-d\fR [\fB-Vv\fR] \fIarchive\fR \fIfile\fR...
24 \fB/usr/bin/ar\fR \fB-m\fR [\fB-abiVv\fR] [\fIposname\fR] \fIarchive\fR \fIfile\fR...
29 \fB/usr/bin/ar\fR \fB-p\fR [\fB-sVv\fR] \fIarchive\fR [\fIfile\fR]...
34 \fB/usr/bin/ar\fR \fB-q\fR [\fB-cVv\fR] \fIarchive\fR \fIfile\fR...
39 \fB/usr/bin/ar\fR \fB-r\fR [\fB-abciuVv\fR] [\fIposname\fR] \fIarchive\fR \fIfile\fR...
44 \fB/usr/bin/ar\fR \fB-t\fR [\fB-sVv\fR] \fIarchive\fR [\fIfile\fR]...
49 \fB/usr/bin/ar\fR \fB-x\fR [\fB-CsTVv\fR] \fIarchive\fR [\fIfile\fR]...
54 The \fBar\fR utility maintains groups of files combined into a single archive
55 file. Its main use is to create and update library files. However, it can be
56 used for any similar purpose. The magic string and the file headers used by
57 \fBar\fR consist of printable \fBASCII\fR characters. If an archive is composed
58 of printable files, the entire archive is printable.
61 When \fBar\fR creates an archive, it creates headers in a format that is
62 portable across all machines. The portable archive format and structure are
63 described in detail in \fBar.h\fR(3HEAD). The archive symbol table described
64 there is used by the link editor \fBld\fR(1) to effect multiple passes over
65 libraries of object files in an efficient manner. An archive symbol table is
66 only created and maintained by \fBar\fR when there is at least one object file
67 in the archive. The archive symbol table is in a specially named file that is
68 always the first file in the archive. This file is never mentioned or
69 accessible to the user. Whenever the \fBar\fR command is used to create or
70 update the contents of such an archive, the symbol table is rebuilt. The
71 \fB-s\fR option described below forces the symbol table to be rebuilt.
75 The following options are supported:
82 Positions new \fIfile\fRs in \fIarchive\fR after the file named by the
83 \fIposname\fR operand.
92 Positions new \fIfile\fRs in \fIarchive\fR before the file named by the
93 \fIposname\fR operand.
102 Suppresses the diagnostic message that is written to standard error by default
103 when \fIarchive\fR is created.
112 Prevents extracted files from replacing like-named files in the file system.
113 This option is useful when \fB-T\fR is also used to prevent truncated file
114 names from replacing files with the same prefix.
123 Deletes one or more \fIfile\fRs from \fIarchive\fR.
132 Positions new \fIfile\fRs in \fIarchive\fR before the file named by the
133 \fIposname\fR operand. This option is quivalent to \fB-b\fR.
142 Moves \fIfile\fRs. If \fB-a\fR, \fB-b\fR, or \fB-i\fR with the \fIposname\fR
143 operand are specified, the \fB-m\fR option moves \fIfile\fRs to the new
144 position. Otherwise, \fB-m\fR moves \fIfile\fRs to the end of \fIarchive\fR.
153 Prints the contents of \fIfile\fRs in \fIarchive\fR to standard output. If no
154 \fIfile\fRs are specified, the contents of all files in \fIarchive\fR are
155 written in the order of the archive.
164 Quickly appends \fIfile\fRs to the end of \fIarchive\fR. Positioning options
165 \fB-a\fR, \fB-b\fR, and \fB-i\fR are invalid. The command does not check
166 whether the added \fIfile\fRs are already in \fIarchive\fR. This option is
167 useful to avoid quadratic behavior when creating a large archive
177 Replaces or adds \fIfile\fRs in \fIarchive\fR. If \fIarchive\fR does not exist,
178 a new archive file is created and a diagnostic message is written to standard
179 error, unless the \fB-c\fR option is specified. If no \fIfile\fRs are specified
180 and the \fIarchive\fR exists, the results are undefined. Files that replace
181 existing files do not change the order of the archive. If the \fB-u\fR option
182 is used with the \fB-r\fR option, only those files with dates of modification
183 later than the archive files are replaced. If the \fB-a\fR, \fB-b\fR, or
184 \fB-i\fR option is used, the \fIposname\fR argument must be present and
185 specifies that new files are to be placed after (\fB-a\fR) or before (\fB-b\fR
186 or \fB-i\fR) \fIposname\fR. Otherwise, the new files are placed at the end.
195 Forces the regeneration of the archive symbol table even if \fBar\fR is not
196 invoked with an option that will modify the archive contents. This command is
197 useful to restore the archive symbol table after the \fBstrip\fR(1) command has
198 been used on the archive.
207 Prints a table of contents of \fIarchive\fR. The files specified by the
208 \fIfile\fR operands are included in the written list. If no \fIfile\fR operands
209 are specified, all files in \fIarchive\fR are included in the order of the
219 Allows file name truncation of extracted files whose archive names are longer
220 than the file system can support. By default, extracting a file with a name
221 that is too long is an error. In that case, a diagnostic message is written and
222 the file is not extracted.
231 Updates older files. When used with the \fB-r\fR option, files within
232 \fIarchive\fR are replaced only if the corresponding \fIfile\fR has a
233 modification time that is at least as new as the modification time of the file
234 within \fIarchive\fR.
243 Gives verbose output. When used with options \fB-d\fR, \fB-r\fR, or \fB-x\fR,
244 the \fB-v\fR option writes a detailed file-by-file description of the archive
245 creation and the constituent \fIfile\fRs, and maintenance activity. When used
246 with \fB-p\fR, \fB-v\fR writes the name of the file to the standard output
247 before writing the file itself to the standard output. When used with \fB-t\fR,
248 \fB-v\fR includes a long listing of information about the files within the
249 archive. When used with \fB-x\fR, \fB-v\fR prints the filename preceding each
259 Prints its version number on standard error.
265 The following operands are supported:
272 A path name of the archive file.
281 A path name. Only the last component is used when comparing against the names
282 of files in the archive. If two or more \fIfile\fR operands have the same last
283 path name component (see \fBbasename\fR(1)), the results are unspecified. The
284 implementation's archive format will not truncate valid file names of files
285 added to or replaced in the archive.
294 The name of a file in the archive file, used for relative positioning. See
295 options \fB-m\fR and \fB-r\fR.
298 .SH ENVIRONMENT VARIABLES
301 See \fBenviron\fR(5) for descriptions of the following environment variables
302 that affect the execution of \fBar\fR: \fBLANG\fR, \fBLC_ALL\fR,
303 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR, and \fBNLSPATH\fR.
310 Determine the pathname that overrides the default directory for temporary
320 Determine the timezone used to calculate date and time strings written by
321 \fBar\fR \fB-tv\fR. If \fBTZ\fR is unset or null, an unspecified default
328 The following exit values are returned:
335 Successful completion.
350 See \fBattributes\fR(5) for descriptions of the following attributes:
351 .SS "\fB/usr/bin/ar\fR"
359 ATTRIBUTE TYPE ATTRIBUTE VALUE
361 Interface Stability Committed
367 \fBbasename\fR(1), \fBcpio\fR(1), \fBld\fR(1), \fBlorder\fR(1), \fBstrip\fR(1),
368 \fBtar\fR(1), \fBar.h\fR(3HEAD), \fBa.out\fR(4), \fBattributes\fR(5),
369 \fBenviron\fR(5), \fBstandards\fR(5)
373 If the same file is mentioned twice in an argument list, it may be put in the
377 By convention, archives are suffixed with "\fB\&.a\fR".
380 When inserting \fBELF\fR objects into an archive file, \fBar\fR might add
381 "\fB\en\fR" characters to pad these objects to an 8-byte boundary. Such padding
382 improves the efficiency with which \fBld\fR(1) can access the archive. Only
383 \fBELF\fR object files are padded in this way. Other archive members are not
384 altered. When an object with such padding is extracted from an archive, the
385 padding is not included in the resulting output.