9 static void printUsage(char *progname)
11 printf("Usage: %s [OPTIONS] <elf-file>\n", progname);
14 " -h, --help Print this help message\n"
15 " -o, --output Where to write the modified ELF file to\n"
17 " --print-header Print ELF header\n"
18 " --print-segments Print program headers\n"
19 " --print-sections Print sections\n"
25 void parseOptions(CLIOpts *opts, int argc, char **argv)
27 char *progname = argv[0];
31 static struct option long_options[] = {
33 {"output", 1, 0, 'o'},
34 {"print-header", 0, 0, 10001},
35 {"print-segments", 0, 0, 10002},
36 {"print-sections", 0, 0, 10003},
40 while ((c = getopt_long(argc, argv, "e:ho:",
41 long_options, &option_index)) != -1) {
47 opts->fnOutput = optarg;
50 opts->printHeader = 1;
53 opts->printSegments = 1;
56 opts->printSections = 1;
64 while (optind < argc) {
66 opts->fnInput = argv[optind];
72 fprintf(stderr, "Error: No input file specified.\n\n");