1 /* 2 * Copyright 2002, Marcus Overhagen. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include <File.h> 7 #include <Message.h> 8 #include <stdio.h> 9 10 int main(int argc, char *argv[]) 11 { 12 BFile file; 13 BMessage msg; 14 if (argc != 2) { 15 fprintf(stderr, "You need to specify a filename on the command line.\n"); 16 return 1; 17 } 18 if (B_OK != file.SetTo(argv[1], O_RDONLY)) { 19 fprintf(stderr, "File \"%s\" not found.\n", argv[1]); 20 return 1; 21 } 22 if (B_OK != msg.Unflatten(&file)) { 23 fprintf(stderr, "Unflatten failed.\n"); 24 return 1; 25 } 26 msg.PrintToStream(); 27 return 0; 28 } 29