source: freewrt/tools/paxmirabilis/src/ar.h@ 7417b08

freewrt_1_0 freewrt_2_0
Last change on this file since 7417b08 was a569125, checked in by Thorsten Glaser <tg@…>, 14 years ago

even FreeWRT 1.0-stable deserves paxmirabilis-20120216 compiled with LTO ☺

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3981 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/* $MirOS: src/bin/pax/ar.h,v 1.1 2011/08/16 21:32:45 tg Exp $ */
2
3/*-
4 * Copyright (c) 2011 Thorsten Glaser.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31
32/****************************************************
33
34Libraries created by the Unix Archiver and compatible
35with the DEB file format consist of an initial eight-
36octet magic followed by a number of sections, per ar-
37chive member, comprised of a header and a data part.
38
39The magic is "<!arch>\n" (21 3C 61 72 63 68 3E 0A).
40
41Each archive member section (header followed by data)
42is aligned to a multiple of two octets. The magic and
43member header are both of even size, so a padding oc-
44tet "\n" (0Ah) can be appended after the data part of
45that section; an archive always has an even length. A
46header is 60 octets long and structured as follows:
47 +0 char ar_name[16];
48 +16 char ar_mtime[12];
49 +28 char ar_uid[6];
50 +34 char ar_gid[6];
51 +40 char ar_mode[8];
52 +48 char ar_size[10];
53 +58 char ar_magic[2];
54
55All header fields are left-justified and space-padded
56at the end, if necessary. The composition for ar_name
57will be described later. ar_mtime, ar_uid, ar_gid and
58ar_size are the unsigned decimental representation of
59the mtime as time_t, numeric user and group ID values
60and the size of the data part, respectively. ar_mode,
61on the other hand, is the octal representation of its
62Unix file mode (permissions). ar_magic = { 60h, 0Ah }
63
64Archive memeber filenames are basenames, i.e. they do
65not contain a path.
66
67If the filename is not longer than 16 octets and does
68not contain a space, it is stored as ar_name directly
69(although some implementations would trim the part of
70the filename before a ".o" extension). Otherwise, the
71ar_name field consists of the string "#1/" (23 31 2F)
72followed by the length of the filename as decimal un-
73signed integer (again space-padded); the APT archival
74routines only support extended filenames of less than
75300 octets. The actual filename is then stored as the
76first part of the data part consequently incrementing
77ar_size by its length. Since some versions of APT al-
78so support the SYSV property of ending ar_name with a
79slash "/" (2F), on encoding filenames containing them
80should be written as extended filenames; on decoding,
81a trailing slash in ar_name should be ignored. (Note,
82SYSV does not encode filenames that contain spaces as
83extended but BSD ar and APT truncate there then.)
84
85There are no trailers; an archive file ends after its
86last member section (including the padding).
87
88****************************************************/
89
90
91typedef struct {
92 char ar_name[16];
93 char ar_mtime[12];
94 char ar_uid[6];
95 char ar_gid[6];
96 char ar_mode[8];
97 char ar_size[10];
98 char ar_magic[2];
99} HD_AR;
Note: See TracBrowser for help on using the repository browser.