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:
parent
dcf2d78c94
commit
7120e97489
@ -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 ;
|
||||
|
||||
|
4
src/tools/unflatten/Jamfile
Normal file
4
src/tools/unflatten/Jamfile
Normal file
@ -0,0 +1,4 @@
|
||||
SubDir OBOS_TOP src tools unflatten ;
|
||||
|
||||
BinCommand unflatten : unflatten.cpp : be ;
|
||||
|
28
src/tools/unflatten/unflatten.cpp
Normal file
28
src/tools/unflatten/unflatten.cpp
Normal 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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user