]> git.saurik.com Git - apt.git/blame - apt-inst/contrib/extracttar.h
[ David Kalnischkies ]
[apt.git] / apt-inst / contrib / extracttar.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: extracttar.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4/* ######################################################################
5
6 Extract a Tar - Tar Extractor
7
8 The tar extractor takes an ordinary gzip compressed tar stream from
9 the given file and explodes it, passing the individual items to the
10 given Directory Stream for processing.
11
12 ##################################################################### */
13 /*}}}*/
14#ifndef PKGLIB_EXTRACTTAR_H
15#define PKGLIB_EXTRACTTAR_H
16
b2e465d6
AL
17#include <apt-pkg/fileutl.h>
18#include <apt-pkg/dirstream.h>
19
42ab8223
MV
20#include <algorithm>
21
22using std::min;
23
b2e465d6
AL
24class ExtractTar
25{
26 protected:
27
28 struct TarHeader;
29
30 // The varios types items can be
31 enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
32 SymbolicLink = '2',CharacterDevice = '3',
33 BlockDevice = '4',Directory = '5',FIFO = '6',
34 GNU_LongLink = 'K',GNU_LongName = 'L'};
35
36 FileFd &File;
37 unsigned long MaxInSize;
38 int GZPid;
39 FileFd InFd;
40 bool Eof;
b3d44315 41 string DecompressProg;
b2e465d6
AL
42
43 // Fork and reap gzip
44 bool StartGzip();
45 bool Done(bool Force);
46
47 public:
48
49 bool Go(pkgDirStream &Stream);
50
b3d44315 51 ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
b2e465d6
AL
52 virtual ~ExtractTar();
53};
54
55#endif