]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/ar
audio(1): it is 2021 now
[plan9front.git] / sys / man / 1 / ar
1 .TH AR 1
2 .SH NAME
3 ar \- archive and library maintainer
4 .SH SYNOPSIS
5 .B ar
6 .I key
7 [
8 .I posname
9 ]
10 .I afile
11 [
12 .I file ...
13 ]
14 .SH DESCRIPTION
15 .I Ar
16 maintains groups of files
17 combined into a single archive file,
18 .IR afile .
19 The main use of
20 .I ar
21 is to create and update library files for the loaders
22 .IR 2l (1),
23 etc.
24 It can be used, though, for any similar purpose.
25 .PP
26 .I Key
27 is one character from the set
28 .BR drqtpmx ,
29 optionally concatenated with
30 one or more of
31 .BR vuaibclo .
32 The
33 .I files
34 are constituents of the archive
35 .IR afile .
36 The meanings of the
37 .I key
38 characters are:
39 .TP
40 .B d
41 Delete 
42 .I files 
43 from the archive file.
44 .TP
45 .B r
46 Replace
47 .I files 
48 in the archive file, or add them if missing.
49 Optional modifiers are
50 .RS
51 .PD0
52 .TP
53 .B u
54 Replace only files with
55 modified dates later than that of
56 the archive.
57 .TP
58 .B a
59 Place new files after
60 .I posname
61 in the archive rather than at the end.
62 .TP
63 .BR b " or " i
64 Place new files before
65 .I posname
66 in the archive.
67 .RE
68 .PD
69 .TP
70 .B q
71 Quick.  Append
72 .I files 
73 to the end of the archive without checking for duplicates.
74 Avoids quadratic behavior in
75 .LR "for (i in *.v) ar r lib.a $i" .
76 .TP
77 .B t
78 List a table of contents of the archive.
79 If names are given, only those files are listed.
80 .TP
81 .B p
82 Print the named files in the archive.
83 .TP
84 .B m
85 Move the named files to the end or elsewhere,
86 specified as with 
87 .LR r .
88 .TP
89 .B o
90 Preserve the access and modification times of files
91 extracted with the
92 .B x
93 command.
94 .TP
95 .B x
96 Extract the named files.
97 If no names are given, all files in the archive are
98 extracted.
99 In neither case does
100 .B x
101 alter the archive file.
102 .TP
103 .B v
104 Verbose.
105 Give a file-by-file
106 description of the making of a
107 new archive file from the old archive and the constituent files.
108 With
109 .BR p ,
110 precede each file with a name.
111 With
112 .BR t ,
113 give a long listing of all information about the files,
114 somewhat like a listing by
115 .IR ls (1),
116 showing
117 .br
118 .ns
119 .IP
120 .B
121         mode uid/gid size date name
122 .\" .TP
123 .\" .B c
124 .\" Create.
125 .\" Normally
126 .\" .I ar
127 .\" will create a new archive when
128 .\" .I afile
129 .\" does not exist, and give a warning.
130 .\" Option 
131 .\" .B c
132 .\" discards any old contents and suppresses the warning.
133 .TP
134 .B l
135 Local.
136 Normally
137 .I ar
138 places its temporary files in the directory
139 .BR /tmp .
140 This option causes them to be placed in the local directory.
141 .PP
142 When a
143 .BR d ,
144 .BR r ,
145 or
146 .BR m
147 .I key
148 is specified and all members of the archive are valid object files for
149 the same architecture,
150 .I ar
151 inserts a table of contents, required by the loaders, at
152 the front of the library.
153 The table of contents is
154 rebuilt whenever the archive is modified, except
155 when the
156 .B q
157 .I key
158 is specified or when the table of contents is
159 explicitly moved or deleted.
160 .SH EXAMPLE
161 .TP
162 .L
163 ar cr lib.a *.v
164 Replace the contents of library
165 .L lib.a
166 with the object files in the current directory.
167 .SH FILES
168 .TF /tmp/vxxxx
169 .TP
170 .B /tmp/v*
171 temporaries
172 .SH SOURCE
173 .B /sys/src/cmd/ar.c
174 .SH "SEE ALSO"
175 .IR 2l (1), 
176 .IR ar (6)
177 .SH BUGS
178 If the same file is mentioned twice in an argument list,
179 it may be put in the archive twice.
180 .br
181 This command predates Plan 9 and makes some invalid assumptions,
182 for instance that user id's are numeric.