extracttar.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: extracttar.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
  4. /* ######################################################################
  5. Extract a Tar - Tar Extractor
  6. The tar extractor takes an ordinary gzip compressed tar stream from
  7. the given file and explodes it, passing the individual items to the
  8. given Directory Stream for processing.
  9. ##################################################################### */
  10. /*}}}*/
  11. #ifndef PKGLIB_EXTRACTTAR_H
  12. #define PKGLIB_EXTRACTTAR_H
  13. #ifdef __GNUG__
  14. #pragma interface "apt-pkg/extracttar.h"
  15. #endif
  16. #include <apt-pkg/fileutl.h>
  17. #include <apt-pkg/dirstream.h>
  18. class ExtractTar
  19. {
  20. protected:
  21. struct TarHeader;
  22. // The varios types items can be
  23. enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
  24. SymbolicLink = '2',CharacterDevice = '3',
  25. BlockDevice = '4',Directory = '5',FIFO = '6',
  26. GNU_LongLink = 'K',GNU_LongName = 'L'};
  27. FileFd &File;
  28. unsigned long MaxInSize;
  29. int GZPid;
  30. FileFd InFd;
  31. bool Eof;
  32. // Fork and reap gzip
  33. bool StartGzip();
  34. bool Done(bool Force);
  35. public:
  36. bool Go(pkgDirStream &Stream);
  37. ExtractTar(FileFd &Fd,unsigned long Max);
  38. virtual ~ExtractTar();
  39. };
  40. #endif