X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=disassembler%2Fargs.c;h=67ba2fc7a4d7d92706d1b1c2772bfd24345a09e2;hb=d24a5147fd500f6bdc76599d2a4e471b15a73c7f;hp=2848089facd417a17838e1ba4c9bdb0c5bad7295;hpb=2e928c1b94243e38477f113b92d78876a15439be;p=b43-tools.git diff --git a/disassembler/args.c b/disassembler/args.c index 2848089..67ba2fc 100644 --- a/disassembler/args.c +++ b/disassembler/args.c @@ -25,7 +25,9 @@ int _debug; struct cmdline_args cmdargs = { - .arch = 5, /* Default to v5 architecture. */ + .arch = 5, /* Default to v5 architecture. */ + .no_header = 0, /* Input file does not have a header. */ + .print_addresses = 0, /* Print the code addresses in the output. */ }; #define ARG_MATCH 0 @@ -64,7 +66,7 @@ static int do_cmp_arg(char **argv, int *pos, if (param) { /* Skip the parameter on the next iteration. */ (*pos)++; - if (*param == 0) { + if (*param == NULL) { fprintf(stderr, "%s needs a parameter\n", arg); return ARG_ERROR; } @@ -99,6 +101,8 @@ static void usage(int argc, char **argv) fprintf(stderr, "Usage: %s INPUT_FILE OUTPUT_FILE [OPTIONS]\n", argv[0]); fprintf(stderr, " -a|--arch ARCH The architecture type of the input file\n"); fprintf(stderr, " -h|--help Print this help\n"); + fprintf(stderr, " --nohdr The input file does not have a header\n"); + fprintf(stderr, " --paddr Print the code addresses\n"); fprintf(stderr, " -d|--debug Print verbose debugging info\n"); fprintf(stderr, " Repeat for more verbose debugging\n"); } @@ -113,10 +117,14 @@ int parse_args(int argc, char **argv) outfile_name = NULL; for (i = 1; i < argc; i++) { - if ((res = cmp_arg(argv, &i, "--help", "-h", 0)) == ARG_MATCH) { + if ((res = cmp_arg(argv, &i, "--help", "-h", NULL)) == ARG_MATCH) { usage(argc, argv); return 1; - } else if ((res = cmp_arg(argv, &i, "--debug", "-d", 0)) == ARG_MATCH) { + } else if ((res = cmp_arg(argv, &i, "--nohdr", NULL, NULL)) == ARG_MATCH) { + cmdargs.no_header = 1; + } else if ((res = cmp_arg(argv, &i, "--paddr", NULL, NULL)) == ARG_MATCH) { + cmdargs.print_addresses = 1; + } else if ((res = cmp_arg(argv, &i, "--debug", "-d", NULL)) == ARG_MATCH) { _debug++; } else if ((res = cmp_arg(argv, &i, "--arch", "-a", ¶m)) == ARG_MATCH) { unsigned long arch;