Get host ip and port from command arguments. If only one argument has * been provided it must be in the form of 'ip:port', elsewhere * the first argument must be the ip and the second one the port. * If host and port can be detected, it returns 1 and it stores host and * port into variables referenced by'ip_ptr' and 'port_ptr' pointers, * elsewhere it returns 0. */
| 2634 | * port into variables referenced by'ip_ptr' and 'port_ptr' pointers, |
| 2635 | * elsewhere it returns 0. */ |
| 2636 | static int getClusterHostFromCmdArgs(int argc, char **argv, |
| 2637 | char **ip_ptr, int *port_ptr) { |
| 2638 | int port = 0; |
| 2639 | char *ip = NULL; |
| 2640 | if (argc == 1) { |
| 2641 | char *addr = argv[0]; |
| 2642 | if (!parseClusterNodeAddress(addr, &ip, &port, NULL)) return 0; |
| 2643 | } else { |
| 2644 | ip = argv[0]; |
| 2645 | port = atoi(argv[1]); |
| 2646 | } |
| 2647 | if (!ip || !port) return 0; |
| 2648 | else { |
| 2649 | *ip_ptr = ip; |
| 2650 | *port_ptr = port; |
| 2651 | } |
| 2652 | return 1; |
| 2653 | } |
| 2654 | |
| 2655 | static void freeClusterManagerNodeFlags(list *flags) { |
| 2656 | listIter li; |
no test coverage detected