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