]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-sortpkgs.cc
rewrite all TFRewrite instances to use the new pkgTagSection::Write
[apt.git] / cmdline / apt-sortpkgs.cc
index 9b66ad4db1e6da4c1660d00388722b1ace0ac97f..12ef8dda091c38a710537137242455fe5402b668 100644 (file)
@@ -108,8 +108,10 @@ static bool DoIt(string InFile)
    const char **Order = TFRewritePackageOrder;
    if (Source == true)
       Order = TFRewriteSourceOrder;
-   
+
    // Emit
+   FileFd stdoutfd;
+   stdoutfd.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly, false);
    unsigned char *Buffer = new unsigned char[Largest+1];
    for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
    {
@@ -119,8 +121,8 @@ static bool DoIt(string InFile)
         delete [] Buffer;
         return false;
       }
-      
-      Buffer[I->Length] = '\n';      
+
+      Buffer[I->Length] = '\n';
       if (Section.Scan((char *)Buffer,I->Length+1) == false)
       {
         delete [] Buffer;
@@ -128,15 +130,13 @@ static bool DoIt(string InFile)
       }
 
       // Sort the section
-      if (TFRewrite(stdout,Section,Order,0) == false)
+      if (Section.Write(stdoutfd, Order) == false || stdoutfd.Write("\n", 1) == false)
       {
         delete [] Buffer;
         return _error->Error("Internal error, failed to sort fields");
       }
-      
-      fputc('\n',stdout);      
    }
-   
+
    delete [] Buffer;
    return true;
 }
@@ -146,8 +146,7 @@ static bool DoIt(string InFile)
 /* */
 static bool ShowHelp(CommandLine &)
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
-           COMMON_ARCH,__DATE__,__TIME__);
+   ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
    if (_config->FindB("version") == true)
       return true;