blob: 24b17101b92c40d169b533180852473dcd2af83f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
$NetBSD: patch-ab,v 1.2 2008/02/02 17:05:00 rillig Exp $
--- cmdline.c.orig 1997-07-27 17:14:18.000000000 +0200
+++ cmdline.c 2008-02-02 18:02:11.000000000 +0100
@@ -42,16 +42,19 @@ void command_line_input(struct board *bo
int flag = 1,answer;
char st[80];
- printf("Enter positions in the form x+y+'0', where:\n");
+ setvbuf(stdout, NULL, _IONBF, 0);
+ printf("Enter positions in the form xy0, where:\n");
printf("x is the level of play: 'a' = weak, 'b' = normal, 'c' = strong\n");
printf("y is a sequence of moves that brings to the position you want\n");
printf(" (columns are numbered from 1 to 7)\n");
printf("'0' is the 48 ASCII char which tells Velena where the string ends\n");
+ printf("Example: c4444350\n");
printf("\nEnter 'q' to quit\n\n");
do {
printf(">"); // Waiting for the user to enter the string
- gets(st);
+ if (fgets(st, sizeof(st), stdin) == NULL)
+ break;
if(st[0]=='q') flag = 0; // if the string begins with 'q' we quit.
else {
|