MCPcopy Create free account
hub / github.com/F-Stack/f-stack / read_options

Function read_options

tools/libutil/tests/humanize_number_test.c:406–438  ·  view source on GitHub ↗

Parse command line options */

Source from the content-addressed store, hash-verified

404
405/* Parse command line options */
406static void
407read_options(int argc, char * const argv[], size_t *bufLength,
408 int *includeNegativeScale, int *includeExabytes, int *verbose) {
409 int ch;
410 size_t temp;
411
412 while ((ch = getopt(argc, argv, "nEh?vl:")) != -1) {
413 switch (ch) {
414 default:
415 usage(argv[0]);
416 exit(1);
417 break; /* UNREACHABLE */
418 case 'h' :
419 case '?' :
420 usage(argv[0]);
421 exit(0);
422 break; /* UNREACHABLE */
423 case 'l' :
424 sscanf(optarg, "%zu", &temp);
425 *bufLength = temp + 1;
426 break;
427 case 'n' :
428 *includeNegativeScale = 1;
429 break;
430 case 'E' :
431 *includeExabytes = 1;
432 break;
433 case 'v' :
434 *verbose = 1;
435 break;
436 }
437 }
438}
439
440static struct {
441 int value;

Callers 1

mainFunction · 0.85

Calls 3

sscanfFunction · 0.85
usageFunction · 0.70
getoptFunction · 0.50

Tested by

no test coverage detected