question: accept enter key as default preset value.
This commit is contained in:
parent
f7142412c9
commit
8f1e7d9e55
@ -49,9 +49,8 @@ question(bool preset, const char *fmt, va_list ap)
|
|||||||
fprintf(stderr, " %s ", "[y/N]");
|
fprintf(stderr, " %s ", "[y/N]");
|
||||||
|
|
||||||
if (fgets(response, sizeof(response), stdin)) {
|
if (fgets(response, sizeof(response), stdin)) {
|
||||||
if (strlen(response) == 0)
|
if (response[0] == '\n')
|
||||||
return preset;
|
return preset;
|
||||||
|
|
||||||
if (response[0] == 'y' || response[0] == 'Y')
|
if (response[0] == 'y' || response[0] == 'Y')
|
||||||
return true;
|
return true;
|
||||||
if (response[0] == 'n' || response[0] == 'N')
|
if (response[0] == 'n' || response[0] == 'N')
|
||||||
|
Loading…
Reference in New Issue
Block a user