FreeCalypso > hg > freecalypso-reveng
annotate ticoff/main.c @ 77:590396e27e96
tiobjd: basics dump streamlined
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 25 Mar 2014 22:47:51 +0000 |
parents | 1a23ff9a81de |
children | 8f4996bff904 |
rev | line source |
---|---|
70 | 1 /* |
2 * tiobjd main() function and command dispatch | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include "globals.h" | |
11 | |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
12 extern int cmd_basics(); |
71
c15cd3d695c0
tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
70
diff
changeset
|
13 extern int cmd_sechdr(); |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
14 extern int cmd_symtab(); |
70 | 15 extern int dump_filehdr_info(); |
16 | |
17 static struct cmdtab { | |
18 char *cmd; | |
19 int (*func)(); | |
20 } cmdtab[] = { | |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
21 {"basics", cmd_basics}, |
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
22 {"dumpsym", cmd_symtab}, /* backward compat */ |
70 | 23 {"hdr", dump_filehdr_info}, |
71
c15cd3d695c0
tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
70
diff
changeset
|
24 {"sechdr", cmd_sechdr}, |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
25 {"symtab", cmd_symtab}, |
70 | 26 {0, 0} |
27 }; | |
28 | |
29 main(argc, argv) | |
30 char **argv; | |
31 { | |
32 struct cmdtab *tp; | |
33 | |
34 if (argc != 3) { | |
35 fprintf(stderr, "usage: %s <objfile> <op>\n", argv[0]); | |
36 exit(1); | |
37 } | |
38 objfilename = argv[1]; | |
39 mmap_objfile(); | |
40 initial_parse_hdr(); | |
41 for (tp = cmdtab; tp->cmd; tp++) | |
42 if (!strcmp(tp->cmd, argv[2])) | |
43 break; | |
44 if (!tp->func) { | |
45 fprintf(stderr, "\"%s\": unknown or unimplemented command\n", | |
46 argv[2]); | |
47 exit(1); | |
48 } | |
49 return tp->func(); | |
50 } |