// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acqprogress.cc,v 1.2 1998/11/12 05:30:07 jgg Exp $
+// $Id: acqprogress.cc,v 1.7 1999/01/27 02:48:53 jgg Exp $
/* ######################################################################
Acquire Progress - Command line progress meter
#include "acqprogress.h"
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/strutl.h>
#include <stdio.h>
-#include <strutl.h>
/*}}}*/
// AcqTextStatus::AcqTextStatus - Constructor /*{{{*/
char *S = Buffer;
// Put in the percent done
- sprintf(S,"%ld%%",long(double(CurrentBytes*100.0)/double(TotalBytes)));
-
+ sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+
+ bool Shown = false;
for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
I = Owner->WorkerStep(I))
{
if (I->CurrentItem == 0)
{
if (I->Status.empty() == false)
+ {
snprintf(S,End-S," [%s]",I->Status.c_str());
+ Shown = true;
+ }
+
continue;
}
+ Shown = true;
+
// Add in the short description
if (I->CurrentItem->Owner->ID != 0)
snprintf(S,End-S," [%x %s",I->CurrentItem->Owner->ID,
snprintf(S,End-S,"]");
}
+ // Show something..
+ if (Shown == false)
+ snprintf(S,End-S," [Working]");
+
// Put in the ETA and cps meter
if (CurrentCPS != 0)
{
Update = false;
}
/*}}}*/
+// AcqTextStatus::MediaChange - Media need to be swapped /*{{{*/
+// ---------------------------------------------------------------------
+/* Prompt for a media swap */
+bool AcqTextStatus::MediaChange(string Media,string Drive)
+{
+ if (Quiet <= 0)
+ cout << '\r' << BlankLine << '\r';
+ cout << "Media Change: Please insert the disc labeled '" << Media << "' in "\
+ "the drive '" << Drive << "' and press enter" << endl;
+
+ char C = 0;
+ while (C != '\n' && C != '\r')
+ read(STDIN_FILENO,&C,1);
+
+ Update = true;
+ return true;
+}
+ /*}}}*/