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