Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ar(5) — UTek 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

arcv(1)

ld(1)

make(1)

nm(1)

ranlib(1)

fgetarhdr(3c)

getarhdr(3c)

oldar(5)



AR(5)                   COMMAND REFERENCE                   AR(5)



NAME
     ar - archive (library) file format

SYNOPSIS
     #include <ar.h>

DESCRIPTION
     The archive command ar combines 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,
     followed by the constituent files, each preceded by a file
     header.  The magic number and header layout as described in
     the include file are:

          /*
           * AR.H - ASCII archive header definitions.
           *
           * Modifications from Berkeley 4.2 BSD
           * Copyright (c) 1983, Tektronix Inc.
           * All Rights Reserved
           *
           */

          /*
           * Note that the header format has changed. It is no longer fixed-format.
           * See the manual page for ar(5) for
           * information on the new archive format.
           */

          #include <sys/max.h>
          #define ARMAG  "!<arch>\n"/* Short format magic number.*/
          #define LARMAG "!<ARCH>\n"/* Long format magic number.*/
          #define SARMAG 8

          #define ARFMAG "`\n"

          struct ar_hdr {
                  char   ar_name[MAXNAMLEN + 1];
                  char   ar_date[12];
                  char   ar_uid[6];
                  char   ar_gid[6];
                  char   ar_mode[8];
                  char   ar_size[10];
                  char   ar_fmag[2];
          };

          /*
           * sar_hdr is the short archive header format (name <= 16 chars)
           * SARNAMLEN is the length of the name field for the short archive
           * header.



Printed 5/12/88                                                 1





AR(5)                   COMMAND REFERENCE                   AR(5)



           */

          #define SARNAMLEN 16

          struct sar_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];
          };

     In this system, the name may be either a blank-padded string
     of up to 15 characters stored in a 16 character field, or a
     string of up to MAXNAMLEN characters surrounded by slashes.
     If the name has an odd number of characters, an extra slash
     is added in order to keep the size of the header even.

     The command ar will keep the archive in short format (where
     the magic string is ``!<arch>'') unless the name of any one
     of the archive member names is longer than 15 characters.
     When this happens, the magic string is changed to
     ``!<ARCH>''.

     In order to make it easier to modify programs which use the
     old archive format, the old format structure is provided.

     The ar_fmag field contains 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.

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

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

     The encoding of the header is portable across machines.  If
     an archive contains printable files, the archive itself is
     printable.

CAVEATS
     File names with less than 15 characters lose trailing
     blanks.

     Programs that work with this archive format will not work
     with the old archive files. See oldar(5) for a description



Printed 5/12/88                                                 2





AR(5)                   COMMAND REFERENCE                   AR(5)



     of the old archive format, and use arcv(1) to convert old
     archive files to the new format.

     Since the archive headers are of variable size, it is no
     longer possible to read in the archive header using read(2)
     or fread(3s). The subroutines fgetarhdr(3c) and getarhdr(3c)
     are supplied for the purpose of reading archive headers.

     Long format archives are not portable to other versions of
     the UNIX operating system.  See the manual page for ar(1)
     for a way to convert long format archives to short format,
     which is portable.

SEE ALSO
     ar(1), arcv(1), ld(1), make(1), nm(1), ranlib(1),
     fgetarhdr(3c), getarhdr(3c), and oldar(5).







































Printed 5/12/88                                                 3





































































%%index%%
na:192,86;
sy:278,251;
de:529,1719;2512,1835;
ca:4347,290;4901,656;
se:5557,324;
%%index%%000000000114

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026