From: Marius Gavrilescu Date: Sat, 18 Jul 2015 09:52:15 +0000 (+0300) Subject: Replace fread with getchar in nethackify X-Git-Tag: debian/2.54~8 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=43263c0ebd9277d604417ed3c0ff745c02eb0570;p=filters.git Replace fread with getchar in nethackify --- diff --git a/nethackify.c b/nethackify.c index 1f6cb6c..0dad60a 100644 --- a/nethackify.c +++ b/nethackify.c @@ -52,30 +52,26 @@ void nethackify(char* str) int main(int argc, char **argv) { - int i,c; + int i,c, ch; struct timeval tv; - FILE *f; - char ch[1]; srand((gettimeofday(&tv,NULL),tv.tv_usec)); if (argc==1) { - f=stdin; - while(fread(ch,1,1,f)) { + while((ch = getchar()) != EOF) { for(c=0; c