summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-06 11:36:09 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-06 11:46:53 +0100
commitb094b30f205cbc2604fa53b4fbce227f8e911fff (patch)
tree51eb3dfb3730e7afaea9fb60b0e464cdea630a67
parent6dc08f059dacbdca2df17e094531f393f3386fa4 (diff)
downloadwbs-b094b30f205cbc2604fa53b4fbce227f8e911fff.tar.gz
wbs-b094b30f205cbc2604fa53b4fbce227f8e911fff.tar.bz2
wbs-b094b30f205cbc2604fa53b4fbce227f8e911fff.zip
tit4tat.c: Remove non-standard fpurge by adding an ugly while-loop
-rw-r--r--tit4tat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tit4tat.c b/tit4tat.c
index fa3fe50..3546987 100644
--- a/tit4tat.c
+++ b/tit4tat.c
@@ -16,7 +16,6 @@
*/
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
enum {COORPERATION, DEFECTION};
@@ -38,8 +37,8 @@ int main(int argc, char **argv)
for (;;) {
/* human input */
- a = getc(stdin);
- fpurge(stdin);
+ a = getc(stdin);
+ while (getc(stdin) != '\n');
a = (a == 'c') ? COORPERATION : DEFECTION;
/* computer rules */