mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
Unified warning prompts into new function UTIL_requireUserConfirmationToProceed()
This commit is contained in:
@ -87,6 +87,22 @@ UTIL_STATIC void* UTIL_realloc(void *ptr, size_t size)
|
||||
******************************************/
|
||||
int g_utilDisplayLevel;
|
||||
|
||||
int UTIL_requireUserConfirmationToProceed(const char* prompt, const char* abortMsg,
|
||||
const char* acceptableLetters) {
|
||||
int ch;
|
||||
UTIL_DISPLAY("%s", prompt);
|
||||
ch = getchar();
|
||||
if (strchr(acceptableLetters, ch) == NULL) {
|
||||
UTIL_DISPLAY("%s", abortMsg);
|
||||
return 1;
|
||||
}
|
||||
/* flush the rest */
|
||||
while ((ch!=EOF) && (ch!='\n'))
|
||||
ch = getchar();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*-*************************************
|
||||
* Constants
|
||||
|
Reference in New Issue
Block a user