arcreate and maintain library archives |
Command |
|
ar
-d
[
-v
]
archive member ...
ar
-m
[
-abIilsv
]
[
posname]
archive [
member ...]
ar
-p
[
-Ilsv
]
archive [
member ...]
ar
-q
[
-clsv
]
archive [
member ...]
ar
-r
[
-abcIilsuv
]
archive [
member ...]
ar
-t
[
-Ilsv
]
archive [
member ...]
ar
-u
[
-abcIilsv
]
[
posname]
archive [
member ...]
ar
-x
[
-CIlsTv
]
archive [
member ...]
ar
creates and maintains file archives. You can use
ar
to
- create a new archive
- add members to an existing archive
- delete members from an archive
- extract members from an archive
- print a table of contents for an archive
- rearrange the members of an existing archive
- display the contents of an archive member
ar
identifies each member in the archive by the final
component (basename) of its file name. When adding a file to an archive,
you can use the full path name, but when storing the member or comparing
a member name,
ar
uses only the final component of the name.
ar
accepts the following options that represent its
main functions:
-d
- deletes each named member from the archive and regenerates the
symbol table.
-m
- moves the named archive member in the archive. You indicate the new
position for the member with -a, -b, or -i and posname; if you do not
specify a location, ar moves the member to the end of the archive.
-p
- displays each specified member on the standard output. If you do not
specify any members, ar displays all members.
-q
- quickly appends the specified file to the archive. ar does not check to
see if file is already a member of the archive.
-r
- replaces or adds file to archive. If archive does not
exist,
ar
creates it and prints a message. When
ar
replaces an existing member, it does not change the
archive order. If file is not replacing a member,
ar
adds it to the end of the archive.
-t
- displays each specified member on the standard output. If you do
not specify any members,
ar
displays all members.
ar
displays a diagnostic for each member that it
cannot find. Normally, ar
displays only the member's
name, but with the verbose (-v
) option,
ar
displays more information about archive members
using a format similar to ls
-l.
-x
- extracts each specified member from the archive and copies it to a
file. If you specify member as a full path name,
ar
copies it to that path name. If you do not specify
a member, ar
extracts all members. The archive
remains unchanged.
The following options modify the behavior of the main functions:
-a
- places file in archive after the member specified by posname.
If you do not specify a member,
ar
adds file
to the end of the archive.
-b
- places file in archive before the member specified by posname.
If you do not specify posname,
ar
adds
file to the beginning of the archive.
-C
- prevents
ar
from overwriting existing files with
extracted files. You can only specify this option when extracting files
with the -x
option.
-c
- suppresses the message
ar
normally prints when it
creates a new archive file. You can only use this in conjunction
with the -r
and -q
options.
-I
- ignores the case of letters when searching the archive for specified
member names. Normally, the case is significant.
-i
- inserts the file into the archive before the member specified by
posname. If you do not specify posname,
ar
inserts file at the beginning of the archive. This option is the
same as -b
.
-l
- puts any temporary files that
ar
generates in the
current directory rather than the default temporary file directory.
-s
- regenerates the symbol table regardless of whether the command modifies
the archive.
-T
- when used with
-x
, allows extraction of members with
names longer than the file system supports; normally, this is an error,
and ar does not extract the file. Most file systems truncate the file name
to the appropriate length.
-u
- replaces the member only if the modification time of the file member
is more recent than the time of the archive member.
-u
implies -r
, so it is not necessary to specify
-r
also.
-v
- gives verbose output. With
-d
, -q
,
-r
, and -x
, this option displays
the command letter and the member name affected before performing each
operation. With -t
, it prints more information about
archive members using a format similar to ls
-l
. With -p
, it displays the member name
before the contents.
Possible exit status values are:
- 0
- Successful completion.
- 1
- Failure due to any of the following:
- — inability to create the extracted file
- — an error writing to the extracted file
- — the requested module not found on appending
- — an error opening the module on appending
- — an invalid module on appending
- — inability to access the module on appending
- — a module not found on table/extraction
- 2
- Invalid command line arguments or options
POSIX.2.
x/OPEN Portability Guide 4.0.
The following options are XPG extensions to the POSIX standard:
-a, -b, -C, -i, -l, -m, -q, -s, and -T.
The -I option is an extension to the POSIX and XPG standards.
- Commands:
cc,
ld,
make,
strip