SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from Trustix binutils-2.10.0.18-2tr.i586.rpm

ar

Section: GNU Development Tools (1)
Updated: 1999
Index

 

NAME

ar - create, modify, and extract from archives.

 

SYNOPSIS

ar [-]{dmpqrtx}[abcfilNoPsSuvV] [membername] [count] archive files...

 

DESCRIPTION

The GNU ar program creates, modifies, and extracts fromarchives. An archive is a single file holding a collection ofother files in a structure that makes it possible to retrievethe original individual files (called members of the archive).

The original files' contents, mode (permissions), timestamp, owner, andgroup are preserved in the archive, and may be reconstituted onextraction.

GNU ar can maintain archives whose members have names of anylength; however, depending on how ar is configured on yoursystem, a limit on member-name length may be imposed (for compatibilitywith archive formats maintained with other tools). If it exists, thelimit is often 15 characters (typical of formats related to a.out) or 16characters (typical of formats related to coff).

ar is considered a binary utility because archives of this sortare most often used as libraries holding commonly neededsubroutines.

ar will create an index to the symbols defined in relocatableobject modules in the archive when you specify the modifier `s'.Once created, this index is updated in the archive whenever armakes a change to its contents (save for the `q' update operation).An archive with such an index speeds up linking to the library, andallows routines in the library to call each other without regard totheir placement in the archive.

You may use `nm -s' or `nm --print-armap' to list this indextable. If an archive lacks the table, another form of ar calledranlib can be used to add just the table.

ar insists on at least two arguments to execute: onekeyletter specifying the operation (optionally accompanied by otherkeyletters specifying modifiers), and the archive name to act on.

Most operations can also accept further files arguments,specifying particular files to operate on.

 

OPTIONS

GNU ar allows you to mix the operation code p and modifierflags mod in any order, within the first command-line argument.

If you wish, you may begin the first command-line argument with adash.

The p keyletter specifies what operation to execute; it may beany of the following, but you must specify only one of them:

d
Delete modules from the archive. Specify the names of modules tobe deleted as files; the archive is untouched if youspecify no files to delete.

If you specify the `v' modifier, ar will list each moduleas it is deleted.

m
Use this operation to move members in an archive.

The ordering of members in an archive can make a difference in howprograms are linked using the library, if a symbol is defined in morethan one member.

If no modifiers are used with m, any members you name in thefiles arguments are moved to the end of the archive;you can use the `a', `b', or `i' modifiers to move them to aspecified place instead.

p
Print the specified members of the archive, to the standardoutput file. If the `v' modifier is specified, show the membername before copying its contents to standard output.

If you specify no files, all the files in the archive are printed.

q
Quick append; add files to the end of archive,without checking for replacement.

The modifiers `a', `b', and `i' do not affect thisoperation; new members are always placed at the end of the archive.

The modifier `v' makes ar list each file as it is appended.

Since the point of this operation is speed, the archive's symbol tableindex is not updated, even if it already existed; you can use `ar s' orranlib explicitly to update the symbol table index.

However, too many different systems assume quick append rebuilds theindex, so GNUarimplements `q' as a synonym for `r'.

r
Insert files into archive (with replacement). Thisoperation differs from `q' in that any previously existing membersare deleted if their names match those being added.

If one of the files named in files doesn't exist, ardisplays an error message, and leaves undisturbed any existing membersof the archive matching that name.

By default, new members are added at the end of the file; but you mayuse one of the modifiers `a', `b', or `i' to requestplacement relative to some existing member.

The modifier `v' used with this operation elicits a line ofoutput for each file inserted, along with one of the letters `a' or`r' to indicate whether the file was appended (no old memberdeleted) or replaced.

t
Display a table listing the contents of archive, or thoseof the files listed in files that are present in thearchive. Normally only the member name is shown; if you also want tosee the modes (permissions), timestamp, owner, group, and size, you canrequest that by also specifying the `v' modifier.

If you do not specify any files, all files in the archiveare listed.

If there is more than one file with the same name (say, `fie') inan archive (say `b.a'), `ar t b.a fie' will list only thefirst instance; to see them all, you must ask for a completelisting---in our example, `ar t b.a'.

x
Extract members (named files) from the archive. You canuse the `v' modifier with this operation, to request thatar list each name as it extracts it.

If you do not specify any files, all files in the archiveare extracted.

A number of modifiers (mod) may immediately follow the pkeyletter, to specify variations on an operation's behavior:

a
Add new files after an existing member of thearchive. If you use the modifier a, the name of an existing archivemember must be present as the membername argument, before thearchive specification.

b
Add new files before an existing member of thearchive. If you use the modifier b, the name of an existing archivemember must be present as the membername argument, before thearchive specification. (same as `i').

c
Create the archive. The specified archive is alwayscreated if it didn't exist, when you request an update. But a warning isissued unless you specify in advance that you expect to create it, byusing this modifier.

f
Truncate names in the archive. arwill normally permit file names of any length. This will cause it tocreate archives which are not compatible with the native arprogram on some systems. If this is a concern, the fmodifier may be used to truncate file names when putting them in thearchive.

i
Insert new files before an existing member of thearchive. If you use the modifier i, the name of an existing archivemember must be present as the membername argument, before thearchive specification. (same as `b').

l
This modifier is accepted but not used.

N
Uses thecountparameter. This is used if there are multiple entries in the archivewith the same name. Extract or delete instancecountof the given name from the archive.

o
Preserve the original dates of members when extracting them. Ifyou do not specify this modifier, files extracted from the archivewill be stamped with the time of extraction.

P
Use the full path name when matching names in the archive.arcan not create an archive with a full path name (such archives are notPOSIX complaint), but other archive creators can. This option willcausearto match file names using a complete path name, which can beconvenient when extracting a single file from an archive created byanother tool.

s
Write an object-file index into the archive, or update an existing one,even if no other change is made to the archive. You may use this modifierflag either with any operation, or alone. Running `ar s' on anarchive is equivalent to running `ranlib' on it.

S
Do not generate an archive symbol table. This can speed up building alarge library in several steps. The resulting archive can not be usedwith the linker. In order to build a symbol table, you must omit the`S' modifier on the last execution of `ar', or you must run `ranlib' on the archive.

u
Normally, ar r... inserts all fileslisted into the archive. If you would like to insert only thoseof the files you list that are newer than existing members of the samenames, use this modifier. The `u' modifier is allowed only for theoperation `r' (replace). In particular, the combination `qu' isnot allowed, since checking the timestamps would lose any speedadvantage from the operation `q'.

v
This modifier requests the verbose version of an operation. Manyoperations display additional information, such as filenames processed,when the modifier `v' is appended.

V
This modifier shows the version number ofar.

 

SEE ALSO

`binutils'entry in info; The GNU Binary Utilities, Roland H. Pesch (October 1991).nm(1),ranlib(1).

 

COPYING

Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.

Permission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that theentire resulting derived work is distributed under the terms of apermission notice identical to this one.

Permission is granted to copy and distribute translations of thismanual into another language, under the above conditions for modifiedversions, except that this permission notice may be included intranslations approved by the Free Software Foundation instead of inthe original English.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SEE ALSO
COPYING

This document was created byman2html,using the manual pages.