Let XML generator append a trailing newline

By appending a newline to the generated XML data, we prevent the output
from messing with the command prompt when using 'cat' on a shell.
Futhermore, when using line-buffered output, the trailing newline
ensures that the output gets gets properly flushed.
This commit is contained in:
Norman Feske 2015-06-09 21:48:50 +02:00 committed by Christian Helmuth
parent 613d208045
commit 6f167b449c
3 changed files with 6 additions and 3 deletions

View File

@ -232,7 +232,10 @@ class Genode::Xml_generator
:
_out_buffer(dst, dst_len)
{
if (dst) node(name, func);
if (dst) {
node(name, func);
_out_buffer.append('\n');
}
}
template <typename FUNC>

View File

@ -45,7 +45,7 @@ compare_output_to {
[init -> test-xml_generator] </label>
[init -> test-xml_generator] </config>
[init -> test-xml_generator]
[init -> test-xml_generator] used 199 bytes
[init -> test-xml_generator] used 200 bytes
[init -> test-xml_generator] buffer exceeded (expected error)
[init -> test-xml_generator] --- XML generator test finished ---
}

View File

@ -58,7 +58,7 @@ int main(int argc, char **argv)
* corresponding run script).
*/
size_t used = fill_buffer_with_xml(dst, sizeof(dst));
printf("result:\n\n%s\n\nused %zd bytes\n", dst, used);
printf("result:\n\n%s\nused %zd bytes\n", dst, used);
/*
* Test buffer overflow