Add a simple utility to dump flattened BMessages. Added it to the image as well.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31897 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2009-07-29 10:13:20 +00:00
parent 3f4b183da1
commit 473a578ad8
3 changed files with 38 additions and 1 deletions
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright 2009, Michael Lotz, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <File.h>
#include <Message.h>
#include <stdio.h>
#include <string.h>
int
main(int argc, char *argv[])
{
if (argc != 2) {
printf("usage: %s <flattened message file>\n", argv[0]);
return 1;
}
BFile input(argv[1], B_READ_ONLY);
if (!input.IsReadable()) {
printf("cannot open \"%s\" for reading\n", argv[1]);
return 2;
}
BMessage message;
status_t result = message.Unflatten(&input);
if (result != B_OK) {
printf("failed to unflatten message: %s\n", strerror(result));
return 3;
}
message.PrintToStream();
return 0;
}