1 .\" Copyright (c) 2007 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
46 .Op Fl a Ar position-after
47 .Op Fl b Ar position-before
49 .Op Fl i Ar position-before
76 .Op Fl a Ar position-after
77 .Op Fl b Ar position-before
81 .Op Fl i Ar position-before
119 utility creates and maintains groups of files combined into an
121 Once an archive has been created, new files can be added to it, and
122 existing files can be extracted, deleted or replaced.
124 Files are named in the archive by their last file name component,
125 so if a file referenced by a path containing a
127 is archived, it will be named by the last component of the path.
128 Similarly when matching paths listed on the command line against
129 file names stored in the archive, only the last component of the
130 path will be compared.
134 is for the creation and maintenance of libraries suitable for use
137 although it is not restricted to this purpose.
140 utility can create and manage an archive symbol table (see
142 used to speed up link editing operations.
143 If a symbol table is present in an archive, it will be
144 kept up-to-date by subsequent operations on the archive.
148 utility is used to add an archive symbol table
149 to an existing archive.
153 utility supports the following options:
154 .Bl -tag -width indent
155 .It Fl a Ar member-after
156 When used with option
158 this option specifies that the archive members specified by
161 are moved to after the archive member named by argument
163 When used with option
165 this option specifies that the files specified by arguments
167 are added after the archive member named by argument
169 .It Fl b Ar member-before
170 When used with option
172 this option specifies that the archive members specified by
175 are moved to before the archive member named by argument
177 When used with option
179 this option specifies that the files specified by arguments
181 are added before the archive member named by argument
184 Suppress the informational message printed when a new archive is
191 Prevent extracted files from replacing like-named files
194 Delete the members named by arguments
196 from the archive specified by argument
198 The archive's symbol table, if present, is updated to reflect
199 the new contents of the archive.
201 When used in combination with the
205 option, insert 0's instead of the real mtime, uid and gid values
206 and 0644 instead of file mode from the members named by arguments
208 This ensures that checksums on the resulting archives are reproducible
209 when member contents are identical.
211 Synonymous with option
213 .It Fl i Ar member-before
214 Synonymous with option
217 This option is accepted but ignored.
219 This option is accepted for compatibility with GNU
223 Move archive members specified by arguments
226 If a position has been specified by one of the
231 options, the members are moved to before or after the specified
233 If no position has been specified, the specified members are moved
234 to the end of the archive.
235 If the archive has a symbol table, it is updated to reflect the
236 new contents of the archive.
238 Read and execute MRI librarian commands from standard input.
239 The commands understood by the
241 utility are described in the section
242 .Sx "MRI Librarian Commands" .
244 Preserve the original modification times of members when extracting
247 Write the contents of the specified archive members named by
251 If no members were specified, the contents of all the files in the
252 archive are written in the order they appear in the archive.
254 Append the files specified by arguments
256 to the archive specified by argument
258 without checking if the files already exist in the archive.
259 The archive symbol table will be updated as needed.
260 If the file specified by the argument
262 does not already exist, a new archive will be created.
264 Replace (add) the files specified by arguments
266 in the archive specified by argument
268 creating the archive if necessary.
269 Replacing existing members will not change the order of members within
271 If a file named in arguments
273 does not exist, existing members in the archive that match that
274 name are not changed.
275 New files are added to the end of the archive unless one of the
282 The archive symbol table, if it exists, is updated to reflect the
283 new state of the archive.
285 Add an archive symbol table (see
287 to the archive specified by argument
293 option alone is equivalent to invoking
296 Do not generate an archive symbol table.
298 List the files specified by arguments
300 in the order in which they appear in the archive, one per line.
301 If no files are specified, all files in the archive are listed.
303 Use only the first fifteen characters of the archive member name or
304 command line file name argument when naming archive members.
306 Conditionally update the archive or extract members.
309 option, files named by arguments
311 will be replaced in the archive if they are newer than their
315 option, the members specified by arguments
317 will be extracted only if they are newer than the corresponding
318 files in the file system.
320 Provide verbose output.
329 gives a file-by-file description of the archive modification being
330 performed, which consists of three white-space separated fields:
331 the option letter, a dash
338 displays the description as above, but the initial letter is an
340 if the file is added to the archive, or an
342 if the file replaces a file already in the archive.
345 option, the name of the file enclosed in
349 characters is written to standard output preceded by a single newline
350 character and followed by two newline characters.
351 The contents of the named file follow the file name.
356 displays eight whitespace separated fields:
357 the file permissions as displayed by
359 decimal user and group IDs separated by a slash (
361 the file size in bytes, the file modification time in
364 .Dq "%b %e %H:%M %Y" ,
365 and the name of the file.
367 Print a version string and exit.
369 Extract archive members specified by arguments
371 into the current directory.
372 If no members have been specified, extract all members of the archive.
373 If the file corresponding to an extracted member does not exist it
375 If the file corresponding to an extracted member does exist, its owner
376 and group will not be changed while its contents will be overwritten
377 and its permissions will set to that entered in the archive.
378 The file's access and modification time would be that of the time
379 of extraction unless the
381 option was specified.
383 This option is accepted but ignored.
385 .Ss "MRI Librarian Commands"
388 option is specified, the
390 utility will read and execute commands from its standard input.
391 If standard input is a terminal, the
393 utility will display the prompt
395 before reading a line, and will continue operation even if errors are
397 If standard input is not a terminal, the
399 utility will not display a prompt and will terminate execution on
400 encountering an error.
402 Each input line contains a single command.
403 Words in an input line are separated by whitespace characters.
404 The first word of the line is the command, the remaining words are
405 the arguments to the command.
406 The command word may be specified in either case.
407 Arguments may be separated by commas or blanks.
409 Empty lines are allowed and are ignored.
410 Long lines are continued by ending them with the
418 characters start a comment.
419 Comments extend till the end of the line.
421 When executing an MRI librarian script the
423 utility works on a temporary copy of an archive.
424 Changes to the copy are made permanent using the
428 Commands understood by the
431 .Bl -tag -width indent
432 .It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
433 Add the contents of the archive named by argument
435 to the current archive.
436 If specific members are named using the arguments
438 then those members are added to the current archive.
439 If no members are specified, the entire contents of the archive
440 are added to the current archive.
441 .It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
442 Add the files named by arguments
444 to the current archive.
446 Discard all the contents of the current archive.
447 .It Ic create Ar archive
448 Create a new archive named by the argument
450 and makes it the current archive.
451 If the named archive already exists, it will be overwritten
455 .It Ic delete Ar module Oo Li , Ar member Oc Ns ...
456 Delete the modules named by the arguments
458 from the current archive.
459 .It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
460 List each named module in the archive.
461 The format of the output depends on the verbosity setting set using
465 Output is sent to standard output, or to the file specified by
469 Exit successfully from the
472 Any unsaved changes to the current archive will be discarded.
473 .It Ic extract Ar member Oo Li , Ar member Oc Ns ...
474 Extract the members named by the arguments
476 from the current archive.
478 Display the contents of the current archive in verbose style.
479 .It Ic open Ar archive
480 Open the archive named by argument
482 and make it the current archive.
483 .It Ic replace Ar member Oo Li , Ar member Oc Ns ...
484 Replace named members in the current archive with the files specified
487 The files must be present in the current directory and the named
488 modules must already exist in the current archive.
490 Commit all changes to the current archive.
492 Toggle the verbosity of the
497 To create a new archive
499 containing three files
505 .Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
507 To add an archive symbol table to an existing archive
517 .D1 "ar -d ex.a ex1.o"
519 To verbosely list the contents of archive
524 To create a new archive
530 using MRI librarian commands, use the following script:
531 .Bd -literal -offset indent
532 create ex.a * specify the output archive
533 addmod ex1.o ex2.o * add modules
534 save * save pending changes
535 end * exit the utility
546 .Sh STANDARDS COMPLIANCE
549 utility's support for the
565 options is believed to be compliant with
570 command first appeared in AT&T UNIX Version 1.
573 .An "Kai Wang" Aq kaiw@FreeBSD.org