浏览代码

Added --version and fixed clogging for -s
Author: jgg
Date: 1999-01-30 02:12:53 GMT
Added --version and fixed clogging for -s

Arch Librarian 22 年之前
父节点
当前提交
04aa15a830
共有 8 个文件被更改,包括 43 次插入21 次删除
  1. 16 16
      apt-pkg/algorithms.cc
  2. 4 1
      cmdline/apt-cache.cc
  3. 4 1
      cmdline/apt-cdrom.cc
  4. 4 1
      cmdline/apt-config.cc
  5. 6 2
      cmdline/apt-get.cc
  6. 3 0
      doc/apt-cache.8.yo
  7. 3 0
      doc/apt-cdrom.8.yo
  8. 3 0
      doc/apt-get.8.yo

+ 16 - 16
apt-pkg/algorithms.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: algorithms.cc,v 1.14 1998/12/08 01:34:05 jgg Exp $
+// $Id: algorithms.cc,v 1.15 1999/01/30 02:12:53 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Algorithms - A set of misc algorithms
    Algorithms - A set of misc algorithms
@@ -44,7 +44,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
    PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
    PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
    Flags[Pkg->ID] = 1;
    Flags[Pkg->ID] = 1;
    
    
-   clog << "Inst " << Pkg.Name();
+   cout << "Inst " << Pkg.Name();
    Sim.MarkInstall(Pkg,false);
    Sim.MarkInstall(Pkg,false);
    
    
    // Look for broken conflicts+predepends.
    // Look for broken conflicts+predepends.
@@ -58,7 +58,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
          {
          {
 	    if ((Sim[D] & pkgDepCache::DepInstall) == 0)
 	    if ((Sim[D] & pkgDepCache::DepInstall) == 0)
 	    {
 	    {
-	       clog << " [" << I.Name() << " on " << D.TargetPkg().Name() << ']';
+	       cout << " [" << I.Name() << " on " << D.TargetPkg().Name() << ']';
 	       if (D->Type == pkgCache::Dep::Conflicts)
 	       if (D->Type == pkgCache::Dep::Conflicts)
 		  _error->Error("Fatal, conflicts violated %s",I.Name());
 		  _error->Error("Fatal, conflicts violated %s",I.Name());
 	    }	    
 	    }	    
@@ -68,7 +68,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
    if (Sim.BrokenCount() != 0)
    if (Sim.BrokenCount() != 0)
       ShortBreaks();
       ShortBreaks();
    else
    else
-      clog << endl;
+      cout << endl;
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -86,7 +86,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
 //   Sim.MarkInstall(Pkg,false);
 //   Sim.MarkInstall(Pkg,false);
    if (Sim[Pkg].InstBroken() == true)
    if (Sim[Pkg].InstBroken() == true)
    {
    {
-      clog << "Conf " << Pkg.Name() << " broken" << endl;
+      cout << "Conf " << Pkg.Name() << " broken" << endl;
 
 
       Sim.Update();
       Sim.Update();
       
       
@@ -98,21 +98,21 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
 	    continue;
 	    continue;
 	 
 	 
 	 if (D->Type == pkgCache::Dep::Conflicts)
 	 if (D->Type == pkgCache::Dep::Conflicts)
-	    clog << " Conflicts:" << D.TargetPkg().Name();
+	    cout << " Conflicts:" << D.TargetPkg().Name();
 	 else
 	 else
-	    clog << " Depends:" << D.TargetPkg().Name();
+	    cout << " Depends:" << D.TargetPkg().Name();
       }	    
       }	    
-      clog << endl;
+      cout << endl;
 
 
       _error->Error("Conf Broken %s",Pkg.Name());
       _error->Error("Conf Broken %s",Pkg.Name());
    }   
    }   
    else
    else
-      clog << "Conf " <<  Pkg.Name();
+      cout << "Conf " <<  Pkg.Name();
 
 
    if (Sim.BrokenCount() != 0)
    if (Sim.BrokenCount() != 0)
       ShortBreaks();
       ShortBreaks();
    else
    else
-      clog << endl;
+      cout << endl;
    
    
    return true;
    return true;
 }
 }
@@ -127,12 +127,12 @@ bool pkgSimulate::Remove(PkgIterator iPkg)
 
 
    Flags[Pkg->ID] = 3;
    Flags[Pkg->ID] = 3;
    Sim.MarkDelete(Pkg);
    Sim.MarkDelete(Pkg);
