| 88 | int g_utilDisplayLevel; |
| 89 | |
| 90 | int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, |
| 91 | const char* acceptableLetters, int hasStdinInput) { |
| 92 | int ch, result; |
| 93 | |
| 94 | if (hasStdinInput) { |
| 95 | UTIL_DISPLAY("stdin is an input - not proceeding.\n"); |
| 96 | return 1; |
| 97 | } |
| 98 | |
| 99 | UTIL_DISPLAY("%s", prompt); |
| 100 | ch = getchar(); |
| 101 | result = 0; |
| 102 | if (strchr(acceptableLetters, ch) == NULL) { |
| 103 | UTIL_DISPLAY("%s", abortMsg); |
| 104 | result = 1; |
| 105 | } |
| 106 | /* flush the rest */ |
| 107 | while ((ch!=EOF) && (ch!='\n')) |
| 108 | ch = getchar(); |
| 109 | return result; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | /*-************************************* |
no test coverage detected