Faster tail... write(buffer) instead of putchar.
authorlbatlle@npdl268.bpo.hp.com
Thu, 24 Jan 2008 10:42:42 +0100
changeset 188 64058e15c0dd
parent 187 85d52acbab26
child 189 192ea76be533
Faster tail... write(buffer) instead of putchar.
tail.c
--- a/tail.c	Mon Jan 21 23:57:06 2008 +0100
+++ b/tail.c	Thu Jan 24 10:42:42 2008 +0100
@@ -131,7 +131,6 @@
     do
     {
         char buf[BSIZE];
-        int i;
         int maxfd;
 
         FD_ZERO(&readset);
@@ -181,10 +180,7 @@
         else
             endfile_reached = 0;
 
-        for(i=0; i < res; ++i)
-        {
-            putchar(buf[i]);
-        }
+        write(1, buf, res);
     } while(!endfile_reached || waiting_end);
 
     close(fd);