blob: 511aa456b981fec212d7eb1f23dc190383960d44 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <tdump/disassembler.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
static const char *cmdline_usage =
"tdump trinary deassembler usage:\n"
" tdump infile\n"
" -h Show usage (this)\n"
" infile File to deassemble\n"
;
static void usage()
{
fprintf(stderr, cmdline_usage);
}
int main(int argc, char *argv[])
{
int opt;
while ((opt = getopt(argc, argv, "h")) != -1) {
switch (opt) {
case 'h':
usage();
exit(EXIT_SUCCESS);
break;
default:
usage();
exit(EXIT_FAILURE);
break;
}
}
if (optind >= argc) {
fprintf(stderr, "no input files\n");
usage();
exit(EXIT_FAILURE);
}
if (optind != argc - 1) {
fprintf(stderr, "too many input files\n");
usage();
exit(EXIT_FAILURE);
}
if (disassemble(argv[optind]))
exit(EXIT_FAILURE);
return EXIT_SUCCESS;
}
|