Fini
[apt.git] / cmdline / acqprogress.cc
index f16843c612970feb750e2b5f0b573c07457e4ea2..e2ef83501181e93a28e24d2a18eb70e0a3e6a2f2 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acqprogress.cc,v 1.16 1999/07/03 03:10:35 jgg Exp $
+// $Id: acqprogress.cc,v 1.20 2000/05/12 04:03:27 jgg Exp $
 /* ######################################################################
 
    Acquire Progress - Command line progress meter 
@@ -12,6 +12,7 @@
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
 
 #include <stdio.h>
 #include <signal.h>
@@ -92,6 +93,7 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
    if (Quiet > 1)
       return;
 
+   // Ignore certain kinds of transient failures (bad code)
    if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
       return;
       
@@ -122,9 +124,9 @@ void AcqTextStatus::Stop()
       return;
 
    if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r';
+      cout << '\r' << BlankLine << '\r' << flush;
    
-   if (FetchedBytes != 0)
+   if (FetchedBytes != 0 && _error->PendingError() == false)
       cout << "Fetched " << SizeToStr(FetchedBytes) << "B in " <<
          TimeToStr(ElapsedTime) << " (" << SizeToStr(CurrentCPS) << 
          "B/s)" << endl;
@@ -144,10 +146,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    
    enum {Long = 0,Medium,Short} Mode = Long;
    
-   char Buffer[300];
+   char Buffer[1024];
    char *End = Buffer + sizeof(Buffer);
    char *S = Buffer;
-   
+   if (ScreenWidth >= sizeof(Buffer))
+      ScreenWidth = sizeof(Buffer)-1;
+
    // Put in the percent done
    sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));