AR(5) — UNIX Programmer’s Manual
NAME
ar − archive (library) file format
SYNOPSIS
#include <ar.h>
DESCRIPTION
The archive command ar 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 number 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:
#defineARMAG0177545
structar_hdr {
charar_name[14];
longar_date;
charar_uid;
charar_gid;
intar_mode;
longar_size;
};
The name is a null-terminated string; the date is in the form of time(2); the user ID and group ID are numbers; the mode is a bit pattern per chmod(2); the size is counted in bytes.
Each file begins on a word boundary; a null byte is inserted between files if necessary. Nevertheless the size given reflects the actual size of the file exclusive of padding.
Notice there is no provision for empty areas in an archive file.
SEE ALSO
BUGS
Coding user and group IDs as characters is a botch.
7th Edition