new: working on the gen command
This commit is contained in:
26
src/log.c
26
src/log.c
@ -138,31 +138,31 @@ void input(const char *msg, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
bool yesno(const char *msg){
|
||||
if(env_mc_yes())
|
||||
bool yesno(const char *msg) {
|
||||
if (env_mc_yes())
|
||||
return true;
|
||||
|
||||
char *yes[] = {_("y"), _("Y")};
|
||||
char *no[] = {_("n"), _("N")};
|
||||
|
||||
char question[strlen(msg)+12], c;
|
||||
|
||||
char question[strlen(msg) + 12], c;
|
||||
sprintf(question, _("%s [y/N] "), msg);
|
||||
|
||||
while(true){
|
||||
while (true) {
|
||||
input(question);
|
||||
|
||||
|
||||
int c = getchar();
|
||||
if(c == '\n')
|
||||
if (c == '\n')
|
||||
return false;
|
||||
getchar();
|
||||
|
||||
for(int i = 0; i < sizeof(yes)/sizeof(char*); i++){
|
||||
if(yes[i][0] == c)
|
||||
|
||||
for (int i = 0; i < sizeof(yes) / sizeof(char *); i++) {
|
||||
if (yes[i][0] == c)
|
||||
return true;
|
||||
}
|
||||
|
||||
for(int i = 0; i < sizeof(no)/sizeof(char*); i++){
|
||||
if(no[i][0] == c)
|
||||
|
||||
for (int i = 0; i < sizeof(no) / sizeof(char *); i++) {
|
||||
if (no[i][0] == c)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user