Skip to content

Commit

Permalink
add loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dey4ss committed Mar 11, 2024
1 parent 26d0045 commit 444f5bf
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions bm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,20 @@ yes_no(char *prompt)
#pragma warning(default:4127)
#endif
printf("%s [Y/N]: ", prompt);
// HYRISE: Replace gets() with fgets().
fgets(reply, sizeof(reply), stdin);
switch (*reply)
// HYRISE: Replace gets() with fgets(). Add loop.
while (fgets(reply, sizeof(reply), stdin) != NULL)
{
case 'y':
case 'Y':
return (1);
case 'n':
case 'N':
return (0);
default:
printf("Please answer 'yes' or 'no'.\n");
switch (*reply)
{
case 'y':
case 'Y':
return (1);
case 'n':
case 'N':
return (0);
default:
printf("Please answer 'yes' or 'no'.\n");
}
}
}
}
Expand Down

0 comments on commit 444f5bf

Please sign in to comment.