| 938 | } |
| 939 | |
| 940 | int main(int argc, char **argv) |
| 941 | { |
| 942 | if (argc < 3) { |
| 943 | printf("Incorrect number of args(%d)!\n", argc); |
| 944 | usage(argv[0]); |
| 945 | return 1; |
| 946 | } |
| 947 | |
| 948 | const char *prog_name = argv[0]; |
| 949 | const char *image_name = argv[1]; |
| 950 | const char *cmd = argv[2]; |
| 951 | |
| 952 | size_t i; |
| 953 | |
| 954 | params.partition_type = NO_PARTITION_TYPE; |
| 955 | params.image_name = image_name; |
| 956 | |
| 957 | for (i = 0; i < ARRAY_SIZE(commands); i++) { |
| 958 | if (strcmp(cmd, commands[i].name)) |
| 959 | continue; |
| 960 | |
| 961 | int c; |
| 962 | int option_index; |
| 963 | |
| 964 | while (1) { |
| 965 | c = getopt_long(argc, argv, commands[i].optstring, |
| 966 | long_options, &option_index); |
| 967 | |
| 968 | if (c == -1) |
| 969 | break; |
| 970 | |
| 971 | if (!valid_opt(i, c)) { |
| 972 | if (c < LONGOPT_START) { |
| 973 | ERROR("Invalid option -- '%c'\n", c); |
| 974 | } else { |
| 975 | ERROR("Invalid option -- '%d'\n", c); |
| 976 | } |
| 977 | usage(prog_name); |
| 978 | return 1; |
| 979 | } |
| 980 | |
| 981 | switch (c) { |
| 982 | case 'f': |
| 983 | params.input_file = optarg; |
| 984 | break; |
| 985 | case 'n': |
| 986 | params.partition_name = optarg; |
| 987 | break; |
| 988 | case 'o': |
| 989 | params.output_dir = optarg; |
| 990 | break; |
| 991 | case 's': |
| 992 | params.print_sub_parts = true; |
| 993 | break; |
| 994 | case 'v': |
| 995 | params.version_str = optarg; |
| 996 | break; |
| 997 | case 't': |
nothing calls this directly
no test coverage detected