Allow override of Proxy-Auto-Detect by the users configuration
[ntk/apt.git] / cmdline / apt-sortpkgs.cc
index fe5fe13..c2b1189 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-sortpkgs.cc,v 1.3 2002/01/09 04:59:44 jgg Exp $
+// $Id: apt-sortpkgs.cc,v 1.5 2003/01/11 07:18:44 jgg Exp $
 /* ######################################################################
    
    APT Sort Packages - Program to sort Package and Source files
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
-#include <config.h>
-#include <apti18n.h>
-    
 #include <vector>
 #include <algorithm>
+#include <stdio.h>
+#include <iostream>
+#include <string>
 
-#include <unistd.h>
+#include <apti18n.h>
                                                                        /*}}}*/
 
-struct PkgName
+using namespace std;
+
+struct PkgName                                                         /*{{{*/
 {
    string Name;
    string Ver;
@@ -52,11 +58,11 @@ struct PkgName
    bool operator >(const PkgName &x) const {return Compare3(x) > 0;};
    bool operator ==(const PkgName &x) const {return Compare3(x) == 0;};
 };
-
+                                                                       /*}}}*/
 // DoIt - Sort a single file                                           /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool DoIt(string InFile)
+static bool DoIt(string InFile)
 {
    FileFd Fd(InFile,FileFd::ReadOnly);
    pkgTagFile Tags(&Fd);
@@ -103,7 +109,7 @@ bool DoIt(string InFile)
    
    // Emit
    unsigned char *Buffer = new unsigned char[Largest+1];
-   for (vector<PkgName>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
    {
       // Read in the Record.
       if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer,I->Length) == false)
@@ -136,10 +142,10 @@ bool DoIt(string InFile)
 // ShowHelp - Show the help text                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-int ShowHelp()
+static int ShowHelp()
 {
-   ioprintf(cout,_("%s %s for %s %s compiled on %s %s\n"),PACKAGE,VERSION,
-           COMMON_OS,COMMON_CPU,__DATE__,__TIME__);
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
+           COMMON_ARCH,__DATE__,__TIME__);
    if (_config->FindB("version") == true)
       return 0;
    
@@ -153,13 +159,12 @@ int ShowHelp()
       "  -h   This help text\n"
       "  -s   Use source file sorting\n"
       "  -c=? Read this configuration file\n"
-      "  -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n");
+      "  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
 
    return 0;
 }
                                                                        /*}}}*/
-
-int main(unsigned int argc,const char *argv[])
+int main(int argc,const char *argv[])                                  /*{{{*/
 {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
@@ -203,3 +208,4 @@ int main(unsigned int argc,const char *argv[])
    
    return 0;   
 }
+                                                                       /*}}}*/