File: format.h

package info (click to toggle)
tardy 1.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,604 kB
  • ctags: 1,015
  • sloc: cpp: 9,530; sh: 4,241; makefile: 724; awk: 44
file content (106 lines) | stat: -rw-r--r-- 2,922 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 *	tardy - a tar post-processor
 *	Copyright (C) 1998, 1999, 2002, 2003 Peter Miller;
 *	All rights reserved.
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 *
 * MANIFEST: interface definition for common/tar/format.cc
 */

#ifndef COMMON_TAR_FORMAT_H
#define COMMON_TAR_FORMAT_H

#include <rcstring.h>

#define TBLOCK 512
#define NAMSIZ 100

/*
 * The magic field is filled with this if uname and gname are valid.
 */
#define	TMAGIC		"ustar  "	/* 7 chars and a null */

/*
 * The linkflag defines the type of file
 */
#define	LF_OLDNORMAL	'\0'		/* Normal disk file, Unix compat */
#define	LF_NORMAL	'0'		/* Normal disk file */
#define	LF_LINK		'1'		/* Link to previously dumped file */
#define	LF_SYMLINK	'2'		/* Symbolic link */
#define	LF_CHR		'3'		/* Character special file */
#define	LF_BLK		'4'		/* Block special file */
#define	LF_DIR		'5'		/* Directory */
#define	LF_FIFO		'6'		/* FIFO special file */
#define	LF_CONTIG	'7'		/* Contiguous file */
#define LF_LONGNAME	'L'		/* File is actually long name
					 * for next file in the archive. */
#define LF_LONGLINK	'K'		/* File is actually long link
					 * for next file in the archive. */
#define LF_GZIPPED	'z'		/* Flags that the next file in the
					 * archive is gzipped. */
/* Further link types may be defined later. */


class header_ty
{
	public:
	char	name[NAMSIZ];
	char	mode[8];
	char	uid[8];
	char	gid[8];
	char	size[12];
	char	mtime[12];
	char	chksum[8];
	char	linkflag;
	char	linkname[NAMSIZ];
	char	magic[8];
	char	uname[32];
	char	gname[32];
	char	devmajor[8];
	char	devminor[8];

	rcstring name_get();
	void name_set(const rcstring &);
	long mode_get();
	void mode_set(long);
	long uid_get();
	void uid_set(long);
	long gid_get();
	void gid_set(long);
	long size_get();
	void size_set(long);
	long mtime_get();
	void mtime_set(long);
	long chksum_get();
	void chksum_set(long);
	int linkflag_get();
	void linkflag_set(int);
	rcstring linkname_get();
	void linkname_set(const rcstring &);
	rcstring uname_get();
	void uname_set(const rcstring &);
	rcstring gname_get();
	void gname_set(const rcstring &);
	long devmajor_get();
	void devmajor_set(long);
	long devminor_get();
	void devminor_set(long);

	long calculate_checksum();
	void dump();
};

#endif /* COMMON_TAR_FORMAT_H */