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

Function main

util/cbfstool/amdcompress.c:339–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339int main(int argc, char *argv[])
340{
341 int c;
342 char *inf = 0, *outf = 0, *scratch;
343 int direction = DIR_UNDEF;
344 size_t max_size = 0;
345
346 while (1) {
347 int optindex = 0;
348
349 c = getopt_long(argc, argv, optstring, long_options, &optindex);
350 if (c == -1)
351 break;
352
353 switch (c) {
354 case 'i':
355 inf = optarg;
356 break;
357 case 'o':
358 outf = optarg;
359 break;
360 case 'c':
361 if (direction != DIR_UNDEF)
362 usage();
363 direction = DIR_COMP;
364 break;
365 case 'p':
366 if (direction != DIR_UNDEF)
367 usage();
368 direction = DIR_COPY;
369 break;
370 case 'u':
371 if (direction != DIR_UNDEF)
372 usage();
373 direction = DIR_UNCOMP;
374 break;
375 case 'm':
376 max_size = strtoull(optarg, &scratch, 16);
377 break;
378 case 'h':
379 usage();
380 }
381 }
382 if (!inf || !outf || direction == DIR_UNDEF)
383 usage();
384
385 if (direction == DIR_COMP)
386 do_process(outf, inf, max_size, true);
387 else if (direction == DIR_COPY)
388 do_process(outf, inf, max_size, false);
389 else
390 do_uncompress(outf, inf, max_size);
391
392 return 0;
393}

Callers

nothing calls this directly

Calls 5

getopt_longFunction · 0.85
do_processFunction · 0.85
do_uncompressFunction · 0.85
usageFunction · 0.70
strtoullFunction · 0.50

Tested by

no test coverage detected