Changeset 309
- Timestamp:
- Mar 7, 2006 4:02:26 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsip-perf/main.c
r271 r309 397 397 OPT_DURATION 398 398 }; 399 struct option long_opts[] = {399 struct pj_getopt_option long_opts[] = { 400 400 { "help", 0, 0, OPT_HELP}, 401 401 { "version", 0, 0, OPT_VERSION}, … … 413 413 int c, option_index; 414 414 415 optind = 0;416 while ((c= getopt_long(argc, argv, "", long_opts, &option_index)) != -1) {415 pj_optind = 0; 416 while ((c=pj_getopt_long(argc, argv, "", long_opts, &option_index)) != -1) { 417 417 switch (c) { 418 418 … … 426 426 427 427 case OPT_LOG_LEVEL: 428 settings.log_level = atoi( optarg);428 settings.log_level = atoi(pj_optarg); 429 429 break; 430 430 431 431 case OPT_APP_LOG_LEVEL: 432 settings.app_log_level = atoi( optarg);432 settings.app_log_level = atoi(pj_optarg); 433 433 break; 434 434 435 435 case OPT_LOG_FILE: 436 settings.log_file = optarg;436 settings.log_file = pj_optarg; 437 437 break; 438 438 439 439 case OPT_LOCAL_PORT: 440 settings.local_port = atoi( optarg);440 settings.local_port = atoi(pj_optarg); 441 441 if (settings.local_port < 1 || settings.local_port > 65535) { 442 PJ_LOG(1,(THIS_FILE,"Invalid --local-port %s", optarg));442 PJ_LOG(1,(THIS_FILE,"Invalid --local-port %s", pj_optarg)); 443 443 return PJ_EINVAL; 444 444 } … … 450 450 451 451 case OPT_THREAD_CNT: 452 settings.thread_cnt = atoi( optarg);452 settings.thread_cnt = atoi(pj_optarg); 453 453 if (settings.thread_cnt < 1 || 454 454 settings.thread_cnt > PJ_ARRAY_SIZE(settings.thread)) 455 455 { 456 PJ_LOG(1,(THIS_FILE,"Invalid --thread-cnt %s", optarg));456 PJ_LOG(1,(THIS_FILE,"Invalid --thread-cnt %s", pj_optarg)); 457 457 return PJ_EINVAL; 458 458 } … … 460 460 461 461 case OPT_START_RATE: 462 settings.start_rate = atoi( optarg);462 settings.start_rate = atoi(pj_optarg); 463 463 if (settings.start_rate < 1 || settings.start_rate > 1000000) { 464 PJ_LOG(1,(THIS_FILE,"Invalid --start-rate %s", optarg));464 PJ_LOG(1,(THIS_FILE,"Invalid --start-rate %s", pj_optarg)); 465 465 return PJ_EINVAL; 466 466 } … … 468 468 469 469 case OPT_MAX_CAPACITY: 470 settings.max_capacity = atoi( optarg);470 settings.max_capacity = atoi(pj_optarg); 471 471 if (settings.max_capacity < 1 || settings.max_capacity > 65000) { 472 472 PJ_LOG(1,(THIS_FILE, 473 473 "Invalid --max-capacity %s (range=1-65000)", 474 optarg));474 pj_optarg)); 475 475 return PJ_EINVAL; 476 476 } … … 478 478 479 479 case OPT_DURATION: 480 settings.duration = atoi( optarg);480 settings.duration = atoi(pj_optarg); 481 481 if (settings.duration < 0 || settings.duration > 1000000) { 482 PJ_LOG(1,(THIS_FILE,"Invalid --duration %s", optarg));482 PJ_LOG(1,(THIS_FILE,"Invalid --duration %s", pj_optarg)); 483 483 return PJ_EINVAL; 484 484 } … … 488 488 } 489 489 490 if ( optind != argc) {491 if (verify_sip_url(argv[ optind]) != PJ_SUCCESS) {492 PJ_LOG(3,(THIS_FILE, "Invalid SIP URL %s", argv[ optind]));490 if (pj_optind != argc) { 491 if (verify_sip_url(argv[pj_optind]) != PJ_SUCCESS) { 492 PJ_LOG(3,(THIS_FILE, "Invalid SIP URL %s", argv[pj_optind])); 493 493 return PJ_EINVAL; 494 494 } 495 495 496 settings.target = pj_str(argv[ optind]);497 ++ optind;498 } 499 500 if ( optind != argc) {501 printf("Error: unknown options %s\n", argv[ optind]);496 settings.target = pj_str(argv[pj_optind]); 497 ++pj_optind; 498 } 499 500 if (pj_optind != argc) { 501 printf("Error: unknown options %s\n", argv[pj_optind]); 502 502 return PJ_EINVAL; 503 503 } … … 725 725 puts ("| m Change mode | |"); 726 726 puts ("| + - Increment/decrement rate by 10 | d Dump status |"); 727 puts ("| * / Increment/decrement rate by 100 | d 1Dump detailed (e.g. tables) |");727 puts ("| * / Increment/decrement rate by 100 | dd Dump detailed (e.g. tables) |"); 728 728 puts ("+--------------------------------------+-------------------------------------+"); 729 729 puts ("| Test Commands |"); … … 816 816 817 817 case 'd': 818 dump(menuin[1]==' 1');818 dump(menuin[1]=='d'); 819 819 break; 820 820
Note: See TracChangeset
for help on using the changeset viewer.