mc.sh & mc.csh creation fixed...
[midnight-commander.git] / vfs / tar.h
blobac7da69481d2f62ac483032d8eb72d15e1869965
1 /* Declarations for the tarfs.
2 Copyright (C) 1995 The Free Software Foundation
4 Written by: 1995 Jakub Jelinek
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #if 0
21 #include "testpad.h"
22 #else
23 #define NEEDPAD
24 #endif
26 #include <sys/types.h>
28 /* major() and minor() macros (among other things) defined here for hpux */
29 #ifdef hpux
30 #include <sys/mknod.h>
31 #endif
34 * Header block on tape.
36 * I'm going to use traditional DP naming conventions here.
37 * A "block" is a big chunk of stuff that we do I/O on.
38 * A "record" is a piece of info that we care about.
39 * Typically many "record"s fit into a "block".
41 #define RECORDSIZE 512
42 #define NAMSIZ 100
43 #define TUNMLEN 32
44 #define TGNMLEN 32
45 #define SPARSE_EXT_HDR 21
46 #define SPARSE_IN_HDR 4
48 struct sparse {
49 char offset[12];
50 char numbytes[12];
53 struct sp_array {
54 int offset;
55 int numbytes;
58 union record {
59 char charptr[RECORDSIZE];
60 struct header {
61 char arch_name[NAMSIZ];
62 char mode[8];
63 char uid[8];
64 char gid[8];
65 char size[12];
66 char mtime[12];
67 char chksum[8];
68 char linkflag;
69 char arch_linkname[NAMSIZ];
70 char magic[8];
71 char uname[TUNMLEN];
72 char gname[TGNMLEN];
73 char devmajor[8];
74 char devminor[8];
75 /* these following fields were added by JF for gnu */
76 /* and are NOT standard */
77 char atime[12];
78 char ctime[12];
79 char offset[12];
80 char longnames[4];
81 #ifdef NEEDPAD
82 char pad;
83 #endif
84 struct sparse sp[SPARSE_IN_HDR];
85 char isextended;
86 char realsize[12]; /* true size of the sparse file */
87 /* char ending_blanks[12];*//* number of nulls at the
88 end of the file, if any */
89 } header;
90 struct extended_header {
91 struct sparse sp[21];
92 char isextended;
93 } ext_hdr;
96 /* The checksum field is filled with this while the checksum is computed. */
97 #define CHKBLANKS " " /* 8 blanks, no null */
99 /* The magic field is filled with this if uname and gname are valid. */
100 #define TMAGIC "ustar " /* 7 chars and a null */
102 /* The linkflag defines the type of file */
103 #define LF_OLDNORMAL '\0' /* Normal disk file, Unix compat */
104 #define LF_NORMAL '0' /* Normal disk file */
105 #define LF_LINK '1' /* Link to previously dumped file */
106 #define LF_SYMLINK '2' /* Symbolic link */
107 #define LF_CHR '3' /* Character special file */
108 #define LF_BLK '4' /* Block special file */
109 #define LF_DIR '5' /* Directory */
110 #define LF_FIFO '6' /* FIFO special file */
111 #define LF_CONTIG '7' /* Contiguous file */
112 /* Further link types may be defined later. */
114 /* Note that the standards committee allows only capital A through
115 capital Z for user-defined expansion. This means that defining something
116 as, say '8' is a *bad* idea. */
117 #define LF_DUMPDIR 'D' /* This is a dir entry that contains
118 the names of files that were in
119 the dir at the time the dump
120 was made */
121 #define LF_LONGLINK 'K' /* Identifies the NEXT file on the tape
122 as having a long linkname */
123 #define LF_LONGNAME 'L' /* Identifies the NEXT file on the tape
124 as having a long name. */
125 #define LF_MULTIVOL 'M' /* This is the continuation
126 of a file that began on another
127 volume */
128 #define LF_NAMES 'N' /* For storing filenames that didn't
129 fit in 100 characters */
130 #define LF_SPARSE 'S' /* This is for sparse files */
131 #define LF_VOLHDR 'V' /* This file is a tape/volume header */
132 /* Ignore it on extraction */
135 * Exit codes from the "tar" program
137 #define EX_SUCCESS 0 /* success! */
138 #define EX_ARGSBAD 1 /* invalid args */
139 #define EX_BADFILE 2 /* invalid filename */
140 #define EX_BADARCH 3 /* bad archive */
141 #define EX_SYSTEM 4 /* system gave unexpected error */
142 #define EX_BADVOL 5 /* Special error code means
143 Tape volume doesn't match the one
144 specified on the command line */
147 * We default to Unix Standard format rather than 4.2BSD tar format.
148 * The code can actually produce all three:
149 * f_standard ANSI standard
150 * f_oldarch V7
151 * neither 4.2BSD
152 * but we don't bother, since 4.2BSD can read ANSI standard format anyway.
153 * The only advantage to the "neither" option is that we can cmp our
154 * output to the output of 4.2BSD tar, for debugging.
156 #define f_standard (!f_oldarch)