aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-29 17:28:17 +0100
committerChristian Grothoff <christian@grothoff.org>2019-10-29 17:28:17 +0100
commit6edff51bf6044779a42bac7b964a08d44b45fe0b (patch)
tree262937f22abb94675b66d32a48f45e0f0fd72261
parent472c97b31a02ccfa9da9b14a35653e9e6b2e511b (diff)
downloadmerchant-6edff51bf6044779a42bac7b964a08d44b45fe0b.tar.gz
merchant-6edff51bf6044779a42bac7b964a08d44b45fe0b.zip
style fixes
-rw-r--r--src/merchant-tools/taler-merchant-benchmark.c71
1 files changed, 20 insertions, 51 deletions
diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c
index 289da241..f1e3b578 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -118,7 +118,7 @@ static unsigned int twocoins_number = 1;
118/** 118/**
119 * Exit code. 119 * Exit code.
120 */ 120 */
121static unsigned int result; 121static int result;
122 122
123/** 123/**
124 * Bank process. 124 * Bank process.
@@ -551,55 +551,37 @@ int
551main (int argc, 551main (int argc,
552 char *const *argv) 552 char *const *argv)
553{ 553{
554 default_config_file = GNUNET_OS_project_data_get
555 ()->user_config_file;
556
557 loglev = NULL;
558 GNUNET_log_setup ("taler-merchant-benchmark",
559 loglev,
560 logfile);
561
562 struct GNUNET_GETOPT_CommandLineOption *options; 554 struct GNUNET_GETOPT_CommandLineOption *options;
563
564 struct GNUNET_GETOPT_CommandLineOption root_options[] = { 555 struct GNUNET_GETOPT_CommandLineOption root_options[] = {
565
566 GNUNET_GETOPT_option_cfgfile 556 GNUNET_GETOPT_option_cfgfile
567 (&cfg_filename), 557 (&cfg_filename),
568
569 GNUNET_GETOPT_option_version 558 GNUNET_GETOPT_option_version
570 (PACKAGE_VERSION " " VCS_VERSION), 559 (PACKAGE_VERSION " " VCS_VERSION),
571
572 GNUNET_GETOPT_option_flag 560 GNUNET_GETOPT_option_flag
573 ('h', 561 ('h',
574 "help", 562 "help",
575 NULL, 563 NULL,
576 &root_help), 564 &root_help),
577
578 GNUNET_GETOPT_OPTION_END 565 GNUNET_GETOPT_OPTION_END
579 }; 566 };
580 567
581 struct GNUNET_GETOPT_CommandLineOption corner_options[] = { 568 struct GNUNET_GETOPT_CommandLineOption corner_options[] = {
582
583 GNUNET_GETOPT_option_help 569 GNUNET_GETOPT_option_help
584 ("Populate databases with corner case payments"), 570 ("Populate databases with corner case payments"),
585
586 GNUNET_GETOPT_option_loglevel 571 GNUNET_GETOPT_option_loglevel
587 (&loglev), 572 (&loglev),
588
589 GNUNET_GETOPT_option_uint 573 GNUNET_GETOPT_option_uint
590 ('u', 574 ('u',
591 "unaggregated-number", 575 "unaggregated-number",
592 "UN", 576 "UN",
593 "will generate UN unaggregated payments, defaults to 1", 577 "will generate UN unaggregated payments, defaults to 1",
594 &unaggregated_number), 578 &unaggregated_number),
595
596 GNUNET_GETOPT_option_uint 579 GNUNET_GETOPT_option_uint
597 ('t', 580 ('t',
598 "two-coins", 581 "two-coins",
599 "TC", 582 "TC",
600 "will perform TC 2-coins payments, defaults to 1", 583 "will perform TC 2-coins payments, defaults to 1",
601 &twocoins_number), 584 &twocoins_number),
602
603 /** 585 /**
604 * NOTE: useful when the setup serves merchant 586 * NOTE: useful when the setup serves merchant
605 * backends via unix domain sockets, since there 587 * backends via unix domain sockets, since there
@@ -613,14 +595,12 @@ main (int argc,
613 "MU", 595 "MU",
614 "merchant base url, mandatory", 596 "merchant base url, mandatory",
615 &merchant_url), 597 &merchant_url),
616
617 GNUNET_GETOPT_option_string 598 GNUNET_GETOPT_option_string
618 ('k', 599 ('k',
619 "currency", 600 "currency",
620 "K", 601 "K",
621 "Used currency, mandatory", 602 "Used currency, mandatory",
622 &currency), 603 &currency),
623
624 GNUNET_GETOPT_option_string 604 GNUNET_GETOPT_option_string
625 ('i', 605 ('i',
626 "alt-instance", 606 "alt-instance",
@@ -634,53 +614,43 @@ main (int argc,
634 " as they would get those far future ones" 614 " as they would get those far future ones"
635 " aggregated too.", 615 " aggregated too.",
636 &alt_instance_id), 616 &alt_instance_id),
637
638 GNUNET_GETOPT_option_string 617 GNUNET_GETOPT_option_string
639 ('b', 618 ('b',
640 "bank-url", 619 "bank-url",
641 "BU", 620 "BU",
642 "bank base url, mandatory", 621 "bank base url, mandatory",
643 &bank_url), 622 &bank_url),
644
645 GNUNET_GETOPT_option_string 623 GNUNET_GETOPT_option_string
646 ('l', 624 ('l',
647 "logfile", 625 "logfile",
648 "LF", 626 "LF",
649 "will log to file LF", 627 "will log to file LF",
650 &logfile), 628 &logfile),
651
652 GNUNET_GETOPT_OPTION_END 629 GNUNET_GETOPT_OPTION_END
653 }; 630 };
654 631
655 struct GNUNET_GETOPT_CommandLineOption ordinary_options[] = { 632 struct GNUNET_GETOPT_CommandLineOption ordinary_options[] = {
656
657 GNUNET_GETOPT_option_cfgfile 633 GNUNET_GETOPT_option_cfgfile
658 (&cfg_filename), 634 (&cfg_filename),
659
660 GNUNET_GETOPT_option_version 635 GNUNET_GETOPT_option_version
661 (PACKAGE_VERSION " " VCS_VERSION), 636 (PACKAGE_VERSION " " VCS_VERSION),
662
663 GNUNET_GETOPT_option_help 637 GNUNET_GETOPT_option_help
664 ("Generate Taler ordinary payments" 638 ("Generate Taler ordinary payments"
665 " to populate the databases"), 639 " to populate the databases"),
666
667 GNUNET_GETOPT_option_loglevel 640 GNUNET_GETOPT_option_loglevel
668 (&loglev), 641 (&loglev),
669
670 GNUNET_GETOPT_option_uint 642 GNUNET_GETOPT_option_uint
671 ('p', 643 ('p',
672 "payments-number", 644 "payments-number",
673 "PN", 645 "PN",
674 "will generate PN payments, defaults to 1", 646 "will generate PN payments, defaults to 1",
675 &payments_number), 647 &payments_number),
676
677 GNUNET_GETOPT_option_uint 648 GNUNET_GETOPT_option_uint
678 ('t', 649 ('t',
679 "tracks-number", 650 "tracks-number",
680 "TN", 651 "TN",
681 "will perform TN /track operations, defaults to 1", 652 "will perform TN /track operations, defaults to 1",
682 &tracks_number), 653 &tracks_number),
683
684 /** 654 /**
685 * NOTE: useful when the setup serves merchant 655 * NOTE: useful when the setup serves merchant
686 * backends via unix domain sockets, since there 656 * backends via unix domain sockets, since there
@@ -694,26 +664,29 @@ main (int argc,
694 "MU", 664 "MU",
695 "merchant base url, mandatory", 665 "merchant base url, mandatory",
696 &merchant_url), 666 &merchant_url),
697
698 GNUNET_GETOPT_option_string 667 GNUNET_GETOPT_option_string
699 ('b', 668 ('b',
700 "bank-url", 669 "bank-url",
701 "BU", 670 "BU",
702 "bank base url, mandatory", 671 "bank base url, mandatory",
703 &bank_url), 672 &bank_url),
704
705 GNUNET_GETOPT_option_string 673 GNUNET_GETOPT_option_string
706 ('l', 674 ('l',
707 "logfile", 675 "logfile",
708 "LF", 676 "LF",
709 "will log to file LF", 677 "will log to file LF",
710 &logfile), 678 &logfile),
711
712 GNUNET_GETOPT_OPTION_END 679 GNUNET_GETOPT_OPTION_END
713 }; 680 };
714 681
715 options = root_options; 682 default_config_file = GNUNET_OS_project_data_get
683 ()->user_config_file;
716 684
685 loglev = NULL;
686 GNUNET_log_setup ("taler-merchant-benchmark",
687 loglev,
688 logfile);
689 options = root_options;
717 if (NULL != argv[1]) 690 if (NULL != argv[1])
718 { 691 {
719 if (0 == strcmp ("ordinary", argv[1])) 692 if (0 == strcmp ("ordinary", argv[1]))
@@ -728,11 +701,12 @@ main (int argc,
728 } 701 }
729 } 702 }
730 703
731 if (GNUNET_SYSERR != (result = GNUNET_GETOPT_run 704 if (GNUNET_SYSERR !=
732 ("taler-merchant-benchmark", 705 (result = GNUNET_GETOPT_run
733 options, 706 ("taler-merchant-benchmark",
734 argc, 707 options,
735 argv))) 708 argc,
709 argv)))
736 { 710 {
737 711
738 if (GNUNET_YES == root_help) 712 if (GNUNET_YES == root_help)
@@ -747,35 +721,30 @@ main (int argc,
747 if (0 == result) 721 if (0 == result)
748 return 0; 722 return 0;
749 } 723 }
750
751 if (-1 == result) 724 if (-1 == result)
752 {
753 return 1; 725 return 1;
754 } 726 if ( (GNUNET_YES != ordinary) &&
755 727 (GNUNET_YES != corner) )
756 if ((GNUNET_YES != ordinary) && (GNUNET_YES != corner))
757 { 728 {
758 fprintf (stderr, 729 fprintf (stderr,
759 "Please use 'ordinary' or 'corner' subcommands.\n"); 730 "Please use 'ordinary' or 'corner' subcommands.\n");
760 return 1; 731 return 1;
761 } 732 }
762 733
763 if ((GNUNET_YES == corner) && (NULL == alt_instance_id)) 734 if ( (GNUNET_YES == corner) &&
735 (NULL == alt_instance_id) )
764 { 736 {
765 fprintf (stderr, "option '-i' is mandatory" 737 fprintf (stderr,
766 " with sub-command 'corner'!\n"); 738 "option '-i' is mandatory with sub-command 'corner'!\n");
767 return 1; 739 return 1;
768 } 740 }
769
770 if (NULL == cfg_filename) 741 if (NULL == cfg_filename)
771 cfg_filename = (char *) default_config_file; 742 cfg_filename = (char *) default_config_file;
772
773 if (NULL == currency) 743 if (NULL == currency)
774 { 744 {
775 TALER_LOG_ERROR ("Option -k is mandatory!\n"); 745 TALER_LOG_ERROR ("Option -k is mandatory!\n");
776 return MISSING_CURRENCY; 746 return MISSING_CURRENCY;
777 } 747 }
778
779 if (NULL == merchant_url) 748 if (NULL == merchant_url)
780 { 749 {
781 TALER_LOG_ERROR ("Option -m is mandatory!\n"); 750 TALER_LOG_ERROR ("Option -m is mandatory!\n");