]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-method.cc
Fixes for file opening
[apt.git] / apt-pkg / acquire-method.cc
index 0629995a0b59e0e08e3c97d68999c8ed03a850b8..75ddee14af86dc4dd18edcb515907d1a177702ff 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-method.cc,v 1.2 1998/11/01 05:27:30 jgg Exp $
+// $Id: acquire-method.cc,v 1.8 1998/11/14 01:39:41 jgg Exp $
 /* ######################################################################
 
    Acquire Method
@@ -41,12 +41,17 @@ pkgAcqMethod::pkgAcqMethod(const char *Ver,unsigned long Flags)
    
    if ((Flags & SendConfig) == SendConfig)
       strcat(End,"Send-Config: true\n");
+
+   if ((Flags & LocalOnly) == LocalOnly)
+      strcat(End,"Local-Only: true\n");
    strcat(End,"\n");
 
    if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S))
       exit(100);
 
    SetNonBlock(STDIN_FILENO,true);
+   
+   Queue = 0;
 }
                                                                        /*}}}*/
 // AcqMethod::Fail - A fetch has failed                                        /*{{{*/
@@ -139,6 +144,10 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
    if (Res.MD5Sum.empty() == false)
       End += snprintf(End,sizeof(S) - (End - S),"MD5Sum: %s\n",Res.MD5Sum.c_str());
 
+   if (Res.ResumePoint != 0)
+      End += snprintf(End,sizeof(S) - (End - S),"Resume-Point: %u\n",
+                     Res.ResumePoint);
+
    if (Res.IMSHit == true)
       strcat(End,"IMS-Hit: true\n");
    End = S + strlen(S);
@@ -220,11 +229,11 @@ int pkgAcqMethod::Run(bool Single)
         if (Single == false)
            if (WaitFd(STDIN_FILENO) == false)
               return 0;
-      }
-      
-      if (ReadMessages(STDIN_FILENO,Messages) == false)
-        return 0;
       
+        if (ReadMessages(STDIN_FILENO,Messages) == false)
+           return 0;
+      }
+            
       // Single mode exits if the message queue is empty
       if (Single == true && Messages.empty() == true)
         return 0;
@@ -254,16 +263,20 @@ int pkgAcqMethod::Run(bool Single)
            
            Tmp->Uri = LookupTag(Message,"URI");
            Tmp->DestFile = LookupTag(Message,"FileName");
-           StrToTime(LookupTag(Message,"Last-Modified"),Tmp->LastModified);
+           if (StrToTime(LookupTag(Message,"Last-Modified"),Tmp->LastModified) == false)
+              Tmp->LastModified = 0;
+           
            Tmp->Next = 0;
            
            // Append it to the list
            FetchItem **I = &Queue;
-           for (; *I != 0 && (*I)->Next != 0; I = &(*I)->Next);
+           for (; *I != 0; I = &(*I)->Next);
            *I = Tmp;
-           
+
+           // Notify that this item is to be fetched.
            if (Fetch(Tmp) == false)
               Fail();
+           
            break;                                           
         }   
       }      
@@ -310,7 +323,7 @@ void pkgAcqMethod::Status(const char *Format,...)
 
    // sprintf the description
    char S[1024];
-   unsigned int Len = snprintf(S,sizeof(S),"101 Log\nURI: %s\n"
+   unsigned int Len = snprintf(S,sizeof(S),"102 Status\nURI: %s\n"
                               "Message: ",CurrentURI.c_str());
 
    vsnprintf(S+Len,sizeof(S)-Len,Format,args);
@@ -324,8 +337,8 @@ void pkgAcqMethod::Status(const char *Format,...)
 // AcqMethod::FetchResult::FetchResult - Constructor                   /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-pkgAcqMethod::FetchResult::FetchResult() : LastModified(0), 
-                                   IMSHit(false), Size(0)
+pkgAcqMethod::FetchResult::FetchResult() : LastModified(0),
+                                   IMSHit(false), Size(0), ResumePoint(0)
 {
 }
                                                                        /*}}}*/