man(1) Manual page archive


     AR(5)                                                       AR(5)

     NAME
          ar - archive (library) file format

     SYNOPSIS
          #include <ar.h>

     DESCRIPTION
          The archive command ar(1) is used to combine several files
          into one.  Archives are used mainly as libraries to be
          searched by the link-editor ld.

          A file produced by ar has a magic string at the start, fol-
          lowed by the constituent files, each preceded by a file
          header.  The magic number and header layout as described in
          the include file are:

          #define ARMAG   "!<arch>\n"
          #define SARMAG  8

          #define ARFMAG  "`\n"

          struct ar_hdr {
                  char    ar_name[16];
                  char    ar_date[12];
                  char    ar_uid[6];
                  char    ar_gid[6];
                  char    ar_mode[8];
                  char    ar_size[10];
                  char    ar_fmag[2];
          };
          #define SAR_HDR 60

          The name is a blank-padded string.  The `ar_fmag' field con-
          tains `ARFMAG' to help verify the presence of a header.  The
          other fields are left-adjusted, blank-padded numbers.  They
          are decimal except for `ar_mode', which is octal.  The date
          is the modification date of the file at the time of its
          insertion into the archive.  The length of the header is
          `SAR_HDR'.  Because `struct ar_hdr' may be padded on some
          machines, `SAR_HDR' should be used in preference to
          `sizeof(struct ar_hdr)' when reading and writing file head-
          ers.

          Each file begins on an even (0 mod 2) boundary; a newline is
          inserted between files if necessary.  Nevertheless ar_size
          reflects the actual size of the file exclusive of padding.

          There is no provision for empty areas in an archive file.

          If an archive contains only printable files, the archive

     AR(5)                                                       AR(5)

          itself is printable.

     SEE ALSO
          ar(1), ld(1), nm(1)

     BUGS
          File names lose trailing blanks.
          Most software that deals with archives takes an embedded
          blank as a name terminator.