a small tool to print files that consist of a flattened BMessage

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2304 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-12-25 23:20:24 +00:00
parent dcf2d78c94
commit 7120e97489
3 changed files with 33 additions and 0 deletions

View File

@ -2,4 +2,5 @@ SubDir OBOS_TOP src tools ;
SubInclude OBOS_TOP src tools cppunit ;
SubInclude OBOS_TOP src tools hey ;
SubInclude OBOS_TOP src tools unflatten ;

View File

@ -0,0 +1,4 @@
SubDir OBOS_TOP src tools unflatten ;
BinCommand unflatten : unflatten.cpp : be ;

View File

@ -0,0 +1,28 @@
/*
* Copyright 2002, Marcus Overhagen. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <File.h>
#include <Message.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
BFile file;
BMessage msg;
if (argc != 2) {
fprintf(stderr, "You need to specify a filename on the command line.\n");
return 1;
}
if (B_OK != file.SetTo(argv[1], O_RDONLY)) {
fprintf(stderr, "File \"%s\" not found.\n", argv[1]);
return 1;
}
if (B_OK != msg.Unflatten(&file)) {
fprintf(stderr, "Unflatten failed.\n");
return 1;
}
msg.PrintToStream();
return 0;
}