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

Function main

tools/corosync-quorumtool.c:884–1023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882}
883
884int main (int argc, char *argv[]) {
885 const char *options = "VHaslpmfe:v:hin:o:";
886 int opt;
887 int votes = 0;
888 int ret = 0;
889 uint32_t nodeid = 0;
890 uint32_t nodeid_set = 0;
891 nodeid_format_t nodeid_format = NODEID_FORMAT_DECIMAL;
892 name_format_t address_format = ADDRESS_FORMAT_NAME;
893 command_t command_opt = CMD_SHOWSTATUS;
894 sorttype_t sort_opt = SORT_ADDR;
895 long long int l;
896
897 while ( (opt = getopt(argc, argv, options)) != -1 ) {
898 switch (opt) {
899 case 'f':
900 command_opt = CMD_UNREGISTER_QDEVICE;
901 break;
902 case 's':
903 command_opt = CMD_SHOWSTATUS;
904 break;
905 case 'a':
906 g_show_all_addrs = 1;
907 break;
908 case 'm':
909 command_opt = CMD_MONITOR;
910 break;
911 case 'i':
912 address_format = ADDRESS_FORMAT_IP;
913 break;
914 case 'H':
915 nodeid_format = NODEID_FORMAT_HEX;
916 break;
917 case 'l':
918 command_opt = CMD_SHOWNODES;
919 break;
920 case 'p':
921 machine_parsable = 1;
922 break;
923 case 'e':
924 if (util_strtonum(optarg, 1, INT_MAX, &l) == -1) {
925 fprintf(stderr, "New expected votes value was not valid, try a positive number\n");
926 exit(EXIT_FAILURE);
927 }
928 votes = l;
929 command_opt = CMD_SETEXPECTED;
930 break;
931 case 'n':
932 if (util_strtonum(optarg, 1, UINT_MAX, &l) == -1) {
933 fprintf(stderr, "The nodeid was not valid, try a positive number\n");
934 exit(EXIT_FAILURE);
935 }
936 nodeid = l;
937 nodeid_set = 1;
938 break;
939 case 'v':
940 if (util_strtonum(optarg, 0, INT_MAX, &l) == -1) {
941 fprintf(stderr, "New votes value was not valid, try a positive number or zero\n");

Callers

nothing calls this directly

Calls 11

util_strtonumFunction · 0.85
show_usageFunction · 0.85
init_allFunction · 0.85
close_allFunction · 0.85
show_nodesFunction · 0.85
show_statusFunction · 0.85
using_votequorumFunction · 0.85
monitor_statusFunction · 0.85
unregister_qdeviceFunction · 0.85
set_votesFunction · 0.70
set_expectedFunction · 0.70

Tested by

no test coverage detected