-   clog << "Remv " << Pkg.Name();
+   cout << "Remv " << Pkg.Name();
 
 
    if (Sim.BrokenCount() != 0)
    if (Sim.BrokenCount() != 0)
       ShortBreaks();
       ShortBreaks();
    else
    else
-      clog << endl;
+      cout << endl;
 
 
    return true;
    return true;
 }
 }
@@ -142,18 +142,18 @@ bool pkgSimulate::Remove(PkgIterator iPkg)
 /* */
 /* */
 void pkgSimulate::ShortBreaks()
 void pkgSimulate::ShortBreaks()
 {
 {
-   clog << " [";
+   cout << " [";
    for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
    for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
    {
    {
       if (Sim[I].InstBroken() == true)
       if (Sim[I].InstBroken() == true)
       {
       {
 	 if (Flags[I->ID] == 0)
 	 if (Flags[I->ID] == 0)
-	    clog << I.Name() << ' ';
+	    cout << I.Name() << ' ';
 /*	 else
 /*	 else
-	    clog << I.Name() << "! ";*/
+	    cout << I.Name() << "! ";*/
       }      
       }      
    }
    }
-   clog << ']' << endl;
+   cout << ']' << endl;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // ApplyStatus - Adjust for non-ok packages				/*{{{*/
 // ApplyStatus - Adjust for non-ok packages				/*{{{*/

+ 4 - 1
cmdline/apt-cache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-cache.cc,v 1.22 1999/01/27 02:48:53 jgg Exp $
+// $Id: apt-cache.cc,v 1.23 1999/01/30 02:12:53 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-cache - Manages the cache files
    apt-cache - Manages the cache files
@@ -447,6 +447,8 @@ bool ShowHelp(CommandLine &Cmd)
 {
 {
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
+   if (_config->FindB("version") == true)
+      return 100;
    
    
    cout << "Usage: apt-cache [options] command" << endl;
    cout << "Usage: apt-cache [options] command" << endl;
    cout << "       apt-cache [options] add file1 [file1 ...]" << endl;
    cout << "       apt-cache [options] add file1 [file1 ...]" << endl;
@@ -492,6 +494,7 @@ int main(int argc,const char *argv[])
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
+      {'v',"version","version",0},
       {'p',"pkg-cache","Dir::Cache::pkgcache",CommandLine::HasArg},
       {'p',"pkg-cache","Dir::Cache::pkgcache",CommandLine::HasArg},
       {'s',"src-cache","Dir::Cache::srcpkgcache",CommandLine::HasArg},
       {'s',"src-cache","Dir::Cache::srcpkgcache",CommandLine::HasArg},
       {'q',"quiet","quiet",CommandLine::IntLevel},
       {'q',"quiet","quiet",CommandLine::IntLevel},

+ 4 - 1
cmdline/apt-cdrom.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-cdrom.cc,v 1.16 1999/01/27 02:48:53 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.17 1999/01/30 02:12:53 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    APT CDROM - Tool for handling APT's CDROM database.
    APT CDROM - Tool for handling APT's CDROM database.
@@ -966,6 +966,8 @@ int ShowHelp()
 {
 {
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
+   if (_config->FindB("version") == true)
+      return 100;
    
    
    cout << "Usage: apt-cdrom [options] command" << endl;
    cout << "Usage: apt-cdrom [options] command" << endl;
    cout << endl;
    cout << endl;
@@ -994,6 +996,7 @@ int main(int argc,const char *argv[])
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
+      {'v',"version","version",0},
       {'d',"cdrom","Acquire::cdrom::mount",CommandLine::HasArg},
       {'d',"cdrom","Acquire::cdrom::mount",CommandLine::HasArg},
       {'r',"rename","APT::CDROM::Rename",0},
       {'r',"rename","APT::CDROM::Rename",0},
       {'m',"no-mount","APT::CDROM::NoMount",0},
       {'m',"no-mount","APT::CDROM::NoMount",0},

+ 4 - 1
cmdline/apt-config.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-config.cc,v 1.2 1998/11/27 01:52:57 jgg Exp $
+// $Id: apt-config.cc,v 1.3 1999/01/30 02:12:53 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    APT Config - Program to manipulate APT configuration files
    APT Config - Program to manipulate APT configuration files
@@ -47,6 +47,8 @@ int ShowHelp()
 {
 {
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
+   if (_config->FindB("version") == true)
+      return 100;
    
    
    cout << "Usage: apt-config [options] command" << endl;
    cout << "Usage: apt-config [options] command" << endl;
    cout << endl;
    cout << endl;
@@ -67,6 +69,7 @@ int main(int argc,const char *argv[])
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
+      {'v',"version","version",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
       {'o',"option",0,CommandLine::ArbItem},
       {0,0,0,0}};
       {0,0,0,0}};

+ 6 - 2
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.34 1999/01/27 03:42:59 jgg Exp $
+// $Id: apt-get.cc,v 1.35 1999/01/30 02:12:53 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-get - Cover for dpkg
    apt-get - Cover for dpkg
@@ -988,7 +988,9 @@ bool ShowHelp(CommandLine &CmdL)
 {
 {
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
    cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
        " compiled on " << __DATE__ << "  " << __TIME__ << endl;
-   
+   if (_config->FindB("version") == true)
+      return 100;
+       
    cout << "Usage: apt-get [options] command" << endl;
    cout << "Usage: apt-get [options] command" << endl;
    cout << "       apt-get [options] install pkg1 [pkg2 ...]" << endl;
    cout << "       apt-get [options] install pkg1 [pkg2 ...]" << endl;
    cout << endl;
    cout << endl;
@@ -1056,6 +1058,7 @@ int main(int argc,const char *argv[])
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
+      {'v',"version","version",0},
       {'q',"quiet","quiet",CommandLine::IntLevel},
       {'q',"quiet","quiet",CommandLine::IntLevel},
       {'q',"silent","quiet",CommandLine::IntLevel},
       {'q',"silent","quiet",CommandLine::IntLevel},
       {'d',"download-only","APT::Get::Download-Only",0},
       {'d',"download-only","APT::Get::Download-Only",0},
@@ -1097,6 +1100,7 @@ int main(int argc,const char *argv[])
 
 
    // See if the help should be shown
    // See if the help should be shown
    if (_config->FindB("help") == true ||
    if (_config->FindB("help") == true ||
+       _config->FindB("version") == true ||
        CmdL.FileSize() == 0)
        CmdL.FileSize() == 0)
       return ShowHelp(CmdL);
       return ShowHelp(CmdL);
 
 

+ 3 - 0
doc/apt-cache.8.yo

@@ -147,6 +147,9 @@ startdit()
 dit(bf(-h, --help))
 dit(bf(-h, --help))
 Show a short usage summary.
 Show a short usage summary.
 
 
+dit(bf(-v, --version))
+Show the program verison.
+
 dit(bf(-p --pkg-cache))
 dit(bf(-p --pkg-cache))
 Select the file to store the package cache. The package cache is the primary
 Select the file to store the package cache. The package cache is the primary
 cache used by all operations.
 cache used by all operations.

+ 3 - 0
doc/apt-cdrom.8.yo

@@ -43,6 +43,9 @@ startdit()
 dit(bf(-h, --help))
 dit(bf(-h, --help))
 Show a short usage summary.
 Show a short usage summary.
 
 
+dit(bf(-v, --version))
+Show the program verison.
+
 dit(bf(-d --cdrom))
 dit(bf(-d --cdrom))
 Mount point; specify the location to mount the cdrom. This mount point must
 Mount point; specify the location to mount the cdrom. This mount point must
 be listed in bf(/etc/fstab) and propely configured. 
 be listed in bf(/etc/fstab) and propely configured. 

+ 3 - 0
doc/apt-get.8.yo

@@ -116,6 +116,9 @@ some situations. See bf(APT::Get::Fix-Broken).
 dit(bf(-h, --help))
 dit(bf(-h, --help))
 Help; display a helpful usage message and exits.
 Help; display a helpful usage message and exits.
 
 
+dit(bf(-v, --version))
+Show the program verison.
+
 dit(bf(-m, --ignore-missing))
 dit(bf(-m, --ignore-missing))
 Ignore missing packages; If packages cannot be retrieved or fail the    
 Ignore missing packages; If packages cannot be retrieved or fail the    
 integrity check after retrieval (corrupted package files), hold back    
 integrity check after retrieval (corrupted package files), hold back