about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-03-27T15·33+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-03-27T15·33+0000
commitf0f7a9f29962c55a6c2082b44c9befbd912c2f53 (patch)
treed768ccbd861af67d1c33d9657777c55139e4ec8a
parent7823db2137d8079bcf512aba4ce46f1373693517 (diff)
* Do not close a nesting level twice after close() has been
  called explicitly on a Nest object.

-rw-r--r--src/libutil/util.cc1
-rw-r--r--src/log2xml/log2xml.cc11
2 files changed, 11 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index bf14e8aadfaa..87b2ef236365 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -279,6 +279,7 @@ void Nest::close()
         nestingLevel--;
         if (logType == ltEscapes)
             cerr << "\033[q";
+        nest = false;
     }
 }
 
diff --git a/src/log2xml/log2xml.cc b/src/log2xml/log2xml.cc
index 66e182452844..a4955dc6e82d 100644
--- a/src/log2xml/log2xml.cc
+++ b/src/log2xml/log2xml.cc
@@ -16,6 +16,7 @@ struct Decoder
     bool newNumber;
     int priority;
     bool ignoreLF;
+    int lineNo, charNo;
 
     Decoder()
     {
@@ -25,6 +26,8 @@ struct Decoder
         level = 0;
         priority = 1;
         ignoreLF = false;
+        lineNo = 1;
+        charNo = 0;
     }
 
     void pushChar(char c);
@@ -35,6 +38,11 @@ struct Decoder
 
 void Decoder::pushChar(char c)
 {
+    if (c == '\n') {
+        lineNo++;
+        charNo = 0;
+    } else charNo++;
+    
     switch (state) {
         
         case stTop:
@@ -71,7 +79,8 @@ void Decoder::pushChar(char c)
                             level--;
                             cout << "</nest>" << endl;
                         } else
-                            cerr << "not enough nesting levels" << endl;
+                            cerr << "not enough nesting levels at line "
+                                 << lineNo << ", character " << charNo  << endl;
                         break;
                     case 's':
                         if (line.size()) finishLine();