Rev | Line | |
---|
[8003] | 1 | /* $Id: kDump.cpp,v 1.4 2002-02-24 02:47:24 bird Exp $
|
---|
[4360] | 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 <stdio.h>
|
---|
| 22 |
|
---|
[8003] | 23 | #include "kTypes.h"
|
---|
| 24 | #include "kError.h"
|
---|
[4360] | 25 | #include "kFile.h"
|
---|
| 26 | #include "kFileFormatBase.h"
|
---|
[8003] | 27 | #include "kFileInterfaces.h"
|
---|
[4360] | 28 | #include "kFileDef.h"
|
---|
| 29 | #include "kFileLX.h"
|
---|
| 30 | #include "kFilePE.h"
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | int main(int argc, char **argv)
|
---|
| 36 | {
|
---|
| 37 | int argi;
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | for (argi = 1; argi < argc; argi++)
|
---|
| 41 | {
|
---|
[5053] | 42 | try
|
---|
[4360] | 43 | {
|
---|
[5053] | 44 | kFileFormatBase * pFile = NULL;
|
---|
[8003] | 45 | try {pFile = new kFilePE(new kFile(argv[argi]));}
|
---|
| 46 | catch (kError err)
|
---|
[4360] | 47 | {
|
---|
[8003] | 48 | try {pFile = new kFileLX(new kFile(argv[argi]));}
|
---|
| 49 | catch (kError err)
|
---|
[4360] | 50 | {
|
---|
[8003] | 51 | try {pFile = new kFileDef(new kFile(argv[argi]));}
|
---|
| 52 | catch (kError err)
|
---|
[4360] | 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 | }
|
---|
[8003] | 69 | catch (kError err)
|
---|
[4360] | 70 | {
|
---|
[8003] | 71 | fprintf(stderr, "Fatal: Failed to open file %s err=%d.\n", argv[argi], err.getErrno());
|
---|
[4360] | 72 | return -1;
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | return 0;
|
---|
| 76 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.