]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
fixed casting bug
[apt.git] / cmdline / apt-get.cc
index 31dfe97c16d7018f300e128c9a4523dd6b9624fc..f7313a07e990a81ce4582ee24382e1c04d2f522a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.21 1998/12/05 02:56:45 jgg Exp $
+// $Id: apt-get.cc,v 1.31 1998/12/14 02:23:47 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -61,7 +61,7 @@ bool YnPrompt()
 {
    if (_config->FindB("APT::Get::Assume-Yes",false) == true)
    {
-      c2out << 'Y' << endl;
+      c1out << 'Y' << endl;
       return true;
    }
    
@@ -135,7 +135,7 @@ void ShowBroken(ostream &out,pkgDepCache &Cache)
         pkgCache::DepIterator Start;
         pkgCache::DepIterator End;
         D.GlobOr(Start,End);
-        
+
         if (Cache.IsImportantDep(End) == false || 
             (Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
            continue;
@@ -208,6 +208,7 @@ void ShowDel(ostream &out,pkgDepCache &Dep)
    for (;I.end() != true; I++)
       if (Dep[I].Delete() == true)
         List += string(I.Name()) + " ";
+   
    ShowList(out,"The following packages will be REMOVED:",List);
 }
                                                                        /*}}}*/
@@ -397,6 +398,8 @@ bool CacheFile::Open()
    pkgMakeStatusCache(List,Progress);
    if (_error->PendingError() == true)
       return _error->Error("The package lists or status file could not be parsed or opened.");
+   if (_error->empty() == false)
+      _error->Warning("You may want to run apt-get update to correct theses missing files");
    
    Progress.Done();
    
@@ -468,10 +471,10 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
    ShowNew(c1out,Cache);
    if (ShwKept == true)
       ShowKept(c1out,Cache);
-   Fail |= ShowHold(c1out,Cache);
+   Fail |= !ShowHold(c1out,Cache);
    if (_config->FindB("APT::Get::Show-Upgraded",false) == true)
       ShowUpgraded(c1out,Cache);
-   Fail |= ShowEssential(c1out,Cache);
+   Fail |= !ShowEssential(c1out,Cache);
    Stats(c1out,Cache);
    
    // Sanity check
@@ -483,7 +486,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
 
    if (Cache->DelCount() == 0 && Cache->InstCount() == 0 && 
        Cache->BadCount() == 0)
-      return true;   
+      return true;
 
    // Run the simulator ..
    if (_config->FindB("APT::Get::Simulate") == true)
@@ -529,19 +532,19 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
    }
       
    // Number of bytes
-   c1out << "Need to get ";
+   c2out << "Need to get ";
    if (DebBytes != FetchBytes)
-      c1out << SizeToStr(FetchBytes) << '/' << SizeToStr(DebBytes);
+      c2out << SizeToStr(FetchBytes) << '/' << SizeToStr(DebBytes);
    else
-      c1out << SizeToStr(DebBytes);
+      c2out << SizeToStr(DebBytes);
       
    c1out << " of archives. After unpacking ";
    
    // Size delta
    if (Cache->UsrSize() >= 0)
-      c1out << SizeToStr(Cache->UsrSize()) << " will be used." << endl;
+      c2out << SizeToStr(Cache->UsrSize()) << " will be used." << endl;
    else
-      c1out << SizeToStr(-1*Cache->UsrSize()) << " will be freed." << endl;
+      c2out << SizeToStr(-1*Cache->UsrSize()) << " will be freed." << endl;
 
    if (_error->PendingError() == true)
       return false;
@@ -588,8 +591,11 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
       cerr << "  " << (*I)->ErrorText << endl;
       Failed = true;
    }
-      
-   if (Failed == true && _config->FindB("APT::Fix-Missing",false) == false)
+
+   if (_config->FindB("APT::Get::Download-Only",false) == true)
+      return true;
+   
+   if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false)
    {
       if (Transient == true)
       {
@@ -953,7 +959,7 @@ bool DoCheck(CommandLine &CmdL)
 // ShowHelp - Show a help screen                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-int ShowHelp()
+bool ShowHelp(CommandLine &CmdL)
 {
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
@@ -1052,6 +1058,7 @@ int main(int argc,const char *argv[])
                                    {"dselect-upgrade",&DoDSelectUpgrade},
                                    {"clean",&DoClean},
                                    {"check",&DoCheck},
+                                  {"help",&ShowHelp},
                                    {0,0}};
    
    // Parse the command line and initialize the package library
@@ -1066,7 +1073,7 @@ int main(int argc,const char *argv[])
    // See if the help should be shown
    if (_config->FindB("help") == true ||
        CmdL.FileSize() == 0)
-      return ShowHelp();
+      return ShowHelp(CmdL);
 
    // Setup the output streams
    c0out.rdbuf(cout.rdbuf());
@@ -1090,8 +1097,6 @@ int main(int argc,const char *argv[])
    {
       bool Errors = _error->PendingError();
       _error->DumpErrors();
-      if (Errors == true)
-        cout << "Returning 100." << endl;
       return Errors == true?100:0;
    }