| 2012 | } |
| 2013 | |
| 2014 | static int confirmWithYes(char *msg, int ignore_force) { |
| 2015 | /* if --cluster-yes option is set and ignore_force is false, |
| 2016 | * do not prompt for an answer */ |
| 2017 | if (!ignore_force && |
| 2018 | (config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES)) { |
| 2019 | return 1; |
| 2020 | } |
| 2021 | |
| 2022 | printf("%s (type 'yes' to accept): ", msg); |
| 2023 | fflush(stdout); |
| 2024 | char buf[4]; |
| 2025 | int nread = read(fileno(stdin),buf,4); |
| 2026 | buf[3] = '\0'; |
| 2027 | return (nread != 0 && !strcmp("yes", buf)); |
| 2028 | } |
| 2029 | |
| 2030 | /* Create an sds array from argv, either as-is or by dequoting every |
| 2031 | * element. When quoted is non-zero, may return a NULL to indicate an |
no test coverage detected