From 92173b19af439ac49d842902a3a57105d396d7d8 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:12 +0000 Subject: gzip method Author: jgg Date: 1998-10-25 07:07:29 GMT gzip method --- methods/copy.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'methods/copy.cc') diff --git a/methods/copy.cc b/methods/copy.cc index 68253a64c..c1cc26a69 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -1,10 +1,10 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: copy.cc,v 1.1 1998/10/25 01:57:07 jgg Exp $ +// $Id: copy.cc,v 1.2 1998/10/25 07:07:29 jgg Exp $ /* ###################################################################### Copy URI - This method takes a uri like a file: uri and copies it - to the destination URI. + to the destination file. ##################################################################### */ /*}}}*/ @@ -14,6 +14,7 @@ #include #include +#include #include #include /*}}}*/ @@ -103,7 +104,28 @@ int main() Fail(URI); continue; } + + From.Close(); + To.Close(); + // Transfer the modification times + struct stat Buf; + if (stat(File.c_str(),&Buf) != 0) + { + _error->Errno("stat","Failed to stat"); + Fail(URI); + continue; + } + struct utimbuf TimeBuf; + TimeBuf.actime = Buf.st_atime; + TimeBuf.modtime = Buf.st_mtime; + if (utime(Target.c_str(),&TimeBuf) != 0) + { + _error->Errno("utime","Failed to set modification time"); + Fail(URI); + continue; + } + // Send the message Result += "\n\n"; if (write(STDOUT_FILENO,Result.begin(),Result.length()) != -- cgit v1.2.3