In ask(): override default option if any of alwaysyes/alwaysno/rdonly is
set. MFC after: 2 weeks
This commit is contained in:
parent
1e3ffe6590
commit
0b253f2ba4
@ -129,9 +129,10 @@ ask(int def, const char *fmt, ...)
|
||||
char prompt[256];
|
||||
int c;
|
||||
|
||||
if (alwaysyes || alwaysno || rdonly)
|
||||
def = (alwaysyes && !rdonly && !alwaysno);
|
||||
|
||||
if (preen) {
|
||||
if (rdonly)
|
||||
def = 0;
|
||||
if (def)
|
||||
printf("FIXED\n");
|
||||
return def;
|
||||
@ -140,9 +141,9 @@ ask(int def, const char *fmt, ...)
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(prompt, sizeof(prompt), fmt, ap);
|
||||
va_end(ap);
|
||||
if (alwaysyes || rdonly) {
|
||||
printf("%s? %s\n", prompt, rdonly ? "no" : "yes");
|
||||
return !rdonly;
|
||||
if (alwaysyes || alwaysno || rdonly) {
|
||||
printf("%s? %s\n", prompt, def ? "yes" : "no");
|
||||
return def;
|
||||
}
|
||||
do {
|
||||
printf("%s? [yn] ", prompt);
|
||||
|
Loading…
Reference in New Issue
Block a user