// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: writer.cc,v 1.9 2003/12/26 20:50:01 mdz Exp $
+// $Id: writer.cc,v 1.13 2004/01/04 00:20:59 mdz Exp $
/* ######################################################################
Writer
Db(DB),Stats(Db.Stats)
{
Output = stdout;
+ SetExts(".deb .udeb .foo .bar .baz");
AddPattern("*.deb");
DeLinkLimit = 0;
{
ClearPatterns();
string::size_type Start = 0;
- for(string::size_type space = Vals.find(' ');
- space != string::npos;
- space = Vals.find(' ', space))
+ while (Start <= Vals.length()-1)
{
- if (space > 0)
+ string::size_type Space = Vals.find(' ',Start);
+ string::size_type Length;
+ if (Space == string::npos)
{
- AddPattern(string("*") + string(Start, space-1));
- Start = space + 1;
+ Length = Vals.length()-Start;
}
+ else
+ {
+ Length = Space-Start;
+ }
+ AddPattern(string("*") + Vals.substr(Start, Length));
+ Start += Length + 1;
}
return true;
{
AddPattern("Packages");
AddPattern("Packages.gz");
+ AddPattern("Packages.bz2");
+ AddPattern("Sources");
+ AddPattern("Sources.gz");
+ AddPattern("Sources.bz2");
+ AddPattern("Release");
+ AddPattern("md5sum.txt");
+
Output = stdout;
time_t now = time(NULL);
char datestr[128];
FileName.length() > DirStrip.length() &&
stringcmp(FileName.begin(),FileName.begin() + DirStrip.length(),
DirStrip.begin(),DirStrip.end()) == 0)
+ {
NewFileName = string(FileName.begin() + DirStrip.length(),FileName.end());
+ while (NewFileName[0] == '/')
+ NewFileName = string(NewFileName.begin() + 1,NewFileName.end());
+ }
else
NewFileName = FileName;
+
if (PathPrefix.empty() == false)
NewFileName = flCombine(PathPrefix,NewFileName);
return false;
}
- CheckSums[FileName].size = fd.Size();
+ CheckSums[NewFileName].size = fd.Size();
MD5Summation MD5;
MD5.AddFD(fd.Fd(), fd.Size());
- CheckSums[FileName].MD5 = MD5.Result();
+ CheckSums[NewFileName].MD5 = MD5.Result();
fd.Seek(0);
SHA1Summation SHA1;
SHA1.AddFD(fd.Fd(), fd.Size());
- CheckSums[FileName].SHA1 = SHA1.Result();
+ CheckSums[NewFileName].SHA1 = SHA1.Result();
fd.Close();