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

View File

@ -44,7 +44,7 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
keymap kill less lessecho lesskey link linkcatkeys listarea listattr
listimage listdev
listport listres listsem listusb ln locate logger login logname ls lsindex
makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex
makebootable md5sum merge message mimeset mkdos mkdir mkfifo mkfs mkindex
modifiers mount mount_nfs mountvolume mv
nc netstat nl nohup
od open

View File

@ -88,6 +88,7 @@ StdBinCommands
listres.cpp
mimeset.cpp
mkindex.cpp
message.cpp
modifiers.cpp
open.cpp
play.cpp

36
src/bin/message.cpp Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright 2009, Michael Lotz, mmlr@mlotz.ch.
* 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;
}