mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
* Handle prematurely ended logfiles, i.e. make sure we emit enough
close tags.
This commit is contained in:
parent
2ab09a55cf
commit
5024bde8f4
1 changed files with 21 additions and 9 deletions
|
@ -34,6 +34,8 @@ struct Decoder
|
|||
void pushChar(char c);
|
||||
|
||||
void finishLine();
|
||||
|
||||
void decodeFile(istream & st);
|
||||
};
|
||||
|
||||
|
||||
|
@ -158,16 +160,26 @@ void Decoder::finishLine()
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
void Decoder::decodeFile(istream & st)
|
||||
{
|
||||
Decoder dec;
|
||||
int c;
|
||||
|
||||
cout << "<logfile>" << endl;
|
||||
|
||||
while ((c = getchar()) != EOF) {
|
||||
dec.pushChar(c);
|
||||
while ((c = st.get()) != EOF) {
|
||||
pushChar(c);
|
||||
}
|
||||
|
||||
if (line.size()) finishLine();
|
||||
|
||||
while (level--) cout << "</nest>" << endl;
|
||||
|
||||
cout << "</logfile>" << endl;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
Decoder dec;
|
||||
dec.decodeFile(cin);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue