10 status_t
unflatten_dano_message(uint32 magic
, BDataIO
& stream
, BMessage
& message
);
11 size_t dano_message_size(const char* buffer
);
15 extern const char* __progname
;
17 static const uint32 kMessageFormat
= 'FOB2';
18 static const uint32 kMessageFormatSwapped
= '2BOF';
22 main(int argc
, char** argv
)
25 fprintf(stderr
, "usage: %s <flattened dano message>\n", __progname
);
29 for (int32 i
= 1; i
< argc
; i
++) {
30 BFile
file(argv
[i
], B_READ_ONLY
);
31 if (file
.InitCheck() != B_OK
) {
32 fprintf(stderr
, "Could not open message \"%s\": %s\n", argv
[i
], strerror(file
.InitCheck()));
37 if (file
.GetSize(&size
) != B_OK
)
41 if (file
.Read(&magic
, sizeof(uint32
)) != sizeof(uint32
))
44 if (magic
!= kMessageFormat
&& magic
!= kMessageFormatSwapped
) {
45 fprintf(stderr
, "Not a dano message \"%s\"\n", argv
[i
]);
50 status_t status
= BPrivate::unflatten_dano_message(magic
, file
, message
);
52 message
.PrintToStream();
54 fprintf(stderr
, "Could not unflatten message: %s\n", strerror(status
));