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"
26 void parseOptions(CLIOpts *opts, int argc, char **argv)
28 char *progname = argv[0];
32 static struct option long_options[] = {
34 {"output", 1, 0, 'o'},
35 {"print-header", 0, 0, 10001},
36 {"print-segments", 0, 0, 10002},
37 {"print-sections", 0, 0, 10003},
41 while ((c = getopt_long(argc, argv, "e:ho:",
42 long_options, &option_index)) != -1) {
48 opts->fnOutput = optarg;
51 opts->printHeader = 1;
54 opts->printSegments = 1;
57 opts->printSections = 1;
65 while (optind < argc) {
67 opts->fnInput = argv[optind];
73 fprintf(stderr, "Error: No input file specified.\n\n");