Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (6) — Plan9 1st Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

2l(1)

nm(1)

stat(2)

AR(6)

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 loaders 2l(1) et al.

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:

#defineARMAG "!<arch>\n"
#defineSARMAG 8
 #defineARFMAG "‘\n"
 struct ar_hdr {
charname[16];
chardate[12];
charuid[6];
chargid[6];
charmode[8];
charsize[10];
charfmag[2];
};
#defineSAR_HDR 60

The name is a blank-padded string.  The ­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 mode, which is octal.  The date is the modification date of the file (see stat(2)) at the time of its insertion into the archive. The mode is the low 9 bits of the file permission mode, in octal. 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 headers. 

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

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

SEE ALSO

ar(1), 2l(1), nm(1), stat(2)

BUGS

The ­uid and ­gid fields are unused in Plan 9.  They provide compatibility with Unix ­ar format. 

Plan 9  —  January 03, 1993

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