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