diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-11-06 11:36:09 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-11-06 11:46:53 +0100 |
commit | b094b30f205cbc2604fa53b4fbce227f8e911fff (patch) | |
tree | 51eb3dfb3730e7afaea9fb60b0e464cdea630a67 | |
parent | 6dc08f059dacbdca2df17e094531f393f3386fa4 (diff) | |
download | wbs-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.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 */ |