1AR(5)                         File Formats Manual                        AR(5)
2
3
4

NAME

6       ar - archive (library) file format
7

SYNOPSIS

9       #include <ar.h>
10

DESCRIPTION

12       The  archive command ar is used to combine several files into one.  Ar‐
13       chives are used mainly as libraries to be searched by  the  link-editor
14       ld.
15
16       A  file produced by ar has a magic number at the start, followed by the
17       constituent files, each preceded by a file header.   The  magic  number
18       and header layout as described in the include file are:
19
20              /* Header describing `ar' archive file format.
21                 Copyright (C) 1996 Free Software Foundation, Inc.
22                 This file is part of the GNU C Library.
23
24                 The GNU C Library is free software; you can redistribute it and/or
25                 modify it under the terms of the GNU Lesser General Public
26                 License as published by the Free Software Foundation; either
27                 version 2.1 of the License, or (at your option) any later version.
28
29                 The GNU C Library is distributed in the hope that it will be useful,
30                 but WITHOUT ANY WARRANTY; without even the implied warranty of
31                 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32                 Lesser General Public License for more details.
33
34                 You should have received a copy of the GNU Lesser General Public
35                 License along with the GNU C Library; if not, see
36                 <http://www.gnu.org/licenses/>.  */
37
38              #ifndef _AR_H
39              #define _AR_H 1
40
41              #include <sys/cdefs.h>
42
43              /* Archive files start with the ARMAG identifying string.  Then follows a
44                 `struct ar_hdr', and as many bytes of member file data as its `ar_size'
45                 member indicates, for each member file.  */
46
47              #define ARMAG "!<arch>0/* String that begins an archive file.  */
48              #define SARMAG8/* Size of that string.  */
49
50              #define ARFMAG"`0/* String in ar_fmag at end of each header.  */
51
52              __BEGIN_DECLS
53
54              struct ar_hdr
55                {
56                  char ar_name[16];/* Member file name, sometimes / terminated. */
57                  char ar_date[12];/* File date, decimal seconds since Epoch.  */
58                  char ar_uid[6], ar_gid[6];/* User and group IDs, in ASCII decimal.  */
59                  char ar_mode[8];/* File mode, in ASCII octal.  */
60                  char ar_size[10];/* File size, in ASCII decimal.  */
61                  char ar_fmag[2];/* Always contains ARFMAG.  */
62                };
63
64              __END_DECLS
65
66              #endif /* ar.h */
67
68       The  name  is  a  null-terminated  string;  the  date is in the form of
69       time(2); the user ID and group ID are numbers; the mode is a  bit  pat‐
70       tern per chmod(2); the size is counted in bytes.
71
72       Each  file  begins  on a word boundary; a null byte is inserted between
73       files if necessary.  Nevertheless the size given  reflects  the  actual
74       size of the file exclusive of padding.
75
76       Notice there is no provision for empty areas in an archive file.
77

SEE ALSO

79       ar(1), ld(1), nm(1)
80

BUGS

82       Coding user and group IDs as characters is a botch.
83
84
85
86                                                                         AR(5)
Impressum