xref: /dflybsd-src/contrib/file/src/tar.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino  * Copyright (c) Ian F. Darwin 1986-1995.
3*86d7f5d3SJohn Marino  * Software written by Ian F. Darwin and others;
4*86d7f5d3SJohn Marino  * maintained 1995-present by Christos Zoulas and others.
5*86d7f5d3SJohn Marino  *
6*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
7*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
8*86d7f5d3SJohn Marino  * are met:
9*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
10*86d7f5d3SJohn Marino  *    notice immediately at the beginning of the file, without modification,
11*86d7f5d3SJohn Marino  *    this list of conditions, and the following disclaimer.
12*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
13*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
14*86d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
15*86d7f5d3SJohn Marino  *
16*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*86d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*86d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*86d7f5d3SJohn Marino  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20*86d7f5d3SJohn Marino  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*86d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*86d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*86d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*86d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*86d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*86d7f5d3SJohn Marino  * SUCH DAMAGE.
27*86d7f5d3SJohn Marino  */
28*86d7f5d3SJohn Marino /*
29*86d7f5d3SJohn Marino  * Header file for public domain tar (tape archive) program.
30*86d7f5d3SJohn Marino  *
31*86d7f5d3SJohn Marino  * @(#)tar.h 1.20 86/10/29	Public Domain.
32*86d7f5d3SJohn Marino  *
33*86d7f5d3SJohn Marino  * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
34*86d7f5d3SJohn Marino  *
35*86d7f5d3SJohn Marino  * $File: tar.h,v 1.13 2010/11/30 14:58:53 rrt Exp $ # checkin only
36*86d7f5d3SJohn Marino  */
37*86d7f5d3SJohn Marino 
38*86d7f5d3SJohn Marino /*
39*86d7f5d3SJohn Marino  * Header block on tape.
40*86d7f5d3SJohn Marino  *
41*86d7f5d3SJohn Marino  * I'm going to use traditional DP naming conventions here.
42*86d7f5d3SJohn Marino  * A "block" is a big chunk of stuff that we do I/O on.
43*86d7f5d3SJohn Marino  * A "record" is a piece of info that we care about.
44*86d7f5d3SJohn Marino  * Typically many "record"s fit into a "block".
45*86d7f5d3SJohn Marino  */
46*86d7f5d3SJohn Marino #define	RECORDSIZE	512
47*86d7f5d3SJohn Marino #define	NAMSIZ	100
48*86d7f5d3SJohn Marino #define	TUNMLEN	32
49*86d7f5d3SJohn Marino #define	TGNMLEN	32
50*86d7f5d3SJohn Marino 
51*86d7f5d3SJohn Marino union record {
52*86d7f5d3SJohn Marino 	unsigned char	charptr[RECORDSIZE];
53*86d7f5d3SJohn Marino 	struct header {
54*86d7f5d3SJohn Marino 		char	name[NAMSIZ];
55*86d7f5d3SJohn Marino 		char	mode[8];
56*86d7f5d3SJohn Marino 		char	uid[8];
57*86d7f5d3SJohn Marino 		char	gid[8];
58*86d7f5d3SJohn Marino 		char	size[12];
59*86d7f5d3SJohn Marino 		char	mtime[12];
60*86d7f5d3SJohn Marino 		char	chksum[8];
61*86d7f5d3SJohn Marino 		char	linkflag;
62*86d7f5d3SJohn Marino 		char	linkname[NAMSIZ];
63*86d7f5d3SJohn Marino 		char	magic[8];
64*86d7f5d3SJohn Marino 		char	uname[TUNMLEN];
65*86d7f5d3SJohn Marino 		char	gname[TGNMLEN];
66*86d7f5d3SJohn Marino 		char	devmajor[8];
67*86d7f5d3SJohn Marino 		char	devminor[8];
68*86d7f5d3SJohn Marino 	} header;
69*86d7f5d3SJohn Marino };
70*86d7f5d3SJohn Marino 
71*86d7f5d3SJohn Marino /* The magic field is filled with this if uname and gname are valid. */
72*86d7f5d3SJohn Marino #define	TMAGIC		"ustar"		/* 5 chars and a null */
73*86d7f5d3SJohn Marino #define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
74