summaryrefslogtreecommitdiff
path: root/methods/copy.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:16 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:16 +0000
commitbe4401bfa4a240bbc894e1bfeb1e1e8d63fc7b18 (patch)
tree3d48bdf9a7abff3b51c02323ea1ed26767d576d7 /methods/copy.cc
parentf0a53b6301cd1f5d0878f2d6ed21811d70a86f9a (diff)
New http method
Author: jgg Date: 1998-11-01 05:27:29 GMT New http method
Diffstat (limited to 'methods/copy.cc')
-rw-r--r--methods/copy.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/methods/copy.cc b/methods/copy.cc
index e63801f38..94e88e503 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: copy.cc,v 1.4 1998/10/30 07:53:51 jgg Exp $
+// $Id: copy.cc,v 1.5 1998/11/01 05:27:40 jgg Exp $
/* ######################################################################
Copy URI - This method takes a uri like a file: uri and copies it
@@ -20,7 +20,7 @@
class CopyMethod : public pkgAcqMethod
{
- virtual bool Fetch(string Message,URI Get);
+ virtual bool Fetch(FetchItem *Itm);
public:
@@ -30,13 +30,14 @@ class CopyMethod : public pkgAcqMethod
// CopyMethod::Fetch - Fetch a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool CopyMethod::Fetch(string Message,URI Get)
+bool CopyMethod::Fetch(FetchItem *Itm)
{
+ URI Get = Itm->Uri;
string File = Get.Path;
// See if the file exists
FileFd From(File,FileFd::ReadOnly);
- FileFd To(DestFile,FileFd::WriteEmpty);
+ FileFd To(Itm->DestFile,FileFd::WriteEmpty);
To.EraseOnFailure();
if (_error->PendingError() == true)
return false;
@@ -59,7 +60,7 @@ bool CopyMethod::Fetch(string Message,URI Get)
struct utimbuf TimeBuf;
TimeBuf.actime = Buf.st_atime;
TimeBuf.modtime = Buf.st_mtime;
- if (utime(DestFile.c_str(),&TimeBuf) != 0)
+ if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0)
{
To.OpFail();
return _error->Errno("utime","Failed to set modification time");
@@ -68,7 +69,7 @@ bool CopyMethod::Fetch(string Message,URI Get)
// Forumulate a result
FetchResult Res;
Res.Size = Buf.st_size;
- Res.Filename = DestFile;
+ Res.Filename = Itm->DestFile;
Res.LastModified = Buf.st_mtime;
Res.IMSHit = false;