pkgsrc/games/velena/patches/patch-cmdline_c
dholland 2c7b74aa36 Minor rototill and respin patches; add patch comments, etc. I was taking
a shot at making it work on LP64, but there seem to be deeper problems
than the usual sorts of things. Add a comment in the makefile documenting
a case that fails on LP64 but not ILP32. PKGREVISION++.
2011-05-28 22:41:43 +00:00

38 lines
1.3 KiB
Text

$NetBSD: patch-cmdline_c,v 1.1 2011/05/28 22:41:43 dholland Exp $
- declare external functions
- improve input prompting
- don't use gets
--- cmdline.c.orig 1997-07-27 21:14:18.000000000 +0000
+++ cmdline.c
@@ -16,6 +16,7 @@
#include <stdio.h>
#include "connect4.h"
+#include "proto.h"
// Here's the interface for sending positions to velena engine
// positions are passed in a C string in the form of: x+y+'0'
@@ -42,16 +43,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 {