Main index | Section 1 | 日本語 | Deutsch | Options |
Files are named in the archive by their last file name component, so if a file referenced by a path containing a "/" is archived, it will be named by the last component of the path. Similarly when matching paths listed on the command line against file names stored in the archive, only the last component of the path will be compared.
The normal use of ar is for the creation and maintenance of libraries suitable for use with the link editor ld(1), although it is not restricted to this purpose. The ar utility can create and manage an archive symbol table (see ar(5)) used to speed up link editing operations. If a symbol table is present in an archive, it will be kept up-to-date by subsequent operations on the archive.
The ranlib utility is used to add an archive symbol table to an existing archive.
| |
When used with option
| |
| |
When used with option
| |
| |
Suppress the informational message printed when a new archive is
created using the
| |
| |
Prevent extracted files from replacing like-named files in the file system. | |
| |
Delete the members named by arguments file ... from the archive specified by argument archive. The archive's symbol table, if present, is updated to reflect the new contents of the archive. | |
| |
When used in combination with the
| |
| |
Use only the first fifteen characters of the archive member name or command line file name argument when naming archive members. | |
| |
Synonymous with option
| |
| |
This option is accepted but ignored. | |
| |
This option is accepted for compatibility with GNU ar(1), but is ignored. | |
| |
Move archive members specified by arguments
file ...
within the archive.
If a position has been specified by one of the
| |
| |
Read and execute MRI librarian commands from standard input. The commands understood by the ar utility are described in the section MRI Librarian Commands. | |
| |
Preserve the original modification times of members when extracting them. | |
| |
Write the contents of the specified archive members named by arguments file ... to standard output. If no members were specified, the contents of all the files in the archive are written in the order they appear in the archive. | |
| |
Append the files specified by arguments file ... to the archive specified by argument archive without checking if the files already exist in the archive. The archive symbol table will be updated as needed. If the file specified by the argument archive does not already exist, a new archive will be created. | |
| |
Replace (add) the files specified by arguments
file ...
in the archive specified by argument
archive,
creating the archive if necessary.
Replacing existing members will not change the order of members within
the archive.
If a file named in arguments
file ...
does not exist, existing members in the archive that match that
name are not changed.
New files are added to the end of the archive unless one of the
positioning options
| |
| |
Add an archive symbol table (see
ar(5))
to the archive specified by argument
archive.
Invoking
ar
with the
| |
| |
Do not generate an archive symbol table. | |
| |
List the files specified by arguments file ... in the order in which they appear in the archive, one per line. If no files are specified, all files in the archive are listed. | |
| |
Deprecated alias for
| |
| |
Conditionally update the archive or extract members.
When used with the
| |
| |
When used in combination with the
| |
| |
Provide verbose output.
When used with the
| |
| |
Print a version string and exit. | |
| |
Extract archive members specified by arguments
file ...
into the current directory.
If no members have been specified, extract all members of the archive.
If the file corresponding to an extracted member does not exist it
will be created.
If the file corresponding to an extracted member does exist, its owner
and group will not be changed while its contents will be overwritten
and its permissions will set to that entered in the archive.
The file's access and modification time would be that of the time
of extraction unless the
| |
| |
This option is accepted but ignored. | |
Each input line contains a single command. Words in an input line are separated by whitespace characters. The first word of the line is the command, the remaining words are the arguments to the command. The command word may be specified in either case. Arguments may be separated by commas or blanks.
Empty lines are allowed and are ignored. Long lines are continued by ending them with the "+" character.
The "*" and "amp;;" characters start a comment. Comments extend till the end of the line.
When executing an MRI librarian script the ar utility works on a temporary copy of an archive. Changes to the copy are made permanent using the save command.
Commands understood by the ar utility are:
addlib archive | addlib archive (member [, member ]...) | |
Add the contents of the archive named by argument archive to the current archive. If specific members are named using the arguments member, then those members are added to the current archive. If no members are specified, the entire contents of the archive are added to the current archive. | |
addmod member [, member ]... | |
Add the files named by arguments member to the current archive. | |
clear | Discard all the contents of the current archive. |
create archive | |
Create a new archive named by the argument archive, and makes it the current archive. If the named archive already exists, it will be overwritten when the save command is issued. | |
delete module [, member ]... | |
Delete the modules named by the arguments member from the current archive. | |
directory archive (member [, member ]... )[outputfile] | |
List each named module in the archive. The format of the output depends on the verbosity setting set using the verbose command. Output is sent to standard output, or to the file specified by argument outputfile. | |
end | Exit successfully from the ar utility. Any unsaved changes to the current archive will be discarded. |
extract member [, member ]... | |
Extract the members named by the arguments member from the current archive. | |
list | Display the contents of the current archive in verbose style. |
open archive | |
Open the archive named by argument archive and make it the current archive. | |
replace member [, member ]... | |
Replace named members in the current archive with the files specified by arguments member. The files must be present in the current directory and the named modules must already exist in the current archive. | |
save | Commit all changes to the current archive. |
verbose | |
Toggle the verbosity of the directory command. | |
ar -rc ex.a ex1.o ex2.o ex3.o
To add an archive symbol table to an existing archive ex.a, use:
ar -s ex.a
To delete file ex1.o from archive ex.a, use:
To verbosely list the contents of archive ex.a, use:
To create a new archive ex.a containing the files ex1.o, and ex2.o, using MRI librarian commands, use the following script:
create ex.a * specify the output archive addmod ex1.o ex2.o * add modules save * save pending changes end * exit the utility
AR (1) | December 29, 2021 |
Main index | Section 1 | 日本語 | Deutsch | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Ken Thompson was once asked by a reporter what he would have changed about Unix if he had it all to do over again. His answer: “I would spell creat with an ‘e.'” | ” |