]>
git.saurik.com Git - apt.git/blob - ftparchive/multicompress.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: multicompress.h,v 1.2 2001/02/20 07:03:18 jgg Exp $
4 /* ######################################################################
8 Multiple output class. Takes a single FILE* and writes it simultaneously
9 to many compressed files. Then checks if the resulting output is
10 different from any previous output and overwrites the old files. Care is
11 taken to ensure that the new files are not generally readable while they
14 ##################################################################### */
16 #ifndef MULTICOMPRESS_H
17 #define MULTICOMPRESS_H
22 #include <apt-pkg/fileutl.h>
24 #include <sys/types.h>
28 // Enumeration of all supported compressors
32 const char *Extension
;
35 const char *UnCompArgs
;
43 const CompType
*CompressProg
;
54 static const CompType Compressors
[];
56 bool OpenCompress(const CompType
*Prog
,pid_t
&Pid
,int const &FileFd
,
57 int &OutFd
,bool const &Comp
);
58 bool Child(int const &Fd
);
64 // The FD to write to for compression.
66 unsigned long UpdateMTime
;
68 bool Finalize(unsigned long &OutSize
);
69 bool OpenOld(int &Fd
,pid_t
&Proc
);
70 bool CloseOld(int Fd
,pid_t Proc
);
71 static bool GetStat(string
const &Output
,string
const &Compress
,struct stat
&St
);
73 MultiCompress(string
const &Output
,string
const &Compress
,
74 mode_t
const &Permissions
, bool const &Write
= true);