Tweak y/n prompts

This commit is contained in:
Bruce Hill 2024-04-12 13:57:03 -04:00
parent fedc1751fe
commit 37a0ca997d

22
ask.c
View File

@ -457,15 +457,21 @@ int main(int argc, char *argv[])
}
if (yes) {
char *p2 = memcheck(calloc((prompt ? strlen(prompt) : 0)+5+1, sizeof(char)));
if (prompt) strcpy(p2, prompt);
strcat(p2, " [Y/n]");
prompt = p2;
if (prompt) {
char *p2 = memcheck(calloc(strlen(prompt)+5+1, sizeof(char)));
sprintf(p2, "%s [Y/n]", prompt);
prompt = p2;
} else {
prompt = "[Y/n]";
}
} else if (no) {
char *p2 = memcheck(calloc((prompt ? strlen(prompt) : 0)+5+1, sizeof(char)));
if (prompt) strcpy(p2, prompt);
strcat(p2, " [y/N]");
prompt = p2;
if (prompt) {
char *p2 = memcheck(calloc(strlen(prompt)+5+1, sizeof(char)));
sprintf(p2, "%s [y/N]", prompt);
prompt = p2;
} else {
prompt = "[y/N]";
}
}
if (!prompt) prompt = "> ";