gets() -> fgets(). I'm tired of looking at the compiler messages!

This commit is contained in:
jkh 1995-12-01 08:10:17 +00:00
parent 6fdccca095
commit eb9ddde393

View File

@ -94,14 +94,14 @@ main()
srand(time(0));
go[5] = NIL;
fprintf(stdout, "Instructions? ");
gets(s);
fgets(s, 100, stdin);
if(*s == 'y')
instructions();
putchar('\n');
fprintf(stdout, "Opponent's level: b - beginner,\n");
fprintf(stdout, "i - intermediate, e - expert? ");
level='e';
gets(s);
fgets(s, 100, stdin);
if(*s == 'b')
level = 'b';
else if(*s == 'i')
@ -109,12 +109,12 @@ main()
putchar('\n');
fprintf(stdout, "You will play brown.\n\n");
fprintf(stdout, "Would you like to roll your own dice? ");
gets(s);
fgets(s, 100, stdin);
putchar('\n');
if(*s == 'y')
nobroll = 1;
fprintf(stdout, "Would you like to go first? ");
gets(s);
fgets(s, 100, stdin);
putchar('\n');
if(*s == 'y')
goto nowhmove;
@ -141,7 +141,7 @@ nowhmove:
retry:
fprintf(stdout, "\nYour roll is %d %d\n", die1, die2);
fprintf(stdout, "Move? ");
gets(s);
fgets(s, 100, stdin);
switch(*s) {
case '\0': /* empty line */
fprintf(stdout, "Brown's move skipped.\n");
@ -362,7 +362,7 @@ roll(who)
if(who == BROWN && nobroll) {
fprintf(stdout, "Roll? ");
gets(s);
fgets(s, 10, stdin);
n = sscanf(s, "%d%d", &die1, &die2);
if(n != 2 || die1 < 1 || die1 > 6 || die2 < 1 || die2 > 6)
fprintf(stdout, "Illegal - I'll do it!\n");