| 28 | } |
| 29 | |
| 30 | int main(int argc, char *argv[]) |
| 31 | { |
| 32 | int c; |
| 33 | struct buffer elfin; |
| 34 | struct buffer elfout; |
| 35 | const char *input_file = NULL; |
| 36 | const char *output_file = NULL; |
| 37 | |
| 38 | if (argc < 3) { |
| 39 | usage(argv[0]); |
| 40 | return 1; |
| 41 | } |
| 42 | |
| 43 | while (1) { |
| 44 | int optindex = 0; |
| 45 | |
| 46 | c = getopt_long(argc, argv, optstring, long_options, &optindex); |
| 47 | |
| 48 | if (c == -1) |
| 49 | break; |
| 50 | |
| 51 | switch (c) { |
| 52 | case 'i': |
| 53 | input_file = optarg; |
| 54 | break; |
| 55 | case 'h': |
| 56 | usage(argv[0]); |
| 57 | return 1; |
| 58 | case 'o': |
| 59 | output_file = optarg; |
| 60 | break; |
| 61 | case 'v': |
| 62 | verbose++; |
| 63 | break; |
| 64 | default: |
| 65 | break; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | if (input_file == NULL || output_file == NULL) { |
| 70 | usage(argv[0]); |
| 71 | return 1; |
| 72 | } |
| 73 | |
| 74 | if (buffer_from_file(&elfin, input_file)) { |
| 75 | ERROR("Couldn't read in file '%s'.\n", input_file); |
| 76 | return 1; |
| 77 | } |
| 78 | |
| 79 | if (rmodule_create(&elfin, &elfout)) { |
| 80 | ERROR("Unable to create rmodule from '%s'.\n", input_file); |
| 81 | return 1; |
| 82 | } |
| 83 | |
| 84 | if (buffer_write_file(&elfout, output_file)) { |
| 85 | ERROR("Unable to write rmodule elf '%s'.\n", output_file); |
| 86 | return 1; |
| 87 | } |
nothing calls this directly
no test coverage detected