386BSD 0.1 development
[unix-history] / usr / src / usr.bin / cpio / cpioformat.5
CommitLineData
517718ee
WJ
1.\" Copyright 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)cpioformat.5 5.3 (Berkeley) 5/10/91
33.\"
34.Dd May 10, 1991
35.Dt CPIO 5
36.Os
37.Sh NAME
38.Nm cpio
39.Nd format of cpio archive
40.Sh DESCRIPTION
41The header structure, when the
42.Fl c
43option of
44.Xr cpio 1
45is not used, is:
46.Bd -literal -offset indent
47struct {
48 short h_magic,
49 h_dev;
50 ushort h_ino,
51 h_mode,
52 h_uid,
53 h_gid;
54 short h_nlink,
55 h_rdev,
56 h_mtime[2],
57 h_namesize,
58 h_filesize[2];
59 char h_name[h_namesize rounded to word];
60} Hdr;
61.Ed
62.Pp
63When the
64.Fl c
65option is used, the header information is described by:
66.Bd -literal -offset indent
67sscanf(Chdr,"%6o%6o%6o%6o%6o%6o%6o%6o%11lo%6o%11lo%s",
68&Hdr.h_magic, &Hdr.h_dev, &Hdr.h_ino, &Hdr.h_mode,
69&Hdr.h_uid, &Hdr.h_gid, &Hdr.h_nlink, &Hdr.h_rdev,
70&Longtime, &Hdr.h_namesize,&Longfile,Hdr.h_name);
71.Ed
72.Pp
73.Fa Longtime
74and
75.Fa Longfile
76are equivalent to
77.Fa Hdr.h_mtime
78and
79.Fa Hdr.h_filesize ,
80respectively.
81The contents of each file are
82recorded in an element of the array of varying lenght
83structures, archive, together with other items describing
84the file.
85Every instance of
86.Fa h_magic
87contains the constant
88070707 (octal).
89The itimes
90.Fa h_dev
91through
92.Fa h_mtime
93have
94meanings explained in
95.Xr stat 2 .
96The length of the null-terminated path name
97.Fa H_name ,
98icluding the null byte, is
99given by
100.Fa h_namesize .
101.Pp
102The last record of the archive always contains the name
103TRAILER!!!. Special files, directories, and the trailer are
104recorded with
105.Fa H_filesize
106equal to zero.
107.Sh SEE ALSO
108.Xr cpio 1 ,
109.Xr find 1 ,
110.Xr stat 2
111.Sh HISTORY
112A
113.Xr cpio 1
114command appeared in
115.At V .
116This file format is derived from the
117.At V
118sources which were contributed to the public domain by AT&T.