From be4401bfa4a240bbc894e1bfeb1e1e8d63fc7b18 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:16 +0000 Subject: New http method Author: jgg Date: 1998-11-01 05:27:29 GMT New http method --- methods/copy.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'methods/copy.cc') 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; -- cgit v1.2.3