xref: /freebsd/contrib/elftoolchain/ar/ar.1 (revision ae500c1ff8974130f7f2692772cf288b90349e0d)
13fe401a5SEd Maste.\" Copyright (c) 2007,2009-2012 Joseph Koshy.  All rights reserved.
23fe401a5SEd Maste.\"
33fe401a5SEd Maste.\" Redistribution and use in source and binary forms, with or without
43fe401a5SEd Maste.\" modification, are permitted provided that the following conditions
53fe401a5SEd Maste.\" are met:
63fe401a5SEd Maste.\" 1. Redistributions of source code must retain the above copyright
73fe401a5SEd Maste.\"    notice, this list of conditions and the following disclaimer.
83fe401a5SEd Maste.\" 2. Redistributions in binary form must reproduce the above copyright
93fe401a5SEd Maste.\"    notice, this list of conditions and the following disclaimer in the
103fe401a5SEd Maste.\"    documentation and/or other materials provided with the distribution.
113fe401a5SEd Maste.\"
123fe401a5SEd Maste.\" This software is provided by Joseph Koshy ``as is'' and
133fe401a5SEd Maste.\" any express or implied warranties, including, but not limited to, the
143fe401a5SEd Maste.\" implied warranties of merchantability and fitness for a particular purpose
153fe401a5SEd Maste.\" are disclaimed.  in no event shall Joseph Koshy be liable
163fe401a5SEd Maste.\" for any direct, indirect, incidental, special, exemplary, or consequential
173fe401a5SEd Maste.\" damages (including, but not limited to, procurement of substitute goods
183fe401a5SEd Maste.\" or services; loss of use, data, or profits; or business interruption)
193fe401a5SEd Maste.\" however caused and on any theory of liability, whether in contract, strict
203fe401a5SEd Maste.\" liability, or tort (including negligence or otherwise) arising in any way
213fe401a5SEd Maste.\" out of the use of this software, even if advised of the possibility of
223fe401a5SEd Maste.\" such damage.
233fe401a5SEd Maste.\"
24*ae500c1fSEd Maste.\" $Id: ar.1 3642 2018-10-14 14:24:28Z jkoshy $
253fe401a5SEd Maste.\"
26*ae500c1fSEd Maste.Dd September 30, 2018
273fe401a5SEd Maste.Dt AR 1
28*ae500c1fSEd Maste.Os
293fe401a5SEd Maste.Sh NAME
303fe401a5SEd Maste.Nm ar
313fe401a5SEd Maste.Nd manage archives
323fe401a5SEd Maste.Sh SYNOPSIS
333fe401a5SEd Maste.Nm
343fe401a5SEd Maste.Fl d
353fe401a5SEd Maste.Op Fl f
363fe401a5SEd Maste.Op Fl j
37*ae500c1fSEd Maste.Op Fl T
383fe401a5SEd Maste.Op Fl v
393fe401a5SEd Maste.Op Fl z
403fe401a5SEd Maste.Ar archive
413fe401a5SEd Maste.Ar
423fe401a5SEd Maste.Nm
433fe401a5SEd Maste.Fl m
443fe401a5SEd Maste.Op Fl a Ar position-after
453fe401a5SEd Maste.Op Fl b Ar position-before
463fe401a5SEd Maste.Op Fl f
473fe401a5SEd Maste.Op Fl i Ar position-before
483fe401a5SEd Maste.Op Fl j
493fe401a5SEd Maste.Op Fl s | Fl S
50*ae500c1fSEd Maste.Op Fl T
513fe401a5SEd Maste.Op Fl z
523fe401a5SEd Maste.Ar archive
533fe401a5SEd Maste.Ar
543fe401a5SEd Maste.Nm
553fe401a5SEd Maste.Fl p
563fe401a5SEd Maste.Op Fl f
57*ae500c1fSEd Maste.Op Fl s
58*ae500c1fSEd Maste.Op Fl T
593fe401a5SEd Maste.Op Fl v
603fe401a5SEd Maste.Ar archive
613fe401a5SEd Maste.Op Ar
623fe401a5SEd Maste.Nm
633fe401a5SEd Maste.Fl q
643fe401a5SEd Maste.Op Fl c
653fe401a5SEd Maste.Op Fl D
663fe401a5SEd Maste.Op Fl f
673fe401a5SEd Maste.Op Fl F Ar flavor | Fl -flavor Ar flavor
683fe401a5SEd Maste.Op Fl s | Fl S
69*ae500c1fSEd Maste.Op Fl T
70656f49f8SEd Maste.Op Fl U
713fe401a5SEd Maste.Op Fl v
723fe401a5SEd Maste.Op Fl z
733fe401a5SEd Maste.Ar archive
743fe401a5SEd Maste.Ar
753fe401a5SEd Maste.Nm
763fe401a5SEd Maste.Fl r
773fe401a5SEd Maste.Op Fl a Ar position-after
783fe401a5SEd Maste.Op Fl b Ar position-before
793fe401a5SEd Maste.Op Fl c
803fe401a5SEd Maste.Op Fl D
813fe401a5SEd Maste.Op Fl f
823fe401a5SEd Maste.Op Fl F Ar flavor | Fl -flavor Ar flavor
833fe401a5SEd Maste.Op Fl i Ar position-before
843fe401a5SEd Maste.Op Fl j
853fe401a5SEd Maste.Op Fl s | Fl S
86*ae500c1fSEd Maste.Op Fl T
873fe401a5SEd Maste.Op Fl u
88656f49f8SEd Maste.Op Fl U
893fe401a5SEd Maste.Op Fl v
903fe401a5SEd Maste.Op Fl z
913fe401a5SEd Maste.Ar archive
923fe401a5SEd Maste.Ar
933fe401a5SEd Maste.Nm
943fe401a5SEd Maste.Fl s
953fe401a5SEd Maste.Op Fl D
963fe401a5SEd Maste.Op Fl j
97656f49f8SEd Maste.Op Fl U
983fe401a5SEd Maste.Op Fl z
993fe401a5SEd Maste.Ar archive
1003fe401a5SEd Maste.Nm
1013fe401a5SEd Maste.Fl t
1023fe401a5SEd Maste.Op Fl f
103*ae500c1fSEd Maste.Op Fl s
1043fe401a5SEd Maste.Op Fl T
1053fe401a5SEd Maste.Op Fl v
1063fe401a5SEd Maste.Ar archive
1073fe401a5SEd Maste.Op Ar
1083fe401a5SEd Maste.Nm
1093fe401a5SEd Maste.Fl x
1103fe401a5SEd Maste.Op Fl C
1113fe401a5SEd Maste.Op Fl f
1123fe401a5SEd Maste.Op Fl o
113*ae500c1fSEd Maste.Op Fl s
114*ae500c1fSEd Maste.Op Fl T
1153fe401a5SEd Maste.Op Fl u
1163fe401a5SEd Maste.Op Fl v
1173fe401a5SEd Maste.Ar archive
1183fe401a5SEd Maste.Op Ar
1193fe401a5SEd Maste.Nm
1203fe401a5SEd Maste.Fl M
1213fe401a5SEd Maste.Nm
1223fe401a5SEd Maste.Fl V
1233fe401a5SEd Maste.Sh DESCRIPTION
1243fe401a5SEd MasteThe
1253fe401a5SEd Maste.Nm
1263fe401a5SEd Masteutility creates and maintains groups of files combined into an
1273fe401a5SEd Mastearchive.
1283fe401a5SEd MasteOnce an archive has been created, new files can be added to it, and
1293fe401a5SEd Masteexisting files can be extracted, deleted or replaced.
1303fe401a5SEd Maste.Pp
1313fe401a5SEd MasteFiles are named in the archive by their last file name component,
1323fe401a5SEd Masteso if a file referenced by a path containing a
1333fe401a5SEd Maste.Dq /
1343fe401a5SEd Masteis archived, it will be named by the last component of the path.
1353fe401a5SEd MasteSimilarly when matching paths listed on the command line against
1363fe401a5SEd Mastefile names stored in the archive, only the last component of the
1373fe401a5SEd Mastepath will be compared.
1383fe401a5SEd Maste.Pp
1393fe401a5SEd MasteThe normal use of
1403fe401a5SEd Maste.Nm
1413fe401a5SEd Masteis for the creation and maintenance of libraries suitable for use
1423fe401a5SEd Mastewith the link editor
1433fe401a5SEd Maste.Xr ld 1 ,
1443fe401a5SEd Mastealthough it is not restricted to this purpose.
1453fe401a5SEd MasteThe
1463fe401a5SEd Maste.Nm
1473fe401a5SEd Masteutility can create and manage an archive symbol table (see
1483fe401a5SEd Maste.Xr ar 5 )
1493fe401a5SEd Masteused to speed up link editing operations.
1503fe401a5SEd MasteIf a symbol table is present in an archive, it will be
1513fe401a5SEd Mastekept up-to-date by subsequent operations on the archive.
1523fe401a5SEd Maste.Sh OPTIONS
1533fe401a5SEd MasteThe
1543fe401a5SEd Maste.Nm
1553fe401a5SEd Masteutility supports the following options:
1563fe401a5SEd Maste.Bl -tag -width indent
1573fe401a5SEd Maste.It Fl a Ar member-after
1583fe401a5SEd MasteWhen used with option
1593fe401a5SEd Maste.Fl m
1603fe401a5SEd Mastethis option specifies that the archive members specified by
1613fe401a5SEd Mastearguments
1623fe401a5SEd Maste.Ar
1633fe401a5SEd Masteare moved to after the archive member named by argument
1643fe401a5SEd Maste.Ar member-after .
1653fe401a5SEd MasteWhen used with option
1663fe401a5SEd Maste.Fl r
1673fe401a5SEd Mastethis option specifies that the files specified by arguments
1683fe401a5SEd Maste.Ar
1693fe401a5SEd Masteare added after the archive member named by argument
1703fe401a5SEd Maste.Ar member-after .
1713fe401a5SEd Maste.It Fl b Ar member-before
1723fe401a5SEd MasteWhen used with option
1733fe401a5SEd Maste.Fl m
1743fe401a5SEd Mastethis option specifies that the archive members specified by
1753fe401a5SEd Mastearguments
1763fe401a5SEd Maste.Ar
1773fe401a5SEd Masteare moved to before the archive member named by argument
1783fe401a5SEd Maste.Ar member-before .
1793fe401a5SEd MasteWhen used with option
1803fe401a5SEd Maste.Fl r
1813fe401a5SEd Mastethis option specifies that the files specified by arguments
1823fe401a5SEd Maste.Ar
1833fe401a5SEd Masteare added before the archive member named by argument
1843fe401a5SEd Maste.Ar member-before .
1853fe401a5SEd Maste.It Fl c
1863fe401a5SEd MasteSuppress the informational message printed when a new archive is
1873fe401a5SEd Mastecreated using the
1883fe401a5SEd Maste.Fl r
1893fe401a5SEd Masteand
1903fe401a5SEd Maste.Fl q
1913fe401a5SEd Masteoptions.
1923fe401a5SEd Maste.It Fl C
1933fe401a5SEd MastePrevent extracted files from replacing like-named files
1943fe401a5SEd Mastein the file system.
1953fe401a5SEd Maste.It Fl d
1963fe401a5SEd MasteDelete the members named by arguments
1973fe401a5SEd Maste.Ar
1983fe401a5SEd Mastefrom the archive specified by argument
1993fe401a5SEd Maste.Ar archive .
2003fe401a5SEd MasteThe archive's symbol table, if present, is updated to reflect
2013fe401a5SEd Mastethe new contents of the archive.
2023fe401a5SEd Maste.It Fl D
2033fe401a5SEd MasteWhen used in combination with the
2043fe401a5SEd Maste.Fl r
2053fe401a5SEd Masteor
2063fe401a5SEd Maste.Fl q
2073fe401a5SEd Masteoption, insert 0's instead of the real mtime, uid and gid values
2083fe401a5SEd Masteand 0644 instead of file mode from the members named by arguments
2093fe401a5SEd Maste.Ar .
2103fe401a5SEd MasteThis ensures that checksums on the resulting archives are reproducible
2113fe401a5SEd Mastewhen member contents are identical.
212656f49f8SEd MasteIf multiple
213656f49f8SEd Maste.Fl D
214656f49f8SEd Masteand
215656f49f8SEd Maste.Fl U
216656f49f8SEd Masteoptions are specified on the command line, the final one takes precedence.
2173fe401a5SEd Maste.It Fl f
2183fe401a5SEd MasteSynonymous with option
2193fe401a5SEd Maste.Fl T .
2203fe401a5SEd Maste.It Fl F Ar flavor | Fl -flavor Ar flavor
2213fe401a5SEd MasteCreate archives with the specified archive format.
2223fe401a5SEd MasteLegal values for argument
2233fe401a5SEd Maste.Ar flavor
2243fe401a5SEd Masteare:
2253fe401a5SEd Maste.Bl -tag -width indent -compact
2263fe401a5SEd Maste.It Ar bsd
2273fe401a5SEd MasteCreate BSD format archives.
2283fe401a5SEd Maste.It Ar gnu
2293fe401a5SEd MasteAn alias for
2303fe401a5SEd Maste.Ar svr4 .
2313fe401a5SEd Maste.It Ar svr4
2323fe401a5SEd MasteCreate SVR4 format archives.
2333fe401a5SEd Maste.El
2343fe401a5SEd MasteIf this option is not specified,
2353fe401a5SEd Maste.Nm
2363fe401a5SEd Mastewill create archives using the SVR4 format.
2373fe401a5SEd Maste.It Fl i Ar member-before
2383fe401a5SEd MasteSynonymous with option
2393fe401a5SEd Maste.Fl b .
2403fe401a5SEd Maste.It Fl j
2413fe401a5SEd MasteThis option is accepted for compatibility with the
2423fe401a5SEd Maste.Tn FreeBSD
2433fe401a5SEd Masteversion of the
2443fe401a5SEd Maste.Nm
2453fe401a5SEd Masteutility, but is ignored.
2463fe401a5SEd Maste.It Fl l
2473fe401a5SEd MasteThis option is accepted for compatibility with GNU
2483fe401a5SEd Maste.Xr ar 1 ,
2493fe401a5SEd Mastebut is ignored.
2503fe401a5SEd Maste.It Fl m
2513fe401a5SEd MasteMove archive members specified by arguments
2523fe401a5SEd Maste.Ar
2533fe401a5SEd Mastewithin the archive.
2543fe401a5SEd MasteIf a position has been specified by one of the
2553fe401a5SEd Maste.Fl a ,
2563fe401a5SEd Maste.Fl b
2573fe401a5SEd Masteor
2583fe401a5SEd Maste.Fl i
2593fe401a5SEd Masteoptions, the members are moved to before or after the specified
2603fe401a5SEd Masteposition.
2613fe401a5SEd MasteIf no position has been specified, the specified members are moved
2623fe401a5SEd Masteto the end of the archive.
2633fe401a5SEd MasteIf the archive has a symbol table, it is updated to reflect the
2643fe401a5SEd Mastenew contents of the archive.
2653fe401a5SEd Maste.It Fl M
2663fe401a5SEd MasteRead and execute MRI librarian commands from standard input.
2673fe401a5SEd MasteThe commands understood by the
2683fe401a5SEd Maste.Nm
2693fe401a5SEd Masteutility are described in the section
2703fe401a5SEd Maste.Sx "MRI Librarian Commands" .
2713fe401a5SEd Maste.It Fl o
2723fe401a5SEd MastePreserve the original modification times of members when extracting
2733fe401a5SEd Mastethem.
2743fe401a5SEd Maste.It Fl p
2753fe401a5SEd MasteWrite the contents of the specified archive members named by
2763fe401a5SEd Mastearguments
2773fe401a5SEd Maste.Ar
2783fe401a5SEd Masteto standard output.
2793fe401a5SEd MasteIf no members were specified, the contents of all the files in the
2803fe401a5SEd Mastearchive are written in the order they appear in the archive.
2813fe401a5SEd Maste.It Fl q
2823fe401a5SEd MasteAppend the files specified by arguments
2833fe401a5SEd Maste.Ar
2843fe401a5SEd Masteto the archive specified by argument
2853fe401a5SEd Maste.Ar archive
2863fe401a5SEd Mastewithout checking if the files already exist in the archive.
2873fe401a5SEd MasteThe archive symbol table will be updated as needed.
2883fe401a5SEd MasteIf the file specified by the argument
2893fe401a5SEd Maste.Ar archive
2903fe401a5SEd Mastedoes not already exist, a new archive will be created.
2913fe401a5SEd Maste.It Fl r
2923fe401a5SEd MasteReplace (add) the files specified by arguments
2933fe401a5SEd Maste.Ar
2943fe401a5SEd Mastein the archive specified by argument
2953fe401a5SEd Maste.Ar archive ,
2963fe401a5SEd Mastecreating the archive if necessary.
2973fe401a5SEd MasteReplacing existing members will not change the order of members within
2983fe401a5SEd Mastethe archive.
2993fe401a5SEd MasteIf a file named in arguments
3003fe401a5SEd Maste.Ar
3013fe401a5SEd Mastedoes not exist, existing members in the archive that match that
3023fe401a5SEd Mastename are not changed.
3033fe401a5SEd MasteNew files are added to the end of the archive unless one of the
3043fe401a5SEd Mastepositioning options
3053fe401a5SEd Maste.Fl a ,
3063fe401a5SEd Maste.Fl b
3073fe401a5SEd Masteor
3083fe401a5SEd Maste.Fl i
3093fe401a5SEd Masteis specified.
3103fe401a5SEd MasteThe archive symbol table, if it exists, is updated to reflect the
3113fe401a5SEd Mastenew state of the archive.
3123fe401a5SEd Maste.It Fl s
3133fe401a5SEd MasteAdd an archive symbol table (see
3143fe401a5SEd Maste.Xr ar 5 )
3153fe401a5SEd Masteto the archive specified by argument
3163fe401a5SEd Maste.Ar archive .
3173fe401a5SEd MasteInvoking
3183fe401a5SEd Maste.Nm
3193fe401a5SEd Mastewith the
3203fe401a5SEd Maste.Fl s
3213fe401a5SEd Masteoption alone is equivalent to invoking
3223fe401a5SEd Maste.Xr ranlib 1 .
3233fe401a5SEd Maste.It Fl S
3243fe401a5SEd MasteDo not generate an archive symbol table.
3253fe401a5SEd Maste.It Fl t
3263fe401a5SEd MasteFor
3273fe401a5SEd Maste.Nm ,
3283fe401a5SEd Mastelist the files specified by arguments
3293fe401a5SEd Maste.Ar
3303fe401a5SEd Mastein the order in which they appear in the archive, one per line.
3313fe401a5SEd MasteIf no files are specified, all files in the archive are listed.
3323fe401a5SEd Maste.It Fl T
3333fe401a5SEd MasteUse only the first fifteen characters of the archive member name or
3343fe401a5SEd Mastecommand line file name argument when naming archive members.
3353fe401a5SEd Maste.It Fl u
3363fe401a5SEd MasteConditionally update the archive or extract members.
3373fe401a5SEd MasteWhen used with the
3383fe401a5SEd Maste.Fl r
3393fe401a5SEd Masteoption, files named by arguments
3403fe401a5SEd Maste.Ar
3413fe401a5SEd Mastewill be replaced in the archive if they are newer than their
3423fe401a5SEd Mastearchived versions.
3433fe401a5SEd MasteWhen used with the
3443fe401a5SEd Maste.Fl x
3453fe401a5SEd Masteoption, the members specified by arguments
3463fe401a5SEd Maste.Ar
3473fe401a5SEd Mastewill be extracted only if they are newer than the corresponding
3483fe401a5SEd Mastefiles in the file system.
349656f49f8SEd Maste.It Fl U
350656f49f8SEd MasteWhen used in combination with the
351656f49f8SEd Maste.Fl r
352656f49f8SEd Masteor
353656f49f8SEd Maste.Fl q
354656f49f8SEd Masteoption, insert the real mtime, uid and gid, and file mode values
355656f49f8SEd Mastefrom the members named by arguments
356656f49f8SEd Maste.Ar .
357656f49f8SEd MasteIf multiple
358656f49f8SEd Maste.Fl D
359656f49f8SEd Masteand
360656f49f8SEd Maste.Fl U
361656f49f8SEd Masteoptions are specified on the command line, the final one takes precedence.
3623fe401a5SEd Maste.It Fl v
3633fe401a5SEd MasteProvide verbose output.
3643fe401a5SEd MasteWhen used with the
3653fe401a5SEd Maste.Fl d ,
3663fe401a5SEd Maste.Fl m ,
3673fe401a5SEd Maste.Fl q
3683fe401a5SEd Masteor
3693fe401a5SEd Maste.Fl x
3703fe401a5SEd Masteoptions,
3713fe401a5SEd Maste.Nm
3723fe401a5SEd Mastegives a file-by-file description of the archive modification being
3733fe401a5SEd Masteperformed, which consists of three white-space separated fields:
3743fe401a5SEd Mastethe option letter, a dash
3753fe401a5SEd Maste.Dq "-" ,
3763fe401a5SEd Masteand the file name.
3773fe401a5SEd MasteWhen used with the
3783fe401a5SEd Maste.Fl r
3793fe401a5SEd Masteoption,
3803fe401a5SEd Maste.Nm
3813fe401a5SEd Mastedisplays the description as above, but the initial letter is an
3823fe401a5SEd Maste.Dq a
3833fe401a5SEd Masteif the file is added to the archive, or an
3843fe401a5SEd Maste.Dq r
3853fe401a5SEd Masteif the file replaces a file already in the archive.
3863fe401a5SEd MasteWhen used with the
3873fe401a5SEd Maste.Fl p
3883fe401a5SEd Masteoption, the name of the file enclosed in
3893fe401a5SEd Maste.Dq <
3903fe401a5SEd Masteand
3913fe401a5SEd Maste.Dq >
3923fe401a5SEd Mastecharacters is written to standard output preceded by a single newline
3933fe401a5SEd Mastecharacter and followed by two newline characters.
3943fe401a5SEd MasteThe contents of the named file follow the file name.
3953fe401a5SEd MasteWhen used with the
3963fe401a5SEd Maste.Fl t
3973fe401a5SEd Masteoption,
3983fe401a5SEd Maste.Nm
3993fe401a5SEd Mastedisplays eight whitespace separated fields:
4003fe401a5SEd Mastethe file permissions as displayed by
4013fe401a5SEd Maste.Xr strmode 3 ,
4023fe401a5SEd Mastedecimal user and group IDs separated by a slash (
4033fe401a5SEd Maste.Dq / Ns ) ,
4043fe401a5SEd Mastethe file size in bytes, the file modification time in
4053fe401a5SEd Maste.Xr strftime 3
4063fe401a5SEd Masteformat
4073fe401a5SEd Maste.Dq "%b %e %H:%M %Y" ,
4083fe401a5SEd Masteand the name of the file.
4093fe401a5SEd Maste.It Fl V
4103fe401a5SEd MastePrint a version identifier and exit.
4113fe401a5SEd Maste.It Fl x
4123fe401a5SEd MasteExtract archive members specified by arguments
4133fe401a5SEd Maste.Ar
4143fe401a5SEd Masteinto the current directory.
4153fe401a5SEd MasteIf no members have been specified, extract all members of the archive.
4163fe401a5SEd MasteIf the file corresponding to an extracted member does not exist it
4173fe401a5SEd Mastewill be created.
4183fe401a5SEd MasteIf the file corresponding to an extracted member does exist, its owner
4193fe401a5SEd Masteand group will not be changed while its contents will be overwritten
4203fe401a5SEd Masteand its permissions will set to that entered in the archive.
4213fe401a5SEd MasteThe file's access and modification time would be that of the time
4223fe401a5SEd Masteof extraction unless the
4233fe401a5SEd Maste.Fl o
4243fe401a5SEd Masteoption was specified.
4253fe401a5SEd Maste.It Fl z
4263fe401a5SEd MasteThis option is accepted for compatibility with the
4273fe401a5SEd Maste.Tn FreeBSD
4283fe401a5SEd Masteversion of the
4293fe401a5SEd Maste.Nm
4303fe401a5SEd Masteutility, but is ignored.
4313fe401a5SEd Maste.El
4323fe401a5SEd Maste.Ss "MRI Librarian Commands"
4333fe401a5SEd MasteIf the
4343fe401a5SEd Maste.Fl M
4353fe401a5SEd Masteoption is specified, the
4363fe401a5SEd Maste.Nm
4373fe401a5SEd Masteutility will read and execute commands from its standard input.
4383fe401a5SEd MasteIf standard input is a terminal, the
4393fe401a5SEd Maste.Nm
4403fe401a5SEd Masteutility will display the prompt
4413fe401a5SEd Maste.Dq Li "AR >"
4423fe401a5SEd Mastebefore reading a line, and will continue operation even if errors are
4433fe401a5SEd Masteencountered.
4443fe401a5SEd MasteIf standard input is not a terminal, the
4453fe401a5SEd Maste.Nm
4463fe401a5SEd Masteutility will not display a prompt and will terminate execution on
4473fe401a5SEd Masteencountering an error.
4483fe401a5SEd Maste.Pp
4493fe401a5SEd MasteEach input line contains a single command.
4503fe401a5SEd MasteWords in an input line are separated by whitespace characters.
4513fe401a5SEd MasteThe first word of the line is the command, the remaining words are
4523fe401a5SEd Mastethe arguments to the command.
4533fe401a5SEd MasteThe command word may be specified in either case.
4543fe401a5SEd MasteArguments may be separated by commas or blanks.
4553fe401a5SEd Maste.Pp
4563fe401a5SEd MasteEmpty lines are allowed and are ignored.
4573fe401a5SEd MasteLong lines are continued by ending them with the
4583fe401a5SEd Maste.Dq Li +
4593fe401a5SEd Mastecharacter.
4603fe401a5SEd Maste.Pp
4613fe401a5SEd MasteThe
4623fe401a5SEd Maste.Dq Li *
4633fe401a5SEd Masteand
4643fe401a5SEd Maste.Dq Li "\;"
4653fe401a5SEd Mastecharacters start a comment.
4663fe401a5SEd MasteComments extend till the end of the line.
4673fe401a5SEd Maste.Pp
4683fe401a5SEd MasteWhen executing an MRI librarian script the
4693fe401a5SEd Maste.Nm
4703fe401a5SEd Masteutility works on a temporary copy of an archive.
4713fe401a5SEd MasteChanges to the copy are made permanent using the
4723fe401a5SEd Maste.Ic save
4733fe401a5SEd Mastecommand.
4743fe401a5SEd Maste.Pp
4753fe401a5SEd MasteCommands understood by the
4763fe401a5SEd Maste.Nm
4773fe401a5SEd Masteutility are:
4783fe401a5SEd Maste.Bl -tag -width indent
4793fe401a5SEd Maste.It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
4803fe401a5SEd MasteAdd the contents of the archive named by argument
4813fe401a5SEd Maste.Ar archive
4823fe401a5SEd Masteto the current archive.
4833fe401a5SEd MasteIf specific members are named using the arguments
4843fe401a5SEd Maste.Ar member ,
4853fe401a5SEd Mastethen those members are added to the current archive.
4863fe401a5SEd MasteIf no members are specified, the entire contents of the archive
4873fe401a5SEd Masteare added to the current archive.
4883fe401a5SEd Maste.It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
4893fe401a5SEd MasteAdd the files named by arguments
4903fe401a5SEd Maste.Ar member
4913fe401a5SEd Masteto the current archive.
4923fe401a5SEd Maste.It Ic clear
4933fe401a5SEd MasteDiscard all the contents of the current archive.
4943fe401a5SEd Maste.It Ic create Ar archive
4953fe401a5SEd MasteCreate a new archive named by the argument
4963fe401a5SEd Maste.Ar archive ,
4973fe401a5SEd Masteand makes it the current archive.
4983fe401a5SEd MasteIf the named archive already exists, it will be overwritten
4993fe401a5SEd Mastewhen the
5003fe401a5SEd Maste.Ic save
5013fe401a5SEd Mastecommand is issued.
5023fe401a5SEd Maste.It Ic delete Ar module Oo Li , Ar member Oc Ns ...
5033fe401a5SEd MasteDelete the modules named by the arguments
5043fe401a5SEd Maste.Ar member
5053fe401a5SEd Mastefrom the current archive.
5063fe401a5SEd Maste.It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
5073fe401a5SEd MasteList each named module in the archive.
5083fe401a5SEd MasteThe format of the output depends on the verbosity setting set using
5093fe401a5SEd Mastethe
5103fe401a5SEd Maste.Ic verbose
5113fe401a5SEd Mastecommand.
5123fe401a5SEd MasteOutput is sent to standard output, or to the file specified by
5133fe401a5SEd Masteargument
5143fe401a5SEd Maste.Ar outputfile .
5153fe401a5SEd Maste.It Ic end
5163fe401a5SEd MasteExit successfully from the
5173fe401a5SEd Maste.Nm
5183fe401a5SEd Masteutility.
5193fe401a5SEd MasteAny unsaved changes to the current archive will be discarded.
5203fe401a5SEd Maste.It Ic extract Ar member Oo Li , Ar member Oc Ns ...
5213fe401a5SEd MasteExtract the members named by the arguments
5223fe401a5SEd Maste.Ar member
5233fe401a5SEd Mastefrom the current archive.
5243fe401a5SEd Maste.It Ic list
5253fe401a5SEd MasteDisplay the contents of the current archive in verbose style.
5263fe401a5SEd Maste.It Ic open Ar archive
5273fe401a5SEd MasteOpen the archive named by argument
5283fe401a5SEd Maste.Ar archive
5293fe401a5SEd Masteand make it the current archive.
5303fe401a5SEd Maste.It Ic replace Ar member Oo Li , Ar member Oc Ns ...
5313fe401a5SEd MasteReplace named members in the current archive with the files specified
5323fe401a5SEd Masteby arguments
5333fe401a5SEd Maste.Ar member .
5343fe401a5SEd MasteThe files must be present in the current directory and the named
5353fe401a5SEd Mastemodules must already exist in the current archive.
5363fe401a5SEd Maste.It Ic save
5373fe401a5SEd MasteCommit all changes to the current archive.
5383fe401a5SEd Maste.It Ic verbose
5393fe401a5SEd MasteToggle the verbosity of the
5403fe401a5SEd Maste.Ic directory
5413fe401a5SEd Mastecommand.
5423fe401a5SEd Maste.El
5433fe401a5SEd Maste.Sh EXAMPLES
5443fe401a5SEd MasteTo create a new archive
5453fe401a5SEd Maste.Pa ex.a
5463fe401a5SEd Mastecontaining three files
5473fe401a5SEd Maste.Pa ex1.o ,
5483fe401a5SEd Maste.Pa ex2.o
5493fe401a5SEd Masteand
5503fe401a5SEd Maste.Pa ex3.o ,
5513fe401a5SEd Masteuse:
5523fe401a5SEd Maste.Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
5533fe401a5SEd Maste.Pp
5543fe401a5SEd MasteTo add an archive symbol table to an existing archive
5553fe401a5SEd Maste.Pa ex.a ,
5563fe401a5SEd Masteuse:
5573fe401a5SEd Maste.Dl "ar -s ex.a"
5583fe401a5SEd Maste.Pp
5593fe401a5SEd MasteTo delete file
5603fe401a5SEd Maste.Pa ex1.o
5613fe401a5SEd Mastefrom archive
5623fe401a5SEd Maste.Pa ex.a ,
5633fe401a5SEd Masteuse:
5643fe401a5SEd Maste.D1 "ar -d ex.a ex1.o"
5653fe401a5SEd Maste.Pp
5663fe401a5SEd MasteTo verbosely list the contents of archive
5673fe401a5SEd Maste.Pa ex.a ,
5683fe401a5SEd Masteuse:
5693fe401a5SEd Maste.D1 "ar -tv ex.a"
5703fe401a5SEd Maste.Pp
5713fe401a5SEd MasteTo create a new archive
5723fe401a5SEd Maste.Pa ex.a
5733fe401a5SEd Mastecontaining the files
5743fe401a5SEd Maste.Pa ex1.o ,
5753fe401a5SEd Masteand
5763fe401a5SEd Maste.Pa ex2.o ,
5773fe401a5SEd Masteusing MRI librarian commands, use the following script:
5783fe401a5SEd Maste.Bd -literal -offset indent
5793fe401a5SEd Mastecreate ex.a		 * specify the output archive
5803fe401a5SEd Masteaddmod ex1.o ex2.o	 * add modules
5813fe401a5SEd Mastesave			 * save pending changes
5823fe401a5SEd Masteend			 * exit the utility
5833fe401a5SEd Maste.Ed
5843fe401a5SEd Maste.Sh DIAGNOSTICS
5853fe401a5SEd Maste.Ex -std
5863fe401a5SEd Maste.Sh SEE ALSO
5873fe401a5SEd Maste.Xr ld 1 ,
5883fe401a5SEd Maste.Xr ranlib 1 ,
5893fe401a5SEd Maste.Xr archive 3 ,
5903fe401a5SEd Maste.Xr elf 3 ,
5913fe401a5SEd Maste.Xr strftime 3 ,
5923fe401a5SEd Maste.Xr strmode 3 ,
5933fe401a5SEd Maste.Xr ar 5
5943fe401a5SEd Maste.Sh STANDARDS COMPLIANCE
5953fe401a5SEd MasteThe
5963fe401a5SEd Maste.Nm
5973fe401a5SEd Masteutility's support for the
5983fe401a5SEd Maste.Fl a ,
5993fe401a5SEd Maste.Fl b ,
6003fe401a5SEd Maste.Fl c ,
6013fe401a5SEd Maste.Fl i ,
6023fe401a5SEd Maste.Fl m ,
6033fe401a5SEd Maste.Fl p ,
6043fe401a5SEd Maste.Fl q ,
6053fe401a5SEd Maste.Fl r ,
6063fe401a5SEd Maste.Fl s ,
6073fe401a5SEd Maste.Fl t ,
6083fe401a5SEd Maste.Fl u ,
6093fe401a5SEd Maste.Fl v ,
6103fe401a5SEd Maste.Fl C
6113fe401a5SEd Masteand
6123fe401a5SEd Maste.Fl T
6133fe401a5SEd Masteoptions is believed to be compliant with
6143fe401a5SEd Maste.St -p1003.2 .
6153fe401a5SEd Maste.Sh HISTORY
6163fe401a5SEd MasteAn
6173fe401a5SEd Maste.Nm
6183fe401a5SEd Mastecommand first appeared in AT&T UNIX Version 1.
6193fe401a5SEd MasteIn
6203fe401a5SEd Maste.Fx 8.0 ,
6213fe401a5SEd Maste.An Kai Wang Aq Mt kaiw@FreeBSD.org
6223fe401a5SEd Mastereimplemented
6233fe401a5SEd Maste.Nm
6243fe401a5SEd Masteusing the
6253fe401a5SEd Maste.Lb libarchive
6263fe401a5SEd Masteand the
6273fe401a5SEd Maste.Lb libelf .
628