]> Dogcows Code - chaz/tar/blobdiff - src/tar.h
(decode_header): Added initial support for POSIX extended
[chaz/tar] / src / tar.h
index 25132ffdaa6b7bc50f9cef06db50cd26ebe14c77..5aa0a489bb56d998e4d16af0b90c9b605038cef3 100644 (file)
--- a/src/tar.h
+++ b/src/tar.h
@@ -1,5 +1,7 @@
-/* Format of tar archives.
-   Copyright (C) 1988, 92, 93, 94, 96, 97 Free Software Foundation, Inc.
+/* GNU tar Archive Format description.
+
+   Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+   2000, 2001, 2003 Free Software Foundation, Inc.
 
    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
@@ -15,8 +17,6 @@
    with this program; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* GNU tar Archive Format description.  */
-
 /* If OLDGNU_COMPATIBILITY is not zero, tar produces archives which, by
    default, are readable by older versions of GNU tar.  This can be
    overriden by using --posix; in this case, POSIXLY_CORRECT in environment
@@ -28,9 +28,7 @@
    This #define will disappear in a few years.  FP, June 1995.  */
 #define OLDGNU_COMPATIBILITY 1
 
-/*---------------------------------------------.
-| `tar' Header Block, from POSIX 1003.1-1990.  |
-`---------------------------------------------*/
+/* tar Header Block, from POSIX 1003.1-1990.  */
 
 /* POSIX header.  */
 
@@ -55,6 +53,29 @@ struct posix_header
                                /* 500 */
 };
 
+struct star_header
+{                              /* byte offset */
+  char name[100];              /*   0 */
+  char mode[8];                        /* 100 */
+  char uid[8];                 /* 108 */
+  char gid[8];                 /* 116 */
+  char size[12];               /* 124 */
+  char mtime[12];              /* 136 */
+  char chksum[8];              /* 148 */
+  char typeflag;               /* 156 */
+  char linkname[100];          /* 157 */
+  char magic[6];               /* 257 */
+  char version[2];             /* 263 */
+  char uname[32];              /* 265 */
+  char gname[32];              /* 297 */
+  char devmajor[8];            /* 329 */
+  char devminor[8];            /* 337 */
+  char prefix[131];            /* 345 */
+  char atime[12];               /* 476 */
+  char ctime[12];               /* 488 */
+                                /* 500 */
+};
+
 #define TMAGIC   "ustar"       /* ustar and a null */
 #define TMAGLEN  6
 #define TVERSION "00"          /* 00 and no null */
@@ -71,6 +92,10 @@ struct posix_header
 #define FIFOTYPE '6'           /* FIFO special */
 #define CONTTYPE '7'           /* reserved */
 
+#define XHDTYPE  'x'            /* Extended header referring to the
+                                  next file in the archive */
+#define XGLTYPE  'g'            /* Global extended header */
+
 /* Bits used in the mode field, values in octal.  */
 #define TSUID    04000         /* set UID on execution */
 #define TSGID    02000         /* set GID on execution */
@@ -86,9 +111,7 @@ struct posix_header
 #define TOWRITE  00002         /* write by other */
 #define TOEXEC   00001         /* execute/search by other */
 
-/*-------------------------------------.
-| `tar' Header Block, GNU extensions.  |
-`-------------------------------------*/
+/* tar Header Block, GNU extensions.  */
 
 /* In GNU tar, SYMTYPE is for to symbolic links, and CONTTYPE is for
    contiguous files, so maybe disobeying the `reserved' comment in POSIX
@@ -189,7 +212,12 @@ struct oldgnu_header
 #define OLDGNU_MAGIC "ustar  " /* 7 chars and a null */
 
 /* The standards committee allows only capital A through capital Z for
-   user-defined expansion.  */
+   user-defined expansion.  Other letters in use include:
+
+   'A' Solaris Access Control List
+   'E' Solaris Extended Attribute File
+   'I' Inode only, as in 'star'
+   'X' POSIX 1003.1-2001 eXtended (VU version)  */
 
 /* This is a dir entry that contains the names of files that were in the
    dir at the time the dump was made.  */
@@ -213,9 +241,7 @@ struct oldgnu_header
 /* This file is a tape/volume header.  Ignore it on extraction.  */
 #define GNUTYPE_VOLHDR 'V'
 
-/*--------------------------------------.
-| tar Header Block, overall structure.  |
-`--------------------------------------*/
+/* tar Header Block, overall structure.  */
 
 /* tar files are made in basic blocks of this size.  */
 #define BLOCKSIZE 512
@@ -226,13 +252,31 @@ enum archive_format
   V7_FORMAT,                   /* old V7 tar format */
   OLDGNU_FORMAT,               /* GNU format as per before tar 1.12 */
   POSIX_FORMAT,                        /* restricted, pure POSIX format */
+  STAR_FORMAT,                  /* Star format defined in 1994 */
   GNU_FORMAT                   /* POSIX format with GNU extensions */
 };
 
+struct tar_stat_info
+{
+  char *orig_file_name;     /* name of file read from the archive header */
+  char *file_name;          /* name of file for the current archive entry
+                              after being normalized.  */
+  int had_trailing_slash;   /* nonzero if the current archive entry had a
+                              trailing slash before it was normalized. */
+  char *link_name;          /* name of link for the current archive entry.  */
+
+  unsigned int  devminor;   /* device minor number */
+  unsigned int  devmajor;   /* device major number */
+  char          *uname;     /* user name of owner */
+  char          *gname;     /* group name of owner */
+  struct stat   stat;       /* regular filesystem stat */ 
+};
+
 union block
 {
   char buffer[BLOCKSIZE];
   struct posix_header header;
+  struct star_header star_header;
   struct extra_header extra_header;
   struct oldgnu_header oldgnu_header;
   struct sparse_header sparse_header;
This page took 0.024052 seconds and 4 git commands to generate.