source: trunk/tools/common/kDump.cpp@ 5053

Last change on this file since 5053 was 5053, checked in by bird, 25 years ago

Corrected kFileLX and kFilePE constructors.
Made kDump.exe work again.
Added import module dump to kFilePE.

File size: 1.9 KB
Line 
1/* $Id: kDump.cpp,v 1.2 2001-02-02 08:45:41 bird Exp $
2 *
3 * Generic dumper...
4 *
5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12
13/*******************************************************************************
14* Defined Constants And Macros *
15*******************************************************************************/
16#define INCL_BASE
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <os2.h>
22
23#include <stdio.h>
24
25#include "kFile.h"
26#include "kFileFormatBase.h"
27#include "kFileDef.h"
28#include "kFileLX.h"
29#include "kFilePE.h"
30
31
32
33
34int main(int argc, char **argv)
35{
36 int argi;
37
38
39 for (argi = 1; argi < argc; argi++)
40 {
41 try
42 {
43 kFile file(argv[argi]);
44 kFileFormatBase * pFile = NULL;
45 try {pFile = new kFilePE(&file);}
46 catch (int err)
47 {
48 try {pFile = new kFileLX(&file);}
49 catch (int err)
50 {
51 try {pFile = new kFileDef(&file);}
52 catch (int err)
53 {
54 kFile::StdErr.printf("Failed to recognize file %s.\n", argv[argi]);
55 return -2;
56 }
57 }
58 }
59
60 /*
61 * If successfully opened, then dump it.
62 */
63 if (pFile != NULL)
64 {
65 pFile->dump(&kFile::StdOut);
66 delete pFile;
67 }
68 }
69 catch (int err)
70 {
71 fprintf(stderr, "Fatal: Failed to open file %s err=%d.\n", argv[argi], err);
72 return -1;
73 }
74 }
75 return 0;
76}
Note: See TracBrowser for help on using the repository browser.