]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cdrom.cc
copy uri doc
[apt.git] / cmdline / apt-cdrom.cc
index bf2e85b88f5bbc9bf5c61e95a6e0f0436160ec7e..0b909a769fd76743b5ee3cf1484627653ef61cbf 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-cdrom.cc,v 1.12 1998/12/09 01:03:00 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.15 1998/12/30 06:26:00 jgg Exp $
 /* ######################################################################
    
    APT CDROM - Tool for handling APT's CDROM database.
@@ -54,8 +54,7 @@ bool FindPackages(string CD,vector<string> &List, unsigned int Depth = 0)
       this dir is controlled by those package files so we don't look down
       anymore */
    struct stat Buf;
-   if (stat("Packages",&Buf) == 0 ||
-       stat("Packages.gz",&Buf) == 0)
+   if (stat("Packages",&Buf) == 0) 
    {
       List.push_back(CD);
       
@@ -91,9 +90,9 @@ bool FindPackages(string CD,vector<string> &List, unsigned int Depth = 0)
       for (I = 0; I != Depth; I++)
         if (Inodes[I] == Buf.st_ino)
            break;
-      if (Inodes[I] == Buf.st_ino)
+      if (I != Depth)
         continue;
-            
+      
       // Store the inodes weve seen
       Inodes[Depth] = Buf.st_ino;
 
@@ -156,6 +155,8 @@ int Score(string Path)
    int Res = 0;
    if (Path.find("stable/") != string::npos)
       Res += 2;
+   if (Path.find("/binary-") != string::npos)
+      Res += 2;
    if (Path.find("frozen/") != string::npos)
       Res += 2;
    if (Path.find("/dists/") != string::npos)
@@ -182,10 +183,13 @@ bool DropRepeats(vector<string> &List)
    {
       struct stat Buf;
       if (stat((List[I] + "Packages").c_str(),&Buf) != 0)
-        _error->Errno("stat","Failed to stat %s",List[I].c_str());
+        _error->Errno("stat","Failed to stat %sPackages",List[I].c_str());
       Inodes[I] = Buf.st_ino;
    }
    
+   if (_error->PendingError() == true)
+      return false;
+   
    // Look for dups
    for (unsigned int I = 0; I != List.size(); I++)
    {
@@ -903,15 +907,22 @@ bool DoAdd(CommandLine &)
         {
            Name = PromptLine("");
            if (Name.empty() == false &&
+               Name.find('"') == string::npos &&
+               Name.find(':') == string::npos &&
                Name.find('/') == string::npos)
               break;
            cout << "That is not a valid name, try again " << endl;
-        }
-        
+        }       
       }      
    }
    else
       Name = Database.Find("CD::" + ID);
+   
+   string::iterator J = Name.begin();
+   for (; J != Name.end(); J++)
+      if (*J == '/' || *J == '"' || *J == ':')
+        *J = '_';
+   
    Database.Set("CD::" + ID,Name);
    cout << "This Disc is called '" << Name << "'" << endl;