xref: /original-bsd/usr.bin/ar/ar.1 (revision 4b05c5c5)
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)ar.1	6.2 (Berkeley) 06/11/90
7.\"
8.Dd
9.Dt AR 1
10.Os ATT 7th
11.Sh NAME
12.Nm ar
13.Nd archive and library maintainer
14.Sh SYNOPSIS
15.Nm ar
16.Cm key
17.Op Ar posname
18.Ar afile name ...
19.Sh DESCRIPTION
20.Nm Ar
21maintains groups of files
22combined into a single archive file.
23Its main use
24is to create and update library files as used by the loader.
25It can be used, though, for any similar purpose.
26.Sy N.B.:
27This version of
28.Nm ar
29uses a ASCII-format archive which is portable among the various
30machines running UNIX.
31Programs for dealing with older formats are available: see
32.Xr arcv 8 .
33.Pp
34.Cm Key
35is one character from the set
36.Fl drqtpmx
37optionally concatenated with
38one or more of
39.Fl vuaibclo .
40.Ar Afile
41is the archive file.
42The
43.Ar names
44are constituent files in the archive file.
45The meanings of the
46.Fl key
47characters are:
48.Tp Fl d
49Delete the named files from the archive file.
50.Tp Fl r
51Replace the named files in the archive file.
52If the optional character
53.Fl u
54is used with
55.Fl r
56then only those files with
57.Li last-modified
58dates later than
59the archive files are replaced.
60If an optional positioning character from the set
61.Fl abi
62is used, then the
63.Ar posname
64argument must be present
65and specifies that new files are to be placed
66after
67.Fl a
68or before
69.Fl b
70or
71.Fl i
72.Ar posname .
73Otherwise
74new files are placed at the end.
75.Tp Fl q
76Quickly append the named files to the end of the archive file.
77Optional positioning characters are invalid.
78The command does not check whether the added members
79are already in the archive.
80Useful only to avoid quadratic behavior when creating a large
81archive piece-by-piece.
82.Tp Fl t
83Print a table of contents of the archive file.
84If no names are given, all files in the archive are tabled.
85If names are given, only those files are tabled.
86.Tp Fl p
87Print the named files in the archive.
88.Tp Fl m
89Move the named files to the end of the archive.
90If a positioning character is present,
91then the
92.Ar posname
93argument must be present and,
94as in
95.Fl r
96specifies where the files are to be moved.
97.Tp Fl x
98Extract the named files.
99If no names are given, all files in the archive are
100extracted.
101In neither case does
102.Fl x
103alter the archive file. Normally the `last-modified' date of each
104extracted file is the date when it is extracted. However, if
105.Fl o
106is used, the `last-modified' date is reset to the date recorded in the
107archive.
108.Tp Fl v
109Verbose.
110Under the verbose option,
111.Nm ar
112gives a file-by-file
113description of the making of a
114new archive file from the old archive and the constituent files.
115When used with
116.Fl t
117it gives a long listing of all information about the files.
118When used with
119.Fl p ,
120it precedes each file with a name.
121.Tp Fl c
122Create.
123Normally
124.Nm ar
125will create
126.Ar afile
127when it needs to.
128The create option suppresses the
129normal message that is produced when
130.Ar afile
131is created.
132.Tp Fl l
133Local.
134Normally
135.Nm ar
136places its temporary files in the directory /tmp.
137This option causes them to be placed in the local directory.
138.Tp
139.Sh FILES
140.Tw /tmp/v*
141.Tp Pa tmp/v*
142temporaries
143.Tp
144.Sh SEE ALSO
145.Xr lorder 1 ,
146.Xr ld 1 ,
147.Xr ranlib 1 ,
148.Xr ar 5 ,
149.Xr arcv 8
150.Sh HISTORY
151.Nm Ar
152appeared in vanilla Version 6 AT&T UNIX.  The Version 7
153.Nm ar
154appeared
155in 2.0 BSD.
156.Sh BUGS
157If the same file is mentioned twice in an argument list,
158it may be put in the archive twice.
159.Pp
160The
161.Li last-modified
162date of a file will not be altered by the
163.Fl o
164option if the user is not the owner of the extracted file, or the super-user.
165