]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/configuration.cc
CDROM method
[apt.git] / apt-pkg / contrib / configuration.cc
index fa07ed35ae1c7df90e22e00f0b1abe61138b4bb7..da026f0f62a59fb4f7f701930d89d98667c2e8bc 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: configuration.cc,v 1.8 1998/10/22 04:56:45 jgg Exp $
+// $Id: configuration.cc,v 1.10 1998/11/05 07:21:43 jgg Exp $
 /* ######################################################################
 
    Configuration Class
@@ -212,6 +212,31 @@ bool Configuration::Exists(const char *Name)
    return true;
 }
                                                                        /*}}}*/
+// Configuration::Dump - Dump the config                               /*{{{*/
+// ---------------------------------------------------------------------
+/* Dump the entire configuration space */
+void Configuration::Dump()
+{
+   /* Write out all of the configuration directives by walking the 
+      configuration tree */
+   const Configuration::Item *Top = _config->Tree(0);
+   for (; Top != 0;)
+   {
+      clog << Top->FullTag() << " \"" << Top->Value << "\";" << endl;
+      
+      if (Top->Child != 0)
+      {
+        Top = Top->Child;
+        continue;
+      }
+      
+      while (Top != 0 && Top->Next == 0)
+        Top = Top->Parent;
+      if (Top != 0)
+        Top = Top->Next;
+   }   
+}
+                                                                       /*}}}*/
 
 // Configuration::Item::FullTag - Return the fully scoped tag          /*{{{*/
 // ---------------------------------------------------------------------
@@ -267,8 +292,14 @@ bool ReadConfigFile(Configuration &Conf,string FName)
       }
       
       // Discard single line comments
+      bool InQuote = false;
       for (char *I = Buffer; *I != 0; I++)
       {
+        if (*I == '"')
+           InQuote = !InQuote;
+        if (InQuote == true)
+           continue;
+        
         if (*I == '/' && I[1] == '/')
          {
            *I = 0;
@@ -279,6 +310,11 @@ bool ReadConfigFile(Configuration &Conf,string FName)
       // Look for multi line comments
       for (char *I = Buffer; *I != 0; I++)
       {
+        if (*I == '"')
+           InQuote = !InQuote;
+        if (InQuote == true)
+           continue;
+        
         if (*I == '/' && I[1] == '*')
          {
            InComment = true;
@@ -373,7 +409,7 @@ bool ReadConfigFile(Configuration &Conf,string FName)
            string Word;
            if (ParseCWord(LineBuffer.c_str()+Pos,Word) == false)
               return _error->Error("Syntax error %s:%u: Malformed value",FName.c_str(),CurLine);
-              
+           
            // Generate the item name
            string Item;
            if (ParentTag.empty() == true)