xref: /freebsd/usr.bin/ar/ar.1 (revision fa9896e0)
1d192f3d3SKai Wang.\" Copyright (c) 2007 Joseph Koshy.  All rights reserved.
2d192f3d3SKai Wang.\"
3d192f3d3SKai Wang.\" Redistribution and use in source and binary forms, with or without
4d192f3d3SKai Wang.\" modification, are permitted provided that the following conditions
5d192f3d3SKai Wang.\" are met:
6d192f3d3SKai Wang.\" 1. Redistributions of source code must retain the above copyright
7d192f3d3SKai Wang.\"    notice, this list of conditions and the following disclaimer.
8d192f3d3SKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright
9d192f3d3SKai Wang.\"    notice, this list of conditions and the following disclaimer in the
10d192f3d3SKai Wang.\"    documentation and/or other materials provided with the distribution.
11d192f3d3SKai Wang.\"
12d192f3d3SKai Wang.\" This software is provided by Joseph Koshy ``as is'' and
13d192f3d3SKai Wang.\" any express or implied warranties, including, but not limited to, the
14d192f3d3SKai Wang.\" implied warranties of merchantability and fitness for a particular purpose
15d192f3d3SKai Wang.\" are disclaimed.  in no event shall Joseph Koshy be liable
16d192f3d3SKai Wang.\" for any direct, indirect, incidental, special, exemplary, or consequential
17d192f3d3SKai Wang.\" damages (including, but not limited to, procurement of substitute goods
18d192f3d3SKai Wang.\" or services; loss of use, data, or profits; or business interruption)
19d192f3d3SKai Wang.\" however caused and on any theory of liability, whether in contract, strict
20d192f3d3SKai Wang.\" liability, or tort (including negligence or otherwise) arising in any way
21d192f3d3SKai Wang.\" out of the use of this software, even if advised of the possibility of
22d192f3d3SKai Wang.\" such damage.
23d192f3d3SKai Wang.\"
241a0a41b1SEd Maste.Dd January 3, 2022
25ce04f76cSRuslan Ermilov.Dt AR 1
26aa12cea2SUlrich Spörlein.Os
27d192f3d3SKai Wang.Sh NAME
28d192f3d3SKai Wang.Nm ar ,
29d192f3d3SKai Wang.Nm ranlib
30d192f3d3SKai Wang.Nd manage archives
31d192f3d3SKai Wang.Sh SYNOPSIS
32d192f3d3SKai Wang.Nm
33d192f3d3SKai Wang.Fl d
34d192f3d3SKai Wang.Op Fl T
353a870f82SKai Wang.Op Fl f
36d192f3d3SKai Wang.Op Fl j
37d192f3d3SKai Wang.Op Fl v
38d192f3d3SKai Wang.Op Fl z
39d192f3d3SKai Wang.Ar archive
403a870f82SKai Wang.Ar
41d192f3d3SKai Wang.Nm
42d192f3d3SKai Wang.Fl m
43d192f3d3SKai Wang.Op Fl T
44d192f3d3SKai Wang.Op Fl a Ar position-after
45d192f3d3SKai Wang.Op Fl b Ar position-before
463a870f82SKai Wang.Op Fl f
47d192f3d3SKai Wang.Op Fl i Ar position-before
48d192f3d3SKai Wang.Op Fl j
493a870f82SKai Wang.Op Fl s | Fl S
50d192f3d3SKai Wang.Op Fl z
51d192f3d3SKai Wang.Ar archive
523a870f82SKai Wang.Ar
53d192f3d3SKai Wang.Nm
54d192f3d3SKai Wang.Fl p
55d192f3d3SKai Wang.Op Fl T
563a870f82SKai Wang.Op Fl f
57d192f3d3SKai Wang.Op Fl v
58d192f3d3SKai Wang.Ar archive
593a870f82SKai Wang.Op Ar
603a870f82SKai Wang.Nm
613a870f82SKai Wang.Fl q
623a870f82SKai Wang.Op Fl T
633a870f82SKai Wang.Op Fl c
643a870f82SKai Wang.Op Fl D
653a870f82SKai Wang.Op Fl f
663a870f82SKai Wang.Op Fl s | Fl S
677072861cSEd Maste.Op Fl U
683a870f82SKai Wang.Op Fl v
693a870f82SKai Wang.Op Fl z
703a870f82SKai Wang.Ar archive
713a870f82SKai Wang.Ar
72d192f3d3SKai Wang.Nm
73d192f3d3SKai Wang.Fl r
74d192f3d3SKai Wang.Op Fl T
75d192f3d3SKai Wang.Op Fl a Ar position-after
76d192f3d3SKai Wang.Op Fl b Ar position-before
77d192f3d3SKai Wang.Op Fl c
780e479ac8STim Kientzle.Op Fl D
793a870f82SKai Wang.Op Fl f
80d192f3d3SKai Wang.Op Fl i Ar position-before
81d192f3d3SKai Wang.Op Fl j
823a870f82SKai Wang.Op Fl s | Fl S
83d192f3d3SKai Wang.Op Fl u
847072861cSEd Maste.Op Fl U
85d192f3d3SKai Wang.Op Fl v
86d192f3d3SKai Wang.Op Fl z
87d192f3d3SKai Wang.Ar archive
883a870f82SKai Wang.Ar
89d192f3d3SKai Wang.Nm
90d192f3d3SKai Wang.Fl s
91d192f3d3SKai Wang.Op Fl j
92d192f3d3SKai Wang.Op Fl z
93d192f3d3SKai Wang.Ar archive
94d192f3d3SKai Wang.Nm
95d192f3d3SKai Wang.Fl t
963a870f82SKai Wang.Op Fl f
97d192f3d3SKai Wang.Op Fl T
98d192f3d3SKai Wang.Op Fl v
99d192f3d3SKai Wang.Ar archive
1003a870f82SKai Wang.Op Ar
101d192f3d3SKai Wang.Nm
102d192f3d3SKai Wang.Fl x
103d192f3d3SKai Wang.Op Fl C
104d192f3d3SKai Wang.Op Fl T
1053a870f82SKai Wang.Op Fl f
106d192f3d3SKai Wang.Op Fl o
107d192f3d3SKai Wang.Op Fl u
108d192f3d3SKai Wang.Op Fl v
109d192f3d3SKai Wang.Ar archive
1103a870f82SKai Wang.Op Ar
1113a870f82SKai Wang.Nm
1123a870f82SKai Wang.Fl M
113d192f3d3SKai Wang.Nm ranlib
114773810fbSKai Wang.Op Fl D
1157072861cSEd Maste.Op Fl U
116d192f3d3SKai Wang.Ar archive ...
117d192f3d3SKai Wang.Sh DESCRIPTION
118d192f3d3SKai WangThe
119d192f3d3SKai Wang.Nm
120d192f3d3SKai Wangutility creates and maintains groups of files combined into an
121d192f3d3SKai Wangarchive.
122d192f3d3SKai WangOnce an archive has been created, new files can be added to it, and
123d192f3d3SKai Wangexisting files can be extracted, deleted or replaced.
124d192f3d3SKai Wang.Pp
125d192f3d3SKai WangFiles are named in the archive by their last file name component,
126d192f3d3SKai Wangso if a file referenced by a path containing a
127d192f3d3SKai Wang.Dq /
128d192f3d3SKai Wangis archived, it will be named by the last component of the path.
129d192f3d3SKai WangSimilarly when matching paths listed on the command line against
130d192f3d3SKai Wangfile names stored in the archive, only the last component of the
131d192f3d3SKai Wangpath will be compared.
132d192f3d3SKai Wang.Pp
133d192f3d3SKai WangThe normal use of
134d192f3d3SKai Wang.Nm
135d192f3d3SKai Wangis for the creation and maintenance of libraries suitable for use
136d192f3d3SKai Wangwith the link editor
137d192f3d3SKai Wang.Xr ld 1 ,
138d192f3d3SKai Wangalthough it is not restricted to this purpose.
139d192f3d3SKai WangThe
140d192f3d3SKai Wang.Nm
141d192f3d3SKai Wangutility can create and manage an archive symbol table (see
142d192f3d3SKai Wang.Xr ar 5 )
143d192f3d3SKai Wangused to speed up link editing operations.
144d192f3d3SKai WangIf a symbol table is present in an archive, it will be
145da9c9ea4SKai Wangkept up-to-date by subsequent operations on the archive.
146d192f3d3SKai Wang.Pp
147d192f3d3SKai WangThe
148d192f3d3SKai Wang.Nm ranlib
149d192f3d3SKai Wangutility is used to add an archive symbol table
150d192f3d3SKai Wangto an existing archive.
151d192f3d3SKai Wang.Sh OPTIONS
152d192f3d3SKai WangThe
153d192f3d3SKai Wang.Nm
154d192f3d3SKai Wangutility supports the following options:
155d192f3d3SKai Wang.Bl -tag -width indent
156d192f3d3SKai Wang.It Fl a Ar member-after
157d192f3d3SKai WangWhen used with option
158d192f3d3SKai Wang.Fl m
159d192f3d3SKai Wangthis option specifies that the archive members specified by
160d192f3d3SKai Wangarguments
1613a870f82SKai Wang.Ar
162d192f3d3SKai Wangare moved to after the archive member named by argument
163d192f3d3SKai Wang.Ar member-after .
164d192f3d3SKai WangWhen used with option
165d192f3d3SKai Wang.Fl r
166d192f3d3SKai Wangthis option specifies that the files specified by arguments
1673a870f82SKai Wang.Ar
168d192f3d3SKai Wangare added after the archive member named by argument
169d192f3d3SKai Wang.Ar member-after .
170d192f3d3SKai Wang.It Fl b Ar member-before
171d192f3d3SKai WangWhen used with option
172d192f3d3SKai Wang.Fl m
173d192f3d3SKai Wangthis option specifies that the archive members specified by
174d192f3d3SKai Wangarguments
1753a870f82SKai Wang.Ar
176d192f3d3SKai Wangare moved to before the archive member named by argument
177d192f3d3SKai Wang.Ar member-before .
178d192f3d3SKai WangWhen used with option
179d192f3d3SKai Wang.Fl r
180d192f3d3SKai Wangthis option specifies that the files specified by arguments
1813a870f82SKai Wang.Ar
182d192f3d3SKai Wangare added before the archive member named by argument
183d192f3d3SKai Wang.Ar member-before .
184d192f3d3SKai Wang.It Fl c
185d192f3d3SKai WangSuppress the informational message printed when a new archive is
186d192f3d3SKai Wangcreated using the
187d192f3d3SKai Wang.Fl r
188d192f3d3SKai Wangand
189d192f3d3SKai Wang.Fl q
190d192f3d3SKai Wangoptions.
191d192f3d3SKai Wang.It Fl C
192d192f3d3SKai WangPrevent extracted files from replacing like-named files
193d192f3d3SKai Wangin the file system.
194d192f3d3SKai Wang.It Fl d
195d192f3d3SKai WangDelete the members named by arguments
1963a870f82SKai Wang.Ar
197d192f3d3SKai Wangfrom the archive specified by argument
198d192f3d3SKai Wang.Ar archive .
199d192f3d3SKai WangThe archive's symbol table, if present, is updated to reflect
200d192f3d3SKai Wangthe new contents of the archive.
2010e479ac8STim Kientzle.It Fl D
2020e479ac8STim KientzleWhen used in combination with the
2030e479ac8STim Kientzle.Fl r
2040e479ac8STim Kientzleor
2050e479ac8STim Kientzle.Fl q
20611c4d924SEd Masteoption,
20711c4d924SEd Mastewith the
20811c4d924SEd Maste.Fl s
20911c4d924SEd Masteoption without other options, or when invoked as
21011c4d924SEd Maste.Nm ranlib ,
21111c4d924SEd Masteinsert 0's instead of the real mtime, uid and gid values
2120e479ac8STim Kientzleand 0644 instead of file mode from the members named by arguments
2133a870f82SKai Wang.Ar .
2140e479ac8STim KientzleThis ensures that checksums on the resulting archives are reproducible
2150e479ac8STim Kientzlewhen member contents are identical.
216fc964cbfSEd MasteThis option is enabled by default.
2177072861cSEd MasteIf multiple
2187072861cSEd Maste.Fl D
2197072861cSEd Masteand
2207072861cSEd Maste.Fl U
2217072861cSEd Masteoptions are specified on the command line, the final one takes precedence.
222d192f3d3SKai Wang.It Fl f
223edadbb46SEd MasteUse only the first fifteen characters of the archive member name or
224edadbb46SEd Mastecommand line file name argument when naming archive members.
225d192f3d3SKai Wang.It Fl i Ar member-before
226d192f3d3SKai WangSynonymous with option
227d192f3d3SKai Wang.Fl b .
228d192f3d3SKai Wang.It Fl j
2295dfab45bSKai WangThis option is accepted but ignored.
2303a870f82SKai Wang.It Fl l
2313a870f82SKai WangThis option is accepted for compatibility with GNU
2323a870f82SKai Wang.Xr ar 1 ,
2333a870f82SKai Wangbut is ignored.
234d192f3d3SKai Wang.It Fl m
235d192f3d3SKai WangMove archive members specified by arguments
2363a870f82SKai Wang.Ar
237d192f3d3SKai Wangwithin the archive.
238d192f3d3SKai WangIf a position has been specified by one of the
239d192f3d3SKai Wang.Fl a ,
240d192f3d3SKai Wang.Fl b
241d192f3d3SKai Wangor
242d192f3d3SKai Wang.Fl i
243d192f3d3SKai Wangoptions, the members are moved to before or after the specified
244d192f3d3SKai Wangposition.
245d192f3d3SKai WangIf no position has been specified, the specified members are moved
246d192f3d3SKai Wangto the end of the archive.
247d192f3d3SKai WangIf the archive has a symbol table, it is updated to reflect the
248d192f3d3SKai Wangnew contents of the archive.
2493a870f82SKai Wang.It Fl M
2503a870f82SKai WangRead and execute MRI librarian commands from standard input.
251b60d416bSKai WangThe commands understood by the
252b60d416bSKai Wang.Nm
253b60d416bSKai Wangutility are described in the section
254b60d416bSKai Wang.Sx "MRI Librarian Commands" .
255d192f3d3SKai Wang.It Fl o
256d192f3d3SKai WangPreserve the original modification times of members when extracting
257d192f3d3SKai Wangthem.
258d192f3d3SKai Wang.It Fl p
259d192f3d3SKai WangWrite the contents of the specified archive members named by
260d192f3d3SKai Wangarguments
2613a870f82SKai Wang.Ar
262d192f3d3SKai Wangto standard output.
263d192f3d3SKai WangIf no members were specified, the contents of all the files in the
264d192f3d3SKai Wangarchive are written in the order they appear in the archive.
265d192f3d3SKai Wang.It Fl q
266d192f3d3SKai WangAppend the files specified by arguments
2673a870f82SKai Wang.Ar
268d192f3d3SKai Wangto the archive specified by argument
269d192f3d3SKai Wang.Ar archive
270da9c9ea4SKai Wangwithout checking if the files already exist in the archive.
271da9c9ea4SKai WangThe archive symbol table will be updated as needed.
272da9c9ea4SKai WangIf the file specified by the argument
273d192f3d3SKai Wang.Ar archive
274da9c9ea4SKai Wangdoes not already exist, a new archive will be created.
275d192f3d3SKai Wang.It Fl r
276d192f3d3SKai WangReplace (add) the files specified by arguments
2773a870f82SKai Wang.Ar
278d192f3d3SKai Wangin the archive specified by argument
279d192f3d3SKai Wang.Ar archive ,
280d192f3d3SKai Wangcreating the archive if necessary.
2813a870f82SKai WangReplacing existing members will not change the order of members within
2823a870f82SKai Wangthe archive.
283d192f3d3SKai WangIf a file named in arguments
2843a870f82SKai Wang.Ar
285d192f3d3SKai Wangdoes not exist, existing members in the archive that match that
286d192f3d3SKai Wangname are not changed.
287d192f3d3SKai WangNew files are added to the end of the archive unless one of the
288d192f3d3SKai Wangpositioning options
289d192f3d3SKai Wang.Fl a ,
290d192f3d3SKai Wang.Fl b
291d192f3d3SKai Wangor
292d192f3d3SKai Wang.Fl i
293d192f3d3SKai Wangis specified.
294d192f3d3SKai WangThe archive symbol table, if it exists, is updated to reflect the
295d192f3d3SKai Wangnew state of the archive.
296d192f3d3SKai Wang.It Fl s
297d192f3d3SKai WangAdd an archive symbol table (see
298d192f3d3SKai Wang.Xr ar 5 )
299d192f3d3SKai Wangto the archive specified by argument
300d192f3d3SKai Wang.Ar archive .
301d192f3d3SKai WangInvoking
302d192f3d3SKai Wang.Nm
303d192f3d3SKai Wangwith the
304d192f3d3SKai Wang.Fl s
305d192f3d3SKai Wangoption alone is equivalent to invoking
306d192f3d3SKai Wang.Nm ranlib .
3073a870f82SKai Wang.It Fl S
3083a870f82SKai WangDo not generate an archive symbol table.
309d192f3d3SKai Wang.It Fl t
310d192f3d3SKai WangList the files specified by arguments
3113a870f82SKai Wang.Ar
312d192f3d3SKai Wangin the order in which they appear in the archive, one per line.
313d192f3d3SKai WangIf no files are specified, all files in the archive are listed.
314d192f3d3SKai Wang.It Fl T
3151a0a41b1SEd MasteThis option is accepted but ignored.
316edadbb46SEd MasteIn other implementations of
317edadbb46SEd Maste.Nm ,
318edadbb46SEd Maste.Fl T
319edadbb46SEd Mastecreates a "thin" archive.
320d192f3d3SKai Wang.It Fl u
321d192f3d3SKai WangConditionally update the archive or extract members.
322d192f3d3SKai WangWhen used with the
323d192f3d3SKai Wang.Fl r
324d192f3d3SKai Wangoption, files named by arguments
3253a870f82SKai Wang.Ar
326d192f3d3SKai Wangwill be replaced in the archive if they are newer than their
327d192f3d3SKai Wangarchived versions.
328d192f3d3SKai WangWhen used with the
329d192f3d3SKai Wang.Fl x
330d192f3d3SKai Wangoption, the members specified by arguments
3313a870f82SKai Wang.Ar
332d192f3d3SKai Wangwill be extracted only if they are newer than the corresponding
333d192f3d3SKai Wangfiles in the file system.
3347072861cSEd Maste.It Fl U
3357072861cSEd MasteWhen used in combination with the
3367072861cSEd Maste.Fl r
3377072861cSEd Masteor
3387072861cSEd Maste.Fl q
3397072861cSEd Masteoption, insert the real mtime, uid and gid, and file mode values
3407072861cSEd Mastefrom the members named by arguments
3417072861cSEd Maste.Ar .
3427072861cSEd MasteIf multiple
3437072861cSEd Maste.Fl D
3447072861cSEd Masteand
3457072861cSEd Maste.Fl U
3467072861cSEd Masteoptions are specified on the command line, the final one takes precedence.
347d192f3d3SKai Wang.It Fl v
348d192f3d3SKai WangProvide verbose output.
349d192f3d3SKai WangWhen used with the
350d192f3d3SKai Wang.Fl d ,
351d192f3d3SKai Wang.Fl m ,
352d192f3d3SKai Wang.Fl q
353d192f3d3SKai Wangor
354d192f3d3SKai Wang.Fl x
355d192f3d3SKai Wangoptions,
356d192f3d3SKai Wang.Nm
357d192f3d3SKai Wanggives a file-by-file description of the archive modification being
35832ba16b6SUlrich Spörleinperformed, which consists of three white-space separated fields:
359d192f3d3SKai Wangthe option letter, a dash
360d192f3d3SKai Wang.Dq "-" ,
361d192f3d3SKai Wangand the file name.
362d192f3d3SKai WangWhen used with the
363d192f3d3SKai Wang.Fl r
364d192f3d3SKai Wangoption,
365d192f3d3SKai Wang.Nm
366d192f3d3SKai Wangdisplays the description as above, but the initial letter is an
367d192f3d3SKai Wang.Dq a
368d192f3d3SKai Wangif the file is added to the archive, or an
369ce04f76cSRuslan Ermilov.Dq r
370d192f3d3SKai Wangif the file replaces a file already in the archive.
371d192f3d3SKai WangWhen used with the
372d192f3d3SKai Wang.Fl p
373d192f3d3SKai Wangoption, the name of the file enclosed in
374d192f3d3SKai Wang.Dq <
375d192f3d3SKai Wangand
376d192f3d3SKai Wang.Dq >
377d192f3d3SKai Wangcharacters is written to standard output preceded by a single newline
378d192f3d3SKai Wangcharacter and followed by two newline characters.
379d192f3d3SKai WangThe contents of the named file follow the file name.
380d192f3d3SKai WangWhen used with the
381d192f3d3SKai Wang.Fl t
382d192f3d3SKai Wangoption,
383d192f3d3SKai Wang.Nm
384d192f3d3SKai Wangdisplays eight whitespace separated fields:
385d192f3d3SKai Wangthe file permissions as displayed by
386d192f3d3SKai Wang.Xr strmode 3 ,
387d192f3d3SKai Wangdecimal user and group IDs separated by a slash (
388d192f3d3SKai Wang.Dq / Ns ) ,
389d192f3d3SKai Wangthe file size in bytes, the file modification time in
390d192f3d3SKai Wang.Xr strftime 3
391d192f3d3SKai Wangformat
392d192f3d3SKai Wang.Dq "%b %e %H:%M %Y" ,
393d192f3d3SKai Wangand the name of the file.
3943a870f82SKai Wang.It Fl V
3953a870f82SKai WangPrint a version string and exit.
396d192f3d3SKai Wang.It Fl x
397d192f3d3SKai WangExtract archive members specified by arguments
3983a870f82SKai Wang.Ar
399d192f3d3SKai Wanginto the current directory.
400d192f3d3SKai WangIf no members have been specified, extract all members of the archive.
401d192f3d3SKai WangIf the file corresponding to an extracted member does not exist it
402d192f3d3SKai Wangwill be created.
403d192f3d3SKai WangIf the file corresponding to an extracted member does exist, its owner
404d192f3d3SKai Wangand group will not be changed while its contents will be overwritten
405d192f3d3SKai Wangand its permissions will set to that entered in the archive.
406d192f3d3SKai WangThe file's access and modification time would be that of the time
407d192f3d3SKai Wangof extraction unless the
408d192f3d3SKai Wang.Fl o
409d192f3d3SKai Wangoption was specified.
410d192f3d3SKai Wang.It Fl z
4115dfab45bSKai WangThis option is accepted but ignored.
412d192f3d3SKai Wang.El
413b60d416bSKai Wang.Ss "MRI Librarian Commands"
414b60d416bSKai WangIf the
415b60d416bSKai Wang.Fl M
416b60d416bSKai Wangoption is specified, the
417b60d416bSKai Wang.Nm
418b60d416bSKai Wangutility will read and execute commands from its standard input.
419b60d416bSKai WangIf standard input is a terminal, the
420b60d416bSKai Wang.Nm
421b60d416bSKai Wangutility will display the prompt
422b60d416bSKai Wang.Dq Li "AR >"
423b60d416bSKai Wangbefore reading a line, and will continue operation even if errors are
424b60d416bSKai Wangencountered.
425b60d416bSKai WangIf standard input is not a terminal, the
426b60d416bSKai Wang.Nm
427b60d416bSKai Wangutility will not display a prompt and will terminate execution on
428b60d416bSKai Wangencountering an error.
429b60d416bSKai Wang.Pp
430b60d416bSKai WangEach input line contains a single command.
431b60d416bSKai WangWords in an input line are separated by whitespace characters.
432b60d416bSKai WangThe first word of the line is the command, the remaining words are
433b60d416bSKai Wangthe arguments to the command.
434b60d416bSKai WangThe command word may be specified in either case.
435b60d416bSKai WangArguments may be separated by commas or blanks.
436b60d416bSKai Wang.Pp
437b60d416bSKai WangEmpty lines are allowed and are ignored.
438b60d416bSKai WangLong lines are continued by ending them with the
439b60d416bSKai Wang.Dq Li +
440b60d416bSKai Wangcharacter.
441b60d416bSKai Wang.Pp
442b60d416bSKai WangThe
443b60d416bSKai Wang.Dq Li *
444b60d416bSKai Wangand
445dce762ddSGlen Barber.Dq Li "\&;"
446b60d416bSKai Wangcharacters start a comment.
447b60d416bSKai WangComments extend till the end of the line.
448b60d416bSKai Wang.Pp
449b60d416bSKai WangWhen executing an MRI librarian script the
450b60d416bSKai Wang.Nm
451b60d416bSKai Wangutility works on a temporary copy of an archive.
452b60d416bSKai WangChanges to the copy are made permanent using the
453b60d416bSKai Wang.Ic save
454b60d416bSKai Wangcommand.
455b60d416bSKai Wang.Pp
456b60d416bSKai WangCommands understood by the
457b60d416bSKai Wang.Nm
458b60d416bSKai Wangutility are:
459b60d416bSKai Wang.Bl -tag -width indent
460b60d416bSKai Wang.It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
461b60d416bSKai WangAdd the contents of the archive named by argument
462b60d416bSKai Wang.Ar archive
463b60d416bSKai Wangto the current archive.
464b60d416bSKai WangIf specific members are named using the arguments
465b60d416bSKai Wang.Ar member ,
466b60d416bSKai Wangthen those members are added to the current archive.
467b60d416bSKai WangIf no members are specified, the entire contents of the archive
468b60d416bSKai Wangare added to the current archive.
469b60d416bSKai Wang.It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
470b60d416bSKai WangAdd the files named by arguments
471b60d416bSKai Wang.Ar member
472b60d416bSKai Wangto the current archive.
473b60d416bSKai Wang.It Ic clear
474b60d416bSKai WangDiscard all the contents of the current archive.
475b60d416bSKai Wang.It Ic create Ar archive
476b60d416bSKai WangCreate a new archive named by the argument
477b60d416bSKai Wang.Ar archive ,
478b60d416bSKai Wangand makes it the current archive.
479b60d416bSKai WangIf the named archive already exists, it will be overwritten
480b60d416bSKai Wangwhen the
481b60d416bSKai Wang.Ic save
482b60d416bSKai Wangcommand is issued.
483b60d416bSKai Wang.It Ic delete Ar module Oo Li , Ar member Oc Ns ...
484b60d416bSKai WangDelete the modules named by the arguments
485b60d416bSKai Wang.Ar member
486b60d416bSKai Wangfrom the current archive.
487b60d416bSKai Wang.It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
488b60d416bSKai WangList each named module in the archive.
489b60d416bSKai WangThe format of the output depends on the verbosity setting set using
490b60d416bSKai Wangthe
491b60d416bSKai Wang.Ic verbose
492b60d416bSKai Wangcommand.
493b60d416bSKai WangOutput is sent to standard output, or to the file specified by
494b60d416bSKai Wangargument
495b60d416bSKai Wang.Ar outputfile .
496b60d416bSKai Wang.It Ic end
497b60d416bSKai WangExit successfully from the
498b60d416bSKai Wang.Nm
499b60d416bSKai Wangutility.
500b60d416bSKai WangAny unsaved changes to the current archive will be discarded.
501b60d416bSKai Wang.It Ic extract Ar member Oo Li , Ar member Oc Ns ...
502b60d416bSKai WangExtract the members named by the arguments
503b60d416bSKai Wang.Ar member
504b60d416bSKai Wangfrom the current archive.
505b60d416bSKai Wang.It Ic list
506b60d416bSKai WangDisplay the contents of the current archive in verbose style.
507b60d416bSKai Wang.It Ic open Ar archive
508b60d416bSKai WangOpen the archive named by argument
509b60d416bSKai Wang.Ar archive
510b60d416bSKai Wangand make it the current archive.
511b60d416bSKai Wang.It Ic replace Ar member Oo Li , Ar member Oc Ns ...
512b60d416bSKai WangReplace named members in the current archive with the files specified
513b60d416bSKai Wangby arguments
514b60d416bSKai Wang.Ar member .
515b60d416bSKai WangThe files must be present in the current directory and the named
516b60d416bSKai Wangmodules must already exist in the current archive.
517b60d416bSKai Wang.It Ic save
518b60d416bSKai WangCommit all changes to the current archive.
519b60d416bSKai Wang.It Ic verbose
520b60d416bSKai WangToggle the verbosity of the
521b60d416bSKai Wang.Ic directory
522b60d416bSKai Wangcommand.
523b60d416bSKai Wang.El
524d192f3d3SKai Wang.Sh EXAMPLES
525d192f3d3SKai WangTo create a new archive
526d192f3d3SKai Wang.Pa ex.a
527d192f3d3SKai Wangcontaining three files
528d192f3d3SKai Wang.Pa ex1.o ,
529d192f3d3SKai Wang.Pa ex2.o
530d192f3d3SKai Wangand
531d192f3d3SKai Wang.Pa ex3.o ,
532d192f3d3SKai Wanguse:
533d192f3d3SKai Wang.Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
534d192f3d3SKai Wang.Pp
535d192f3d3SKai WangTo add an archive symbol table to an existing archive
536d192f3d3SKai Wang.Pa ex.a ,
537d192f3d3SKai Wanguse:
538d192f3d3SKai Wang.Dl "ar -s ex.a"
539d192f3d3SKai Wang.Pp
540d192f3d3SKai WangTo delete file
541d192f3d3SKai Wang.Pa ex1.o
542d192f3d3SKai Wangfrom archive
543d192f3d3SKai Wang.Pa ex.a ,
544d192f3d3SKai Wanguse:
545d192f3d3SKai Wang.D1 "ar -d ex.a ex1.o"
546d192f3d3SKai Wang.Pp
547d192f3d3SKai WangTo verbosely list the contents of archive
548d192f3d3SKai Wang.Pa ex.a ,
549d192f3d3SKai Wanguse:
550d192f3d3SKai Wang.D1 "ar -tv ex.a"
551b60d416bSKai Wang.Pp
552b60d416bSKai WangTo create a new archive
553b60d416bSKai Wang.Pa ex.a
554b60d416bSKai Wangcontaining the files
555b60d416bSKai Wang.Pa ex1.o ,
556b60d416bSKai Wangand
557b60d416bSKai Wang.Pa ex2.o ,
558b60d416bSKai Wangusing MRI librarian commands, use the following script:
559b60d416bSKai Wang.Bd -literal -offset indent
560b60d416bSKai Wangcreate ex.a		 * specify the output archive
561b60d416bSKai Wangaddmod ex1.o ex2.o	 * add modules
562b60d416bSKai Wangsave			 * save pending changes
563b60d416bSKai Wangend			 * exit the utility
564b60d416bSKai Wang.Ed
565d192f3d3SKai Wang.Sh DIAGNOSTICS
566d192f3d3SKai Wang.Ex -std
567d192f3d3SKai Wang.Sh SEE ALSO
568d192f3d3SKai Wang.Xr ld 1 ,
569d192f3d3SKai Wang.Xr archive 3 ,
570d192f3d3SKai Wang.Xr elf 3 ,
571d192f3d3SKai Wang.Xr strftime 3 ,
572d192f3d3SKai Wang.Xr strmode 3 ,
573d192f3d3SKai Wang.Xr ar 5
5743a870f82SKai Wang.Sh STANDARDS COMPLIANCE
5753a870f82SKai WangThe
5763a870f82SKai Wang.Nm
5773a870f82SKai Wangutility's support for the
5783a870f82SKai Wang.Fl a ,
5793a870f82SKai Wang.Fl b ,
5803a870f82SKai Wang.Fl c ,
5813a870f82SKai Wang.Fl i ,
5823a870f82SKai Wang.Fl m ,
5833a870f82SKai Wang.Fl p ,
5843a870f82SKai Wang.Fl q ,
5853a870f82SKai Wang.Fl r ,
5863a870f82SKai Wang.Fl s ,
5873a870f82SKai Wang.Fl t ,
5883a870f82SKai Wang.Fl u ,
5893a870f82SKai Wang.Fl v ,
5903a870f82SKai Wang.Fl C
5913a870f82SKai Wangand
5923a870f82SKai Wang.Fl T
5933a870f82SKai Wangoptions is believed to be compliant with
5943a870f82SKai Wang.St -p1003.2 .
595d192f3d3SKai Wang.Sh HISTORY
596d192f3d3SKai WangAn
597d192f3d3SKai Wang.Nm
598d192f3d3SKai Wangcommand first appeared in AT&T UNIX Version 1.
599d192f3d3SKai WangIn
600ce04f76cSRuslan Ermilov.Fx 8.0 ,
6012b7af31cSBaptiste Daroussin.An Kai Wang Aq Mt kaiw@FreeBSD.org
602d192f3d3SKai Wangreimplemented
603ce04f76cSRuslan Ermilov.Nm
604d192f3d3SKai Wangand
605d192f3d3SKai Wang.Nm ranlib
606d192f3d3SKai Wangusing the
607d192f3d3SKai Wang.Lb libarchive
608d192f3d3SKai Wangand the
609d192f3d3SKai Wang.Lb libelf .
610