Commit | Line | Data |
---|---|---|
fe84ea5d | 1 | .\" Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation |
252b5132 | 2 | .\" See section COPYING for conditions for redistribution |
fe84ea5d | 3 | .TH ar 1 "1999" "Cygnus Solutions" "GNU Development Tools" |
252b5132 RH |
4 | .de BP |
5 | .sp | |
6 | .ti \-.2i | |
7 | \(** | |
8 | .. | |
9 | ||
10 | .SH NAME | |
11 | ar \- create, modify, and extract from archives. | |
12 | ||
13 | .SH SYNOPSIS | |
14 | .hy 0 | |
15 | .na | |
16 | .BR ar " [\|" "-" "\|]"\c | |
3de39064 | 17 | .I {dmpqrtx}[abcfilNoPsSuvV] \c |
252b5132 RH |
18 | [\|\c |
19 | .I membername\c | |
20 | \&\|] \c | |
3de39064 ILT |
21 | [\|\c |
22 | .I count\c | |
23 | \&\|] \c | |
252b5132 RH |
24 | .I archive\c |
25 | \& \c | |
26 | .I files\c | |
27 | \&.\|.\|. | |
28 | ||
29 | .ad b | |
30 | .hy 1 | |
31 | .SH DESCRIPTION | |
32 | The GNU \c | |
33 | .B ar\c | |
34 | \& program creates, modifies, and extracts from | |
35 | archives. An \c | |
36 | .I archive\c | |
37 | \& is a single file holding a collection of | |
38 | other files in a structure that makes it possible to retrieve | |
39 | the original individual files (called \c | |
40 | .I members\c | |
41 | \& of the archive). | |
42 | ||
43 | The original files' contents, mode (permissions), timestamp, owner, and | |
44 | group are preserved in the archive, and may be reconstituted on | |
45 | extraction. | |
46 | ||
47 | GNU \c | |
48 | .B ar\c | |
49 | \& can maintain archives whose members have names of any | |
50 | length; however, depending on how \c | |
51 | .B ar\c | |
52 | \& is configured on your | |
53 | system, a limit on member-name length may be imposed (for compatibility | |
54 | with archive formats maintained with other tools). If it exists, the | |
55 | limit is often 15 characters (typical of formats related to a.out) or 16 | |
56 | characters (typical of formats related to coff). | |
57 | ||
58 | \c | |
59 | .B ar\c | |
60 | \& is considered a binary utility because archives of this sort | |
61 | are most often used as \c | |
62 | .I libraries\c | |
63 | \& holding commonly needed | |
64 | subroutines. | |
65 | ||
66 | \c | |
67 | .B ar\c | |
68 | \& will create an index to the symbols defined in relocatable | |
69 | object modules in the archive when you specify the modifier `\|\c | |
70 | .B s\c | |
71 | \|'. | |
72 | Once created, this index is updated in the archive whenever \c | |
73 | .B ar\c | |
74 | \& | |
75 | makes a change to its contents (save for the `\|\c | |
76 | .B q\c | |
77 | \|' update operation). | |
78 | An archive with such an index speeds up linking to the library, and | |
79 | allows routines in the library to call each other without regard to | |
80 | their placement in the archive. | |
81 | ||
82 | You may use `\|\c | |
83 | .B nm \-s\c | |
84 | \|' or `\|\c | |
85 | .B nm \-\-print\-armap\c | |
86 | \|' to list this index | |
87 | table. If an archive lacks the table, another form of \c | |
88 | .B ar\c | |
89 | \& called | |
90 | \c | |
91 | .B ranlib\c | |
92 | \& can be used to add just the table. | |
93 | ||
94 | \c | |
95 | .B ar\c | |
96 | \& insists on at least two arguments to execute: one | |
97 | keyletter specifying the \c | |
98 | .I operation\c | |
99 | \& (optionally accompanied by other | |
100 | keyletters specifying \c | |
101 | .I modifiers\c | |
102 | \&), and the archive name to act on. | |
103 | ||
104 | Most operations can also accept further \c | |
105 | .I files\c | |
106 | \& arguments, | |
107 | specifying particular files to operate on. | |
108 | ||
109 | .SH OPTIONS | |
110 | GNU \c | |
111 | .B ar\c | |
112 | \& allows you to mix the operation code \c | |
113 | .I p\c | |
114 | \& and modifier | |
115 | flags \c | |
116 | .I mod\c | |
117 | \& in any order, within the first command-line argument. | |
118 | ||
119 | If you wish, you may begin the first command-line argument with a | |
120 | dash. | |
121 | ||
122 | The \c | |
123 | .I p\c | |
124 | \& keyletter specifies what operation to execute; it may be | |
125 | any of the following, but you must specify only one of them: | |
126 | ||
127 | .TP | |
128 | .B d | |
129 | \c | |
130 | .I Delete\c | |
131 | \& modules from the archive. Specify the names of modules to | |
132 | be deleted as \c | |
133 | .I files\c | |
134 | \&; the archive is untouched if you | |
135 | specify no files to delete. | |
136 | ||
137 | If you specify the `\|\c | |
138 | .B v\c | |
139 | \|' modifier, \c | |
140 | .B ar\c | |
141 | \& will list each module | |
142 | as it is deleted. | |
143 | ||
144 | .TP | |
145 | .B m | |
146 | Use this operation to \c | |
147 | .I move\c | |
148 | \& members in an archive. | |
149 | ||
150 | The ordering of members in an archive can make a difference in how | |
151 | programs are linked using the library, if a symbol is defined in more | |
152 | than one member. | |
153 | ||
154 | If no modifiers are used with \c | |
155 | .B m\c | |
156 | \&, any members you name in the | |
157 | \c | |
158 | .I files\c | |
159 | \& arguments are moved to the \c | |
160 | .I end\c | |
161 | \& of the archive; | |
162 | you can use the `\|\c | |
163 | .B a\c | |
164 | \|', `\|\c | |
165 | .B b\c | |
166 | \|', or `\|\c | |
167 | .B i\c | |
168 | \|' modifiers to move them to a | |
169 | specified place instead. | |
170 | ||
171 | .TP | |
172 | .B p | |
173 | \c | |
174 | .I Print\c | |
175 | \& the specified members of the archive, to the standard | |
176 | output file. If the `\|\c | |
177 | .B v\c | |
178 | \|' modifier is specified, show the member | |
179 | name before copying its contents to standard output. | |
180 | ||
181 | If you specify no \c | |
182 | .I files\c | |
183 | \&, all the files in the archive are printed. | |
184 | ||
185 | .TP | |
186 | .B q | |
187 | \c | |
188 | .I Quick append\c | |
189 | \&; add \c | |
190 | .I files\c | |
191 | \& to the end of \c | |
192 | .I archive\c | |
193 | \&, | |
194 | without checking for replacement. | |
195 | ||
196 | The modifiers `\|\c | |
197 | .B a\c | |
198 | \|', `\|\c | |
199 | .B b\c | |
200 | \|', and `\|\c | |
201 | .B i\c | |
202 | \|' do \c | |
203 | .I not\c | |
204 | \& affect this | |
205 | operation; new members are always placed at the end of the archive. | |
206 | ||
207 | The modifier `\|\c | |
208 | .B v\c | |
209 | \|' makes \c | |
210 | .B ar\c | |
211 | \& list each file as it is appended. | |
212 | ||
213 | Since the point of this operation is speed, the archive's symbol table | |
214 | index is not updated, even if it already existed; you can use `\|\c | |
215 | .B ar s\c | |
216 | \|' or | |
217 | \c | |
218 | .B ranlib\c | |
219 | \& explicitly to update the symbol table index. | |
220 | ||
221 | However, too many different systems assume quick append rebuilds the | |
222 | index, so GNU | |
223 | .B ar | |
224 | implements `\|\c | |
225 | .B q\c | |
226 | \|' as a synonym for `\|\c | |
227 | .B r\c | |
228 | \|'. | |
229 | ||
230 | .TP | |
231 | .B r | |
232 | Insert \c | |
233 | .I files\c | |
234 | \& into \c | |
235 | .I archive\c | |
236 | \& (with \c | |
237 | .I replacement\c | |
238 | \&). This | |
239 | operation differs from `\|\c | |
240 | .B q\c | |
241 | \|' in that any previously existing members | |
242 | are deleted if their names match those being added. | |
243 | ||
244 | If one of the files named in \c | |
245 | .I files\c | |
246 | \& doesn't exist, \c | |
247 | .B ar\c | |
248 | \& | |
249 | displays an error message, and leaves undisturbed any existing members | |
250 | of the archive matching that name. | |
251 | ||
252 | By default, new members are added at the end of the file; but you may | |
253 | use one of the modifiers `\|\c | |
254 | .B a\c | |
255 | \|', `\|\c | |
256 | .B b\c | |
257 | \|', or `\|\c | |
258 | .B i\c | |
259 | \|' to request | |
260 | placement relative to some existing member. | |
261 | ||
262 | The modifier `\|\c | |
263 | .B v\c | |
264 | \|' used with this operation elicits a line of | |
265 | output for each file inserted, along with one of the letters `\|\c | |
266 | .B a\c | |
267 | \|' or | |
268 | `\|\c | |
269 | .B r\c | |
270 | \|' to indicate whether the file was appended (no old member | |
271 | deleted) or replaced. | |
272 | ||
273 | .TP | |
274 | .B t | |
275 | Display a \c | |
276 | .I table\c | |
277 | \& listing the contents of \c | |
278 | .I archive\c | |
279 | \&, or those | |
280 | of the files listed in \c | |
281 | .I files\c | |
282 | \& that are present in the | |
283 | archive. Normally only the member name is shown; if you also want to | |
284 | see the modes (permissions), timestamp, owner, group, and size, you can | |
285 | request that by also specifying the `\|\c | |
286 | .B v\c | |
287 | \|' modifier. | |
288 | ||
289 | If you do not specify any \c | |
290 | .I files\c | |
291 | \&, all files in the archive | |
292 | are listed. | |
293 | ||
294 | If there is more than one file with the same name (say, `\|\c | |
295 | .B fie\c | |
296 | \|') in | |
297 | an archive (say `\|\c | |
298 | .B b.a\c | |
299 | \|'), `\|\c | |
300 | .B ar t b.a fie\c | |
301 | \|' will list only the | |
302 | first instance; to see them all, you must ask for a complete | |
303 | listing\(em\&in our example, `\|\c | |
304 | .B ar t b.a\c | |
305 | \|'. | |
306 | ||
307 | .TP | |
308 | .B x | |
309 | \c | |
310 | .I Extract\c | |
311 | \& members (named \c | |
312 | .I files\c | |
313 | \&) from the archive. You can | |
314 | use the `\|\c | |
315 | .B v\c | |
316 | \|' modifier with this operation, to request that | |
317 | \c | |
318 | .B ar\c | |
319 | \& list each name as it extracts it. | |
320 | ||
321 | If you do not specify any \c | |
322 | .I files\c | |
323 | \&, all files in the archive | |
324 | are extracted. | |
325 | ||
326 | .PP | |
327 | ||
328 | A number of modifiers (\c | |
329 | .I mod\c | |
330 | \&) may immediately follow the \c | |
331 | .I p\c | |
332 | \& | |
333 | keyletter, to specify variations on an operation's behavior: | |
334 | ||
335 | .TP | |
336 | .B a | |
337 | Add new files \c | |
338 | .I after\c | |
339 | \& an existing member of the | |
340 | archive. If you use the modifier \c | |
341 | .B a\c | |
342 | \&, the name of an existing archive | |
343 | member must be present as the \c | |
344 | .I membername\c | |
345 | \& argument, before the | |
346 | \c | |
347 | .I archive\c | |
348 | \& specification. | |
349 | ||
350 | .TP | |
351 | .B b | |
352 | Add new files \c | |
353 | .I before\c | |
354 | \& an existing member of the | |
355 | archive. If you use the modifier \c | |
356 | .B b\c | |
357 | \&, the name of an existing archive | |
358 | member must be present as the \c | |
359 | .I membername\c | |
360 | \& argument, before the | |
361 | \c | |
362 | .I archive\c | |
363 | \& specification. (same as `\|\c | |
364 | .B i\c | |
365 | \|'). | |
366 | ||
367 | .TP | |
368 | .B c | |
369 | \c | |
370 | .I Create\c | |
371 | \& the archive. The specified \c | |
372 | .I archive\c | |
373 | \& is always | |
374 | created if it didn't exist, when you request an update. But a warning is | |
375 | issued unless you specify in advance that you expect to create it, by | |
376 | using this modifier. | |
377 | ||
378 | .TP | |
379 | .B f | |
380 | Truncate names in the archive. | |
381 | .B ar | |
382 | will normally permit file names of any length. This will cause it to | |
383 | create archives which are not compatible with the native | |
384 | .B ar | |
385 | program on some systems. If this is a concern, the | |
386 | .B f | |
387 | modifier may be used to truncate file names when putting them in the | |
388 | archive. | |
389 | ||
390 | .TP | |
391 | .B i | |
392 | Insert new files \c | |
393 | .I before\c | |
394 | \& an existing member of the | |
395 | archive. If you use the modifier \c | |
396 | .B i\c | |
397 | \&, the name of an existing archive | |
398 | member must be present as the \c | |
399 | .I membername\c | |
400 | \& argument, before the | |
401 | \c | |
402 | .I archive\c | |
403 | \& specification. (same as `\|\c | |
404 | .B b\c | |
405 | \|'). | |
406 | ||
407 | .TP | |
408 | .B l | |
409 | This modifier is accepted but not used. | |
410 | ||
3de39064 ILT |
411 | .TP |
412 | .B N | |
413 | Uses the | |
414 | .I count | |
415 | parameter. This is used if there are multiple entries in the archive | |
416 | with the same name. Extract or delete instance | |
417 | .I count | |
418 | of the given name from the archive. | |
419 | ||
252b5132 RH |
420 | .TP |
421 | .B o | |
422 | Preserve the \c | |
423 | .I original\c | |
424 | \& dates of members when extracting them. If | |
425 | you do not specify this modifier, files extracted from the archive | |
426 | will be stamped with the time of extraction. | |
427 | ||
3de39064 ILT |
428 | .TP |
429 | .B P | |
430 | Use the full path name when matching names in the archive. | |
431 | .B ar | |
432 | can not create an archive with a full path name (such archives are not | |
433 | POSIX complaint), but other archive creators can. This option will | |
434 | cause | |
435 | .B ar | |
436 | to match file names using a complete path name, which can be | |
437 | convenient when extracting a single file from an archive created by | |
438 | another tool. | |
439 | ||
252b5132 RH |
440 | .TP |
441 | .B s | |
442 | Write an object-file index into the archive, or update an existing one, | |
443 | even if no other change is made to the archive. You may use this modifier | |
444 | flag either with any operation, or alone. Running `\|\c | |
445 | .B ar s\c | |
446 | \|' on an | |
447 | archive is equivalent to running `\|\c | |
448 | .B ranlib\c | |
449 | \|' on it. | |
450 | ||
451 | .TP | |
452 | .B S | |
453 | Do not generate an archive symbol table. This can speed up building a | |
454 | large library in several steps. The resulting archive can not be used | |
455 | with the linker. In order to build a symbol table, you must omit the | |
456 | `\|\c | |
457 | .B S\c | |
458 | \|' modifier on the last execution of `\|\c | |
459 | .B ar\c | |
460 | \|', or you must run `\|\c | |
461 | .B ranlib\c | |
462 | \|' on the archive. | |
463 | ||
464 | .TP | |
465 | .B u | |
466 | Normally, \c | |
467 | .B ar r\c | |
468 | \&.\|.\|. inserts all files | |
469 | listed into the archive. If you would like to insert \c | |
470 | .I only\c | |
471 | \& those | |
472 | of the files you list that are newer than existing members of the same | |
473 | names, use this modifier. The `\|\c | |
474 | .B u\c | |
475 | \|' modifier is allowed only for the | |
476 | operation `\|\c | |
477 | .B r\c | |
478 | \|' (replace). In particular, the combination `\|\c | |
479 | .B qu\c | |
480 | \|' is | |
481 | not allowed, since checking the timestamps would lose any speed | |
482 | advantage from the operation `\|\c | |
483 | .B q\c | |
484 | \|'. | |
485 | ||
486 | .TP | |
487 | .B v | |
488 | This modifier requests the \c | |
489 | .I verbose\c | |
490 | \& version of an operation. Many | |
491 | operations display additional information, such as filenames processed, | |
492 | when the modifier `\|\c | |
493 | .B v\c | |
494 | \|' is appended. | |
495 | ||
496 | .TP | |
497 | .B V | |
498 | This modifier shows the version number of | |
499 | .BR ar . | |
500 | ||
501 | .PP | |
502 | ||
503 | .SH "SEE ALSO" | |
504 | .RB "`\|" binutils "\|'" | |
505 | entry in | |
506 | .B | |
507 | info\c | |
508 | \&; | |
509 | .I | |
510 | The GNU Binary Utilities\c | |
511 | , Roland H. Pesch (October 1991). | |
512 | .BR nm ( 1 )\c | |
513 | \&, | |
514 | .BR ranlib ( 1 )\c | |
515 | \&. | |
516 | ||
517 | .SH COPYING | |
fe84ea5d | 518 | Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation, Inc. |
252b5132 RH |
519 | .PP |
520 | Permission is granted to make and distribute verbatim copies of | |
521 | this manual provided the copyright notice and this permission notice | |
522 | are preserved on all copies. | |
523 | .PP | |
524 | Permission is granted to copy and distribute modified versions of this | |
525 | manual under the conditions for verbatim copying, provided that the | |
526 | entire resulting derived work is distributed under the terms of a | |
527 | permission notice identical to this one. | |
528 | .PP | |
529 | Permission is granted to copy and distribute translations of this | |
530 | manual into another language, under the above conditions for modified | |
531 | versions, except that this permission notice may be included in | |
532 | translations approved by the Free Software Foundation instead of in | |
533 | the original English. |