| 1824 | } |
| 1825 | |
| 1826 | int confirmWithYes(const char *msg, int ignore_force) { |
| 1827 | /* if --cluster-yes option is set and ignore_force is false, |
| 1828 | * do not prompt for an answer */ |
| 1829 | if (!ignore_force && |
| 1830 | (config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES)) { |
| 1831 | return 1; |
| 1832 | } |
| 1833 | |
| 1834 | printf("%s (type 'yes' to accept): ", msg); |
| 1835 | fflush(stdout); |
| 1836 | char buf[4]; |
| 1837 | int nread = read(fileno(stdin),buf,4); |
| 1838 | buf[3] = '\0'; |
| 1839 | return (nread != 0 && !strcmp("yes", buf)); |
| 1840 | } |
| 1841 | |
| 1842 | /* Create an sds array from argv, either as-is or by dequoting every |
| 1843 | * element. When quoted is non-zero, may return a NULL to indicate an |
no outgoing calls
no test coverage detected