1 .\" Copyright (c) 2007,2009-2012 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed. in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
24 .\" $Id: ar.1 3230 2015-07-27 17:11:38Z emaste $
45 .Op Fl a Ar position-after
46 .Op Fl b Ar position-before
48 .Op Fl i Ar position-before
67 .Op Fl F Ar flavor | Fl -flavor Ar flavor
77 .Op Fl a Ar position-after
78 .Op Fl b Ar position-before
82 .Op Fl F Ar flavor | Fl -flavor Ar flavor
83 .Op Fl i Ar position-before
123 utility creates and maintains groups of files combined into an
125 Once an archive has been created, new files can be added to it, and
126 existing files can be extracted, deleted or replaced.
128 Files are named in the archive by their last file name component,
129 so if a file referenced by a path containing a
131 is archived, it will be named by the last component of the path.
132 Similarly when matching paths listed on the command line against
133 file names stored in the archive, only the last component of the
134 path will be compared.
138 is for the creation and maintenance of libraries suitable for use
141 although it is not restricted to this purpose.
144 utility can create and manage an archive symbol table (see
146 used to speed up link editing operations.
147 If a symbol table is present in an archive, it will be
148 kept up-to-date by subsequent operations on the archive.
152 utility supports the following options:
153 .Bl -tag -width indent
154 .It Fl a Ar member-after
155 When used with option
157 this option specifies that the archive members specified by
160 are moved to after the archive member named by argument
162 When used with option
164 this option specifies that the files specified by arguments
166 are added after the archive member named by argument
168 .It Fl b Ar member-before
169 When used with option
171 this option specifies that the archive members specified by
174 are moved to before the archive member named by argument
176 When used with option
178 this option specifies that the files specified by arguments
180 are added before the archive member named by argument
183 Suppress the informational message printed when a new archive is
190 Prevent extracted files from replacing like-named files
193 Delete the members named by arguments
195 from the archive specified by argument
197 The archive's symbol table, if present, is updated to reflect
198 the new contents of the archive.
200 When used in combination with the
204 option, insert 0's instead of the real mtime, uid and gid values
205 and 0644 instead of file mode from the members named by arguments
207 This ensures that checksums on the resulting archives are reproducible
208 when member contents are identical.
213 options are specified on the command line, the final one takes precedence.
215 Synonymous with option
217 .It Fl F Ar flavor | Fl -flavor Ar flavor
218 Create archives with the specified archive format.
219 Legal values for argument
222 .Bl -tag -width indent -compact
224 Create BSD format archives.
229 Create SVR4 format archives.
231 If this option is not specified,
233 will create archives using the SVR4 format.
234 .It Fl i Ar member-before
235 Synonymous with option
238 This option is accepted for compatibility with the
242 utility, but is ignored.
244 This option is accepted for compatibility with GNU
248 Move archive members specified by arguments
251 If a position has been specified by one of the
256 options, the members are moved to before or after the specified
258 If no position has been specified, the specified members are moved
259 to the end of the archive.
260 If the archive has a symbol table, it is updated to reflect the
261 new contents of the archive.
263 Read and execute MRI librarian commands from standard input.
264 The commands understood by the
266 utility are described in the section
267 .Sx "MRI Librarian Commands" .
269 Preserve the original modification times of members when extracting
272 Write the contents of the specified archive members named by
276 If no members were specified, the contents of all the files in the
277 archive are written in the order they appear in the archive.
279 Append the files specified by arguments
281 to the archive specified by argument
283 without checking if the files already exist in the archive.
284 The archive symbol table will be updated as needed.
285 If the file specified by the argument
287 does not already exist, a new archive will be created.
289 Replace (add) the files specified by arguments
291 in the archive specified by argument
293 creating the archive if necessary.
294 Replacing existing members will not change the order of members within
296 If a file named in arguments
298 does not exist, existing members in the archive that match that
299 name are not changed.
300 New files are added to the end of the archive unless one of the
307 The archive symbol table, if it exists, is updated to reflect the
308 new state of the archive.
310 Add an archive symbol table (see
312 to the archive specified by argument
318 option alone is equivalent to invoking
321 Do not generate an archive symbol table.
325 list the files specified by arguments
327 in the order in which they appear in the archive, one per line.
328 If no files are specified, all files in the archive are listed.
330 Use only the first fifteen characters of the archive member name or
331 command line file name argument when naming archive members.
333 Conditionally update the archive or extract members.
336 option, files named by arguments
338 will be replaced in the archive if they are newer than their
342 option, the members specified by arguments
344 will be extracted only if they are newer than the corresponding
345 files in the file system.
347 When used in combination with the
351 option, insert the real mtime, uid and gid, and file mode values
352 from the members named by arguments
358 options are specified on the command line, the final one takes precedence.
360 Provide verbose output.
369 gives a file-by-file description of the archive modification being
370 performed, which consists of three white-space separated fields:
371 the option letter, a dash
378 displays the description as above, but the initial letter is an
380 if the file is added to the archive, or an
382 if the file replaces a file already in the archive.
385 option, the name of the file enclosed in
389 characters is written to standard output preceded by a single newline
390 character and followed by two newline characters.
391 The contents of the named file follow the file name.
396 displays eight whitespace separated fields:
397 the file permissions as displayed by
399 decimal user and group IDs separated by a slash (
401 the file size in bytes, the file modification time in
404 .Dq "%b %e %H:%M %Y" ,
405 and the name of the file.
407 Print a version identifier and exit.
409 Extract archive members specified by arguments
411 into the current directory.
412 If no members have been specified, extract all members of the archive.
413 If the file corresponding to an extracted member does not exist it
415 If the file corresponding to an extracted member does exist, its owner
416 and group will not be changed while its contents will be overwritten
417 and its permissions will set to that entered in the archive.
418 The file's access and modification time would be that of the time
419 of extraction unless the
421 option was specified.
423 This option is accepted for compatibility with the
427 utility, but is ignored.
429 .Ss "MRI Librarian Commands"
432 option is specified, the
434 utility will read and execute commands from its standard input.
435 If standard input is a terminal, the
437 utility will display the prompt
439 before reading a line, and will continue operation even if errors are
441 If standard input is not a terminal, the
443 utility will not display a prompt and will terminate execution on
444 encountering an error.
446 Each input line contains a single command.
447 Words in an input line are separated by whitespace characters.
448 The first word of the line is the command, the remaining words are
449 the arguments to the command.
450 The command word may be specified in either case.
451 Arguments may be separated by commas or blanks.
453 Empty lines are allowed and are ignored.
454 Long lines are continued by ending them with the
462 characters start a comment.
463 Comments extend till the end of the line.
465 When executing an MRI librarian script the
467 utility works on a temporary copy of an archive.
468 Changes to the copy are made permanent using the
472 Commands understood by the
475 .Bl -tag -width indent
476 .It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
477 Add the contents of the archive named by argument
479 to the current archive.
480 If specific members are named using the arguments
482 then those members are added to the current archive.
483 If no members are specified, the entire contents of the archive
484 are added to the current archive.
485 .It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
486 Add the files named by arguments
488 to the current archive.
490 Discard all the contents of the current archive.
491 .It Ic create Ar archive
492 Create a new archive named by the argument
494 and makes it the current archive.
495 If the named archive already exists, it will be overwritten
499 .It Ic delete Ar module Oo Li , Ar member Oc Ns ...
500 Delete the modules named by the arguments
502 from the current archive.
503 .It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
504 List each named module in the archive.
505 The format of the output depends on the verbosity setting set using
509 Output is sent to standard output, or to the file specified by
513 Exit successfully from the
516 Any unsaved changes to the current archive will be discarded.
517 .It Ic extract Ar member Oo Li , Ar member Oc Ns ...
518 Extract the members named by the arguments
520 from the current archive.
522 Display the contents of the current archive in verbose style.
523 .It Ic open Ar archive
524 Open the archive named by argument
526 and make it the current archive.
527 .It Ic replace Ar member Oo Li , Ar member Oc Ns ...
528 Replace named members in the current archive with the files specified
531 The files must be present in the current directory and the named
532 modules must already exist in the current archive.
534 Commit all changes to the current archive.
536 Toggle the verbosity of the
541 To create a new archive
543 containing three files
549 .Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
551 To add an archive symbol table to an existing archive
561 .D1 "ar -d ex.a ex1.o"
563 To verbosely list the contents of archive
568 To create a new archive
574 using MRI librarian commands, use the following script:
575 .Bd -literal -offset indent
576 create ex.a * specify the output archive
577 addmod ex1.o ex2.o * add modules
578 save * save pending changes
579 end * exit the utility
591 .Sh STANDARDS COMPLIANCE
594 utility's support for the
610 options is believed to be compliant with
615 command first appeared in AT&T UNIX Version 1.
618 .An Kai Wang Aq Mt kaiw@FreeBSD.org