DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ar(CP)


ar -- maintain portable archive or library

Synopsis

   ar [-V] -key [arg] [posname] afile [name . . . ]

Description

The ar command maintains groups of files combined into a single archive file. Its main use is to create and update library files. However, it can be used for any similar purpose. If an archive is composed of printable files, the entire archive is printable.

When ar creates an archive, it creates headers in a format that is portable across all machines. The archive symbol table (described in ar(F)) is used by the link editor ld 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 that is always the first file in the archive. This file is never mentioned or accessible to the user. Whenever the ar command is used to create or update the contents of such an archive, the symbol table is rebuilt. The s argument to key, described below, will force the symbol table to be rebuilt.


-V
Cause ar to print its version number on standard error.

-key [arg]
key is formed with one of the following characters: drqtpmx. arg is formed with one of more of the following letters: vucs. An additional single-character argument to key, called the positioning character (chosen from one of the following letters: abi), can be used with key characters r and m. key characters are described below.

posname
Archive member name used as a reference point in positioning other files in the archive.

afile
Archive file.

name
One or more constituent files in the archive file.

The meanings of the key characters are as follows:


-d
Delete the named files from the archive file.

-m
Move the named files to the end of the archive. If an optional positioning character from the set abi is used, the posname argument must be present and specifies that new files are to be placed after a or before b or i posname. Otherwise new files are placed at the end.

-p
Print the named files in the archive.

-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 option is useful to avoid creating a large archive piece-by-piece.

-r
Replace the named files in the archive file. If the optional argument u is used with r, replace only those files with dates of modification later than the named files already in the archive. If an optional positioning character from the set abi is used, the posname argument must be present and specifies that new files are to be placed after a or before b or i posname. Otherwise new files are placed at the end.

-t
Print a table of contents of the archive file. If no names are given, all files in the archive are listed. If names are given, only those files are listed.

-u
Update older files. When used with the -r option, files within the archive are replaced only if the corresponding file has a modification time that is at least as new as the modification time of the file within the archive.

-x
Extract the named files. If no names are given, all files in the archive are extracted. In neither case does x alter the archive file.

The meanings of the other key arguments are as follows:


v
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 the -t option, give a long listing of all information about the files. When used with x, d, or r, print the name of the file preceding each extraction. When used with p, write the file to standard output.

c
Suppress the message that is produced by default when afile is created.

s
Force the regeneration of the archive symbol table even if ar 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(C) command has been used on the archive.

Files


/usr/lib/locale/locale/LC_MESSAGES/uxar
language-specific message file (See LANG on environ(M).)

References

a.out(F), ar(F), ld(C), lorder(C), strip(C)

Notices

If the same file is mentioned twice in an argument list, it may be put in the archive twice.

Since the archiver no longer uses temporary files, the -l option is obsolete and will be removed in the next release.

By convention, archives are suffixed with the characters .a.

Applications currently using options without the leading hyphen must be changed to use the hyphen since non-hyphenated options may not be supported in a future release.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005