MCPcopy Create free account
hub / github.com/coreboot/coreboot / main

Function main

util/cbfstool/cbfstool.c:2117–2459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2115}
2116
2117int main(int argc, char **argv)
2118{
2119 size_t i;
2120 int c;
2121
2122 if (argc < 3) {
2123 usage(argv[0]);
2124 return 1;
2125 }
2126
2127 char *image_name = argv[1];
2128 char *cmd = argv[2];
2129 optind += 2;
2130
2131 for (i = 0; i < ARRAY_SIZE(commands); i++) {
2132 if (strcmp(cmd, commands[i].name) != 0)
2133 continue;
2134
2135 while (1) {
2136 char *suffix = NULL;
2137 int option_index = 0;
2138
2139 c = getopt_long(argc, argv, commands[i].optstring,
2140 long_options, &option_index);
2141 if (c == -1) {
2142 if (optind < argc) {
2143 ERROR("%s: excessive argument -- '%s'"
2144 "\n", argv[0], argv[optind]);
2145 return 1;
2146 }
2147 break;
2148 }
2149
2150 /* Filter out illegal long options */
2151 if (!valid_opt(i, c)) {
2152 ERROR("%s: invalid option -- '%d'\n",
2153 argv[0], c);
2154 c = '?';
2155 }
2156
2157 switch(c) {
2158 case 'n':
2159 param.name = optarg;
2160 break;
2161 case 't':
2162 if (intfiletype(optarg) != ((uint64_t) - 1))
2163 param.type = intfiletype(optarg);
2164 else
2165 param.type = strtoul(optarg, NULL, 0);
2166 if (param.type == 0)
2167 WARN("Unknown type '%s' ignored\n",
2168 optarg);
2169 break;
2170 case 'c': {
2171 if (strcmp(optarg, "precompression") == 0) {
2172 param.precompression = 1;
2173 break;
2174 }

Callers

nothing calls this directly

Calls 15

getopt_longFunction · 0.85
intfiletypeFunction · 0.85
cbfs_parse_comp_algoFunction · 0.85
string_to_archFunction · 0.85
decode_mmap_argFunction · 0.85
buffer_from_fileFunction · 0.85
partitioned_file_createFunction · 0.85
buffer_deleteFunction · 0.85
partitioned_file_reopenFunction · 0.85
strlenFunction · 0.85
partitioned_file_closeFunction · 0.85

Tested by

no test coverage detected