Commit 7ead3dc2 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Fixed the broken yes/no prompt in sev_ini.

parent 8b8d9224
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
* General Public License plus this exception. * General Public License plus this exception.
*/ */
// TODO: Den hr filen r i princip identisk med rt_ini.
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
...@@ -219,12 +221,12 @@ static pwr_tStatus terminate(ini_sContext* cp) ...@@ -219,12 +221,12 @@ static pwr_tStatus terminate(ini_sContext* cp)
exit(1); exit(1);
} }
static int ask_yes_no(ini_sContext* cp, char* text) static int ask_yes_no(char* text)
{ {
printf("%s ? (y|n) [n]: ", text); char ans;
printf("n\n"); printf("%s ? [Y/n]: ", text);
scanf("%c", &ans);
return 0; return (ans == 'y' || ans == 'Y');
} }
static int checkErrors(ini_sContext* cp) static int checkErrors(ini_sContext* cp)
...@@ -241,7 +243,7 @@ static int checkErrors(ini_sContext* cp) ...@@ -241,7 +243,7 @@ static int checkErrors(ini_sContext* cp)
&cp->log, "Ignoring fatal errors, errors and warnings, continued..."); &cp->log, "Ignoring fatal errors, errors and warnings, continued...");
return 1; return 1;
} else { } else {
return ask_yes_no(cp, "Do you want to continue"); return ask_yes_no("Do you want to continue");
} }
} }
if (cp->errors > 0) { if (cp->errors > 0) {
...@@ -252,7 +254,7 @@ static int checkErrors(ini_sContext* cp) ...@@ -252,7 +254,7 @@ static int checkErrors(ini_sContext* cp)
errh_LogInfo(&cp->log, "Ignoring errors and warnings, continued..."); errh_LogInfo(&cp->log, "Ignoring errors and warnings, continued...");
return 1; return 1;
} else { } else {
return ask_yes_no(cp, "Do you want to continue"); return ask_yes_no("Do you want to continue");
} }
} }
if (cp->warnings > 0) { if (cp->warnings > 0) {
...@@ -263,7 +265,7 @@ static int checkErrors(ini_sContext* cp) ...@@ -263,7 +265,7 @@ static int checkErrors(ini_sContext* cp)
errh_LogInfo(&cp->log, "Ignoring warnings, continued..."); errh_LogInfo(&cp->log, "Ignoring warnings, continued...");
return 1; return 1;
} else { } else {
return ask_yes_no(cp, "Do you want to continue"); return ask_yes_no("Do you want to continue");
} }
} }
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment