FreeCalypso > hg > freecalypso-reveng
annotate ticoff/main.c @ 80:da103b9377e3
tiobjd: preparation for symbol sorting
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 26 Mar 2014 02:44:19 +0000 |
parents | 8f4996bff904 |
children | 192da19c7506 |
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(); |
79
8f4996bff904
tiobjd: profile operation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
77
diff
changeset
|
13 extern int cmd_profile(); |
71
c15cd3d695c0
tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
70
diff
changeset
|
14 extern int cmd_sechdr(); |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
15 extern int cmd_symtab(); |
70 | 16 extern int dump_filehdr_info(); |
17 | |
18 static struct cmdtab { | |
19 char *cmd; | |
20 int (*func)(); | |
21 } cmdtab[] = { | |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
22 {"basics", cmd_basics}, |
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
23 {"dumpsym", cmd_symtab}, /* backward compat */ |
70 | 24 {"hdr", dump_filehdr_info}, |
79
8f4996bff904
tiobjd: profile operation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
77
diff
changeset
|
25 {"profile", cmd_profile}, |
71
c15cd3d695c0
tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
70
diff
changeset
|
26 {"sechdr", cmd_sechdr}, |
77
590396e27e96
tiobjd: basics dump streamlined
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
75
diff
changeset
|
27 {"symtab", cmd_symtab}, |
70 | 28 {0, 0} |
29 }; | |
30 | |
31 main(argc, argv) | |
32 char **argv; | |
33 { | |
34 struct cmdtab *tp; | |
35 | |
36 if (argc != 3) { | |
37 fprintf(stderr, "usage: %s <objfile> <op>\n", argv[0]); | |
38 exit(1); | |
39 } | |
40 objfilename = argv[1]; | |
41 mmap_objfile(); | |
42 initial_parse_hdr(); | |
43 for (tp = cmdtab; tp->cmd; tp++) | |
44 if (!strcmp(tp->cmd, argv[2])) | |
45 break; | |
46 if (!tp->func) { | |
47 fprintf(stderr, "\"%s\": unknown or unimplemented command\n", | |
48 argv[2]); | |
49 exit(1); | |
50 } | |
51 return tp->func(); | |
52 } |