1994-05-27 12:33:43 +00:00
|
|
|
.\" Copyright (c) 1990, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" Hugh Smith at The University of Guelph.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)ar.1 8.1 (Berkeley) 6/29/93
|
1999-08-28 01:08:13 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-27 12:33:43 +00:00
|
|
|
.\"
|
1997-06-23 06:41:30 +00:00
|
|
|
.Dd June 29, 1993
|
|
|
|
.Dt AR 1
|
|
|
|
.Sh NAME
|
|
|
|
.Nm ar
|
|
|
|
.Nd create and maintain library archives
|
|
|
|
.Sh SYNOPSIS
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl d
|
|
|
|
.Op Fl \Tv
|
|
|
|
.Ar archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl m
|
|
|
|
.Op Fl \Tv
|
|
|
|
.Ar archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl m
|
|
|
|
.Op Fl abiTv
|
|
|
|
.Ar position archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl p
|
|
|
|
.Op Fl \Tv
|
|
|
|
.Ar archive [file ...]
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl q
|
|
|
|
.Op Fl cTv
|
|
|
|
.Ar archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl r
|
|
|
|
.Op Fl cuTv
|
|
|
|
.Ar archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl r
|
|
|
|
.Op Fl abciuTv
|
|
|
|
.Ar position archive file ...
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl t
|
|
|
|
.Op Fl \Tv
|
|
|
|
.Ar archive [file ...]
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
.Fl x
|
|
|
|
.Op Fl ouTv
|
|
|
|
.Ar archive [file ...]
|
|
|
|
.Sh DESCRIPTION
|
1994-05-27 12:33:43 +00:00
|
|
|
The
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
utility creates and maintains groups of files combined into an archive.
|
|
|
|
Once an archive has been created, new files can be added and existing
|
|
|
|
files can be extracted, deleted, or replaced.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
Files are named in the archive by a single component, i.e., if a file
|
|
|
|
referenced by a path containing a slash (``/'') is archived it will be
|
|
|
|
named by the last component of that path.
|
|
|
|
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.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
All informational and error messages use the path listed on the command
|
|
|
|
line, if any was specified; otherwise the name in the archive is used.
|
|
|
|
If multiple files in the archive have the same name, and paths are listed
|
|
|
|
on the command line to ``select'' archive files for an operation, only the
|
1997-06-23 06:41:30 +00:00
|
|
|
.Em first
|
1994-05-27 12:33:43 +00:00
|
|
|
file with a matching name will be selected.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
The normal use of
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
is for the creation and maintenance of libraries suitable for use with
|
|
|
|
the loader (see
|
1997-06-23 06:41:30 +00:00
|
|
|
.Xr ld 1 )
|
1994-05-27 12:33:43 +00:00
|
|
|
although it is not restricted to this purpose.
|
|
|
|
The options are as follows:
|
1997-06-23 06:41:30 +00:00
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl a
|
|
|
|
A positioning modifier used with the options
|
|
|
|
.Fl r
|
|
|
|
and
|
|
|
|
.Fl m .
|
1994-05-27 12:33:43 +00:00
|
|
|
The files are entered or moved
|
1997-06-23 06:41:30 +00:00
|
|
|
.Em after
|
1994-05-27 12:33:43 +00:00
|
|
|
the archive member
|
1997-06-23 06:41:30 +00:00
|
|
|
.Ar position ,
|
1994-05-27 12:33:43 +00:00
|
|
|
which must be specified.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl b
|
|
|
|
A positioning modifier used with the options
|
|
|
|
.Fl r
|
|
|
|
and
|
|
|
|
.Fl m .
|
1994-05-27 12:33:43 +00:00
|
|
|
The files are entered or moved
|
1997-06-23 06:41:30 +00:00
|
|
|
.Em before
|
1994-05-27 12:33:43 +00:00
|
|
|
the archive member
|
1997-06-23 06:41:30 +00:00
|
|
|
.Ar position ,
|
1994-05-27 12:33:43 +00:00
|
|
|
which must be specified.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl c
|
1994-05-27 12:33:43 +00:00
|
|
|
Whenever an archive is created, an informational message to that effect
|
|
|
|
is written to standard error.
|
1997-06-23 06:41:30 +00:00
|
|
|
If the
|
|
|
|
.Fl c
|
|
|
|
option is specified,
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
creates the archive silently.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl d
|
1994-05-27 12:33:43 +00:00
|
|
|
Delete the specified archive files.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl i
|
|
|
|
Identical to the
|
|
|
|
.Fl b
|
|
|
|
option.
|
|
|
|
.It Fl m
|
1994-05-27 12:33:43 +00:00
|
|
|
Move the specified archive files within the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
If one of the options
|
|
|
|
.Fl a ,
|
|
|
|
.Fl b
|
|
|
|
or
|
|
|
|
.Fl i
|
|
|
|
is specified, the files are moved
|
1994-05-27 12:33:43 +00:00
|
|
|
before or after the
|
1997-06-23 06:41:30 +00:00
|
|
|
.Ar position
|
1994-05-27 12:33:43 +00:00
|
|
|
file in the archive.
|
|
|
|
If none of those options are specified, the files are moved
|
|
|
|
to the end of the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl o
|
1994-05-27 12:33:43 +00:00
|
|
|
Set the access and modification times of extracted files to the
|
|
|
|
modification time of the file when it was entered into the archive.
|
|
|
|
This will fail if the user is not the owner of the extracted file
|
|
|
|
or the super-user.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl p
|
1994-05-27 12:33:43 +00:00
|
|
|
Write the contents of the specified archive files to the standard output.
|
|
|
|
If no files are specified, the contents of all the files in the archive
|
|
|
|
are written in the order they appear in the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl q
|
1994-05-27 12:33:43 +00:00
|
|
|
(Quickly) append the specified files to the archive.
|
|
|
|
If the archive does not exist a new archive file is created.
|
1997-06-23 06:41:30 +00:00
|
|
|
Much faster than the
|
|
|
|
.Fl r
|
|
|
|
option, when creating a large archive
|
1994-05-27 12:33:43 +00:00
|
|
|
piece-by-piece, as no checking is done to see if the files already
|
|
|
|
exist in the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl r
|
1994-05-27 12:33:43 +00:00
|
|
|
Replace or add the specified files to the archive.
|
|
|
|
If the archive does not exist a new archive file is created.
|
|
|
|
Files that replace existing files do not change the order of the files
|
|
|
|
within the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
New files are appended to the archive unless one of the options
|
|
|
|
.Fl a ,
|
|
|
|
.Fl b
|
|
|
|
or
|
|
|
|
.Fl i
|
|
|
|
is specified.
|
|
|
|
.It Fl T
|
1994-05-27 12:33:43 +00:00
|
|
|
Select and/or name archive members using only the first fifteen characters
|
|
|
|
of the archive member or command line file name.
|
|
|
|
The historic archive format had sixteen bytes for the name, but some
|
|
|
|
historic archiver and loader implementations were unable to handle names
|
|
|
|
that used the entire space.
|
|
|
|
This means that file names that are not unique in their first fifteen
|
|
|
|
characters can subsequently be confused.
|
|
|
|
A warning message is printed to the standard error output if any file
|
|
|
|
names are truncated.
|
|
|
|
(See
|
1997-06-23 06:41:30 +00:00
|
|
|
.Xr ar 5
|
1994-05-27 12:33:43 +00:00
|
|
|
for more information.)
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl t
|
1994-05-27 12:33:43 +00:00
|
|
|
List the specified files in the order in which they appear in the archive,
|
|
|
|
each on a separate line.
|
|
|
|
If no files are specified, all files in the archive are listed.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl u
|
1994-05-27 12:33:43 +00:00
|
|
|
Update files.
|
1997-06-23 06:41:30 +00:00
|
|
|
When used with the
|
|
|
|
.Fl r
|
|
|
|
option, files in the archive will be replaced
|
1994-05-27 12:33:43 +00:00
|
|
|
only if the disk file has a newer modification time than the file in
|
|
|
|
the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
When used with the
|
|
|
|
.Fl x
|
|
|
|
option, files in the archive will be extracted
|
1994-05-27 12:33:43 +00:00
|
|
|
only if the archive file has a newer modification time than the file
|
|
|
|
on disk.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl v
|
1994-05-27 12:33:43 +00:00
|
|
|
Provide verbose output.
|
1997-06-23 06:41:30 +00:00
|
|
|
When used with the
|
|
|
|
.Fl d ,
|
|
|
|
.Fl m ,
|
|
|
|
.Fl q
|
|
|
|
or
|
|
|
|
.Fl x
|
|
|
|
options,
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
gives a file-by-file description of the archive modification.
|
|
|
|
This description consists of three, white-space separated fields: the
|
|
|
|
option letter, a dash (``-'') and the file name.
|
1997-06-23 06:41:30 +00:00
|
|
|
When used with the
|
|
|
|
.Fl r
|
|
|
|
option,
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
displays the description as above, but the initial letter is an ``a'' if
|
|
|
|
the file is added to the archive and an ``r'' if the file replaces a file
|
|
|
|
already in the archive.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
|
|
|
When used with the
|
|
|
|
.Fl p
|
|
|
|
option,
|
1994-05-27 12:33:43 +00:00
|
|
|
the name of each printed file,
|
|
|
|
enclosed in less-than (``<'') and greater-than (``>'') characters,
|
|
|
|
is written to the standard output before
|
|
|
|
the contents of the file;
|
|
|
|
it is preceded by a single newline character, and
|
|
|
|
followed by two newline characters.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
|
|
|
When used with the
|
|
|
|
.Fl t
|
|
|
|
option,
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
displays an ``ls -l'' style listing of information about the members of
|
|
|
|
the archive.
|
|
|
|
This listing consists of eight, white-space separated fields:
|
|
|
|
the file permissions (see
|
1997-06-23 06:41:30 +00:00
|
|
|
.Xr strmode 3 ),
|
|
|
|
the decimal user and group ID's, separated by a single slash (``/''),
|
1994-05-27 12:33:43 +00:00
|
|
|
the file size (in bytes), the file modification time (in the
|
1997-06-23 06:41:30 +00:00
|
|
|
.Xr date 1
|
1994-05-27 12:33:43 +00:00
|
|
|
format ``%b %e %H:%M %Y''), and the name of the file.
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Fl x
|
1994-05-27 12:33:43 +00:00
|
|
|
Extract the specified archive members into the files named by the command
|
|
|
|
line arguments.
|
|
|
|
If no members are specified, all the members of the archive are extracted into
|
|
|
|
the current directory.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
If the file does not exist, it is created; if it does exist, the owner
|
|
|
|
and group will be unchanged.
|
|
|
|
The file access and modification times are the time of the extraction
|
1997-06-23 06:41:30 +00:00
|
|
|
(but see the
|
|
|
|
.Fl o
|
|
|
|
option).
|
1994-05-27 12:33:43 +00:00
|
|
|
The file permissions will be set to those of the file when it was entered
|
|
|
|
into the archive; this will fail if the user is not the owner of the
|
|
|
|
extracted file or the super-user.
|
1997-06-23 06:41:30 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
1994-05-27 12:33:43 +00:00
|
|
|
The
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
utility exits 0 on success, and >0 if an error occurs.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
.Bl -tag -width indent -compact
|
|
|
|
.It Ev TMPDIR
|
1994-05-27 12:33:43 +00:00
|
|
|
The pathname of the directory to use when creating temporary files.
|
1997-06-23 06:41:30 +00:00
|
|
|
.El
|
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width indent -compact
|
|
|
|
.It Pa /tmp
|
1994-05-27 12:33:43 +00:00
|
|
|
default temporary file directory
|
1997-06-23 06:41:30 +00:00
|
|
|
.It Pa ar.XXXXXX
|
1994-05-27 12:33:43 +00:00
|
|
|
temporary file names
|
1997-06-23 06:41:30 +00:00
|
|
|
.El
|
|
|
|
.Sh COMPATIBILITY
|
1994-05-27 12:33:43 +00:00
|
|
|
By default,
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
writes archives that may be incompatible with historic archives, as
|
|
|
|
the format used for storing archive members with names longer than
|
|
|
|
fifteen characters has changed.
|
|
|
|
This implementation of
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1994-05-27 12:33:43 +00:00
|
|
|
is backward compatible with previous versions of
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
in that it can read and write (using the
|
|
|
|
.Fl T
|
|
|
|
option) historic archives.
|
|
|
|
The
|
|
|
|
.Fl T
|
|
|
|
option is provided for compatibility only, and will be deleted
|
1994-05-27 12:33:43 +00:00
|
|
|
in a future release.
|
|
|
|
See
|
1997-06-23 06:41:30 +00:00
|
|
|
.Xr ar 5
|
1994-05-27 12:33:43 +00:00
|
|
|
for more information.
|
1997-06-23 06:41:30 +00:00
|
|
|
.Sh STANDARDS
|
1994-05-27 12:33:43 +00:00
|
|
|
The
|
2000-11-20 19:21:22 +00:00
|
|
|
.Nm
|
1997-06-23 06:41:30 +00:00
|
|
|
utility is expected to offer a superset of the
|
|
|
|
.St -p1003.2
|
|
|
|
functionality.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ld 1 ,
|
|
|
|
.Xr ranlib 1 ,
|
|
|
|
.Xr strmode 3 ,
|
|
|
|
.Xr ar 5
|