]>
Commit | Line | Data |
---|---|---|
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 | 17 | #include <apt-pkg/fileutl.h> |
b2e465d6 | 18 | |
472ff00e DK |
19 | #include <string> |
20 | ||
a4f6bdc8 | 21 | #ifndef APT_8_CLEANER_HEADERS |
b9dadc24 DK |
22 | #include <apt-pkg/dirstream.h> |
23 | #include <algorithm> | |
a4f6bdc8 DK |
24 | using std::min; |
25 | #endif | |
26 | ||
472ff00e | 27 | class pkgDirStream; |
42ab8223 | 28 | |
b2e465d6 AL |
29 | class ExtractTar |
30 | { | |
31 | protected: | |
32 | ||
33 | struct TarHeader; | |
34 | ||
35 | // The varios types items can be | |
36 | enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1', | |
37 | SymbolicLink = '2',CharacterDevice = '3', | |
38 | BlockDevice = '4',Directory = '5',FIFO = '6', | |
39 | GNU_LongLink = 'K',GNU_LongName = 'L'}; | |
40 | ||
41 | FileFd &File; | |
42 | unsigned long MaxInSize; | |
43 | int GZPid; | |
44 | FileFd InFd; | |
45 | bool Eof; | |
8f3ba4e8 | 46 | std::string DecompressProg; |
b2e465d6 AL |
47 | |
48 | // Fork and reap gzip | |
49 | bool StartGzip(); | |
50 | bool Done(bool Force); | |
51 | ||
52 | public: | |
53 | ||
54 | bool Go(pkgDirStream &Stream); | |
55 | ||
8f3ba4e8 | 56 | ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram); |
b2e465d6 AL |
57 | virtual ~ExtractTar(); |
58 | }; | |
59 | ||
60 | #endif |