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"
21 " --copy Copy input to output\n"
27 void parseOptions(CLIOpts *opts, int argc, char **argv)
29 char *progname = argv[0];
33 static struct option long_options[] = {
35 {"output", 1, 0, 'o'},
36 {"print-header", 0, 0, 10001},
37 {"print-segments", 0, 0, 10002},
38 {"print-sections", 0, 0, 10003},
39 {"copy", 0, 0, 10004},
43 while ((c = getopt_long(argc, argv, "e:ho:",
44 long_options, &option_index)) != -1) {
50 opts->fnOutput = optarg;
53 opts->printHeader = 1;
56 opts->printSegments = 1;
59 opts->printSections = 1;
70 while (optind < argc) {
72 opts->fnInput = argv[optind];
78 fprintf(stderr, "Error: No input file specified.\n\n");