Parse the argument given in the command line of the application */
| 549 | |
| 550 | /* Parse the argument given in the command line of the application */ |
| 551 | static int |
| 552 | parse_args(int argc, char **argv) |
| 553 | { |
| 554 | char *prgname = argv[0]; |
| 555 | int option_index; |
| 556 | char **argvopt; |
| 557 | int opt, ret; |
| 558 | |
| 559 | argvopt = argv; |
| 560 | |
| 561 | /* Error or normal output strings. */ |
| 562 | while ((opt = getopt_long(argc, argvopt, short_options, lgopts, |
| 563 | &option_index)) != EOF) { |
| 564 | |
| 565 | switch (opt) { |
| 566 | /* Portmask */ |
| 567 | case 'p': |
| 568 | enabled_port_mask = parse_portmask(optarg); |
| 569 | if (enabled_port_mask == 0) { |
| 570 | fprintf(stderr, "Invalid portmask\n"); |
| 571 | print_usage(prgname); |
| 572 | return -1; |
| 573 | } |
| 574 | break; |
| 575 | |
| 576 | case 'P': |
| 577 | promiscuous_on = 1; |
| 578 | break; |
| 579 | |
| 580 | /* Long options */ |
| 581 | case CMD_LINE_OPT_CONFIG_NUM: |
| 582 | ret = parse_config(optarg); |
| 583 | if (ret) { |
| 584 | fprintf(stderr, "Invalid config\n"); |
| 585 | print_usage(prgname); |
| 586 | return -1; |
| 587 | } |
| 588 | break; |
| 589 | |
| 590 | case CMD_LINE_OPT_ETH_DEST_NUM: |
| 591 | parse_eth_dest(optarg); |
| 592 | break; |
| 593 | |
| 594 | case CMD_LINE_OPT_NO_NUMA_NUM: |
| 595 | numa_on = 0; |
| 596 | break; |
| 597 | |
| 598 | case CMD_LINE_OPT_MAX_PKT_LEN_NUM: { |
| 599 | max_pkt_len = parse_max_pkt_len(optarg); |
| 600 | break; |
| 601 | } |
| 602 | |
| 603 | case CMD_LINE_OPT_PARSE_PER_PORT_POOL: |
| 604 | printf("Per port buffer pool is enabled\n"); |
| 605 | per_port_pool = 1; |
| 606 | break; |
| 607 | |
| 608 | case CMD_LINE_OPT_PARSE_PCAP_ENABLE: |
no test coverage detected