From 52827e3ebcd80f634f990030ee697254a0ae517d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 26 Jun 2010 18:21:36 +0200 Subject: *: tar-related cleanups: move struct to unarchive.h; move help to tar.c Signed-off-by: Denys Vlasenko --- include/unarchive.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include/unarchive.h') diff --git a/include/unarchive.h b/include/unarchive.h index f3aa05d09..b4cf16082 100644 --- a/include/unarchive.h +++ b/include/unarchive.h @@ -113,6 +113,39 @@ typedef struct archive_handle_t { #define ARCHIVE_O_TRUNC (1 << 8) +/* POSIX tar Header Block, from POSIX 1003.1-1990 */ +#define TAR_BLOCK_SIZE 512 +#define NAME_SIZE 100 +#define NAME_SIZE_STR "100" +typedef struct tar_header_t { /* byte offset */ + char name[NAME_SIZE]; /* 0-99 */ + char mode[8]; /* 100-107 */ + char uid[8]; /* 108-115 */ + char gid[8]; /* 116-123 */ + char size[12]; /* 124-135 */ + char mtime[12]; /* 136-147 */ + char chksum[8]; /* 148-155 */ + char typeflag; /* 156-156 */ + char linkname[NAME_SIZE]; /* 157-256 */ + /* POSIX: "ustar" NUL "00" */ + /* GNU tar: "ustar " NUL */ + /* Normally it's defined as magic[6] followed by + * version[2], but we put them together to save code. + */ + char magic[8]; /* 257-264 */ + char uname[32]; /* 265-296 */ + char gname[32]; /* 297-328 */ + char devmajor[8]; /* 329-336 */ + char devminor[8]; /* 337-344 */ + char prefix[155]; /* 345-499 */ + char padding[12]; /* 500-512 (pad to exactly TAR_BLOCK_SIZE) */ +} tar_header_t; +struct BUG_tar_header { + char c[sizeof(tar_header_t) == TAR_BLOCK_SIZE ? 1 : -1]; +}; + + + /* Info struct unpackers can fill out to inform users of thing like * timestamps of unpacked files */ typedef struct unpack_info_t { -- cgit v1.2.3