diff --git a/console.c b/console.c
index 8ee0f53..96d87f3 100644
--- a/console.c
+++ b/console.c
@@ -6,6 +6,7 @@
 
 #include "console.h"
 #include "util.h"
+#include "log.h"
 
 #ifndef __MINGW32__
 
@@ -28,7 +29,7 @@ console_t *prepareConsole(int fd) {
     if(fd < 0) {
 	fd = open("/dev/tty", O_RDWR);
 	if(fd < 0) {
-	    fprintf(stderr, "Could not open keyboard: %s\n", strerror(errno));
+	    flprintf( "Could not open keyboard: %s\n", strerror(errno));
 	    return NULL;
 	}
 	needClose=1;
@@ -57,7 +58,7 @@ console_t *prepareConsole(int fd) {
     return c;
 }
 
-int selectWithConsole(console_t *con, int maxFd, 
+int selectWithConsole(console_t *con, int maxFd,
 		      fd_set *read_set, struct timeval *tv,
 		      int *keyPressed) {
     int ret;
@@ -80,7 +81,7 @@ int selectWithConsole(console_t *con, int maxFd,
 void restoreConsole(console_t **cp, int doConsume) {
     console_t *c=*cp;
     int ch='\0';
-    
+
     if(c == NULL)
       return;
 
@@ -126,22 +127,22 @@ static DWORD WINAPI waitForKeyPress(LPVOID lpParameter) {
 
 static DWORD WINAPI waitForSelect(LPVOID lpParameter) {
     console_t *con = lpParameter;
-    con->select_return = select(con->maxFd, &con->read_set, 
+    con->select_return = select(con->maxFd, &con->read_set,
 				NULL, NULL, con->tvp);
     return 0;
 }
 
 
-console_t *prepareConsole(int fd) { 
+console_t *prepareConsole(int fd) {
     console_t *con;
     if(fd < 0) {
 	fd = open("CON", O_RDONLY);
 	if(fd < 0)
 	    return NULL;
     } else {
-	fd = dup(fd);  /* dup console filedescriptor in order to avoid 
-			*  race with pipe spawner... */      
-    }    
+	fd = dup(fd);  /* dup console filedescriptor in order to avoid
+			*  race with pipe spawner... */
+    }
     con = MALLOC(console_t);
     if(con == NULL)
 	return con;
@@ -153,9 +154,9 @@ console_t *prepareConsole(int fd) {
 
 static HANDLE startThread(console_t *con,
 			  LPTHREAD_START_ROUTINE lpStartAddress) {
-    /* Start thread ... 
+    /* Start thread ...
      * see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createthread.asp
-     */	       
+     */
     return CreateThread(NULL,	/* lpThreadAttributes */
 			0,	/* dwStackSize */
 			lpStartAddress,
@@ -164,7 +165,7 @@ static HANDLE startThread(console_t *con,
 			NULL    /* lpThreadId */);
 }
 
-int selectWithConsole(console_t *con, int maxFd, 
+int selectWithConsole(console_t *con, int maxFd,
 		      fd_set *read_set, struct timeval *tv,
 		      int *keyPressed) {
     int r;
@@ -194,7 +195,7 @@ int selectWithConsole(console_t *con, int maxFd,
 	udpc_fatal(1, "Could not start select thread");
 
     /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/waitformultipleobjects.asp
-     */    
+     */
     switch( (r=WaitForMultipleObjects(2, con->thread, FALSE, INFINITE)) ) {
     case WAIT_OBJECT_0:
 	*keyPressed=1;
@@ -214,7 +215,7 @@ int selectWithConsole(console_t *con, int maxFd,
     }
 }
 
-void restoreConsole(console_t **cp, int doConsume) { 
+void restoreConsole(console_t **cp, int doConsume) {
     console_t *c=*cp;
 
     /* If key pressed, consume it. If letter is q, quit */
--- a/fec-test.c
+++ b/fec-test.c
@@ -29,28 +29,28 @@ mul2(gf *dst1, gf *src1, gf c, int sz)
 		 "    xorl %%edx,%%edx;\n"
 		 "1: "
 		 "    addl  $8, %%edi;\n"
-		 
+
 		 "    movb  (%%esi), %%al;\n"
 		 "    movb 4(%%esi), %%dl;\n"
 		 "    movb  (%%ebx,%%eax), %%al;\n"
 		 "    movb  (%%ebx,%%edx), %%dl;\n"
 		 "    movb  %%al,  (%%edi);\n"
 		 "    movb  %%dl, 4(%%edi);\n"
-		 
+
 		 "    movb 1(%%esi), %%al;\n"
 		 "    movb 5(%%esi), %%dl;\n"
 		 "    movb  (%%ebx,%%eax), %%al;\n"
 		 "    movb  (%%ebx,%%edx), %%dl;\n"
 		 "    movb  %%al, 1(%%edi);\n"
 		 "    movb  %%dl, 5(%%edi);\n"
-		 
+
 		 "    movb 2(%%esi), %%al;\n"
 		 "    movb 6(%%esi), %%dl;\n"
 		 "    movb  (%%ebx,%%eax), %%al;\n"
 		 "    movb  (%%ebx,%%edx), %%dl;\n"
 		 "    movb  %%al, 2(%%edi);\n"
 		 "    movb  %%dl, 6(%%edi);\n"
-		 
+
 		 "    movb 3(%%esi), %%al;\n"
 		 "    movb 7(%%esi), %%dl;\n"
 		 "    addl  $8, %%esi;\n"
@@ -58,12 +58,12 @@ mul2(gf *dst1, gf *src1, gf c, int sz)
 		 "    movb  (%%ebx,%%edx), %%dl;\n"
 		 "    movb  %%al, 3(%%edi);\n"
 		 "    movb  %%dl, 7(%%edi);\n"
-		 
+
 		 "    cmpl  %%ecx, %%esi;\n"
 		 "    jb 1b;\n"
-		 
-		 : : 
-		 
+
+		 : :
+
 		 "b" (__gf_mulc_),
 		 "D" (dst1-8),
 		 "S" (src1),
@@ -134,7 +134,7 @@ int main(int argc, char **argv) {
 
 /*
 static unsigned char highbit_test[] __attribute__ ((aligned (16))) =
-{ 0x80, 0x80, 0x80, 0x80, 
+{ 0x80, 0x80, 0x80, 0x80,
   0x80, 0x80, 0x80, 0x80 };
 
 static unsigned char multable[16] __attribute__ ((aligned (16)));
@@ -175,7 +175,7 @@ static void mmx_addmul1(gf *dst1, gf *src1, gf c, int sz)
      */
 
 #if 0
-    fprintf(stderr, "src=%p dst=%p %p %d\n", src1, dst1,
+    flprintf( "src=%p dst=%p %p %d\n", src1, dst1,
 	    mul_results, mul_results[64]);
 #endif
 #if 1
@@ -183,22 +183,22 @@ static void mmx_addmul1(gf *dst1, gf *src1, gf c, int sz)
     MYTICK();
     asm volatile(
 	"1:"
-	"	movq         (%%esi),%%mm2;\n"	    
+	"	movq         (%%esi),%%mm2;\n"
 	"	movq         (%%edi),%%mm1;\n"
 	"   movq          %%mm2,%%mm3;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   pandn	    (%%ebx),%%mm3;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   movq          %%mm2,%%mm4;\n"
 	"   pxor	      %%mm3,%%mm1;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   pandn	 0x08(%%ebx),%%mm4;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   movq          %%mm2,%%mm3;\n"
 	"   pxor	      %%mm4,%%mm1;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   pandn	 0x10(%%ebx),%%mm3;\n"
@@ -210,32 +210,32 @@ static void mmx_addmul1(gf *dst1, gf *src1, gf c, int sz)
 	"   pandn	 0x18(%%ebx),%%mm4;\n"
 	"   movq          %%mm2,%%mm3;\n"
 	"   pxor	      %%mm4,%%mm1;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   pandn	 0x20(%%ebx),%%mm3;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   movq          %%mm2,%%mm4;\n"
 	"   pxor	      %%mm3,%%mm1;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   pandn	 0x28(%%ebx),%%mm4;\n"
 	"   movq          %%mm2,%%mm3;\n"
 	"   pxor	      %%mm4,%%mm1;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm3;\n"
 	"   psllw        $1,%%mm2;\n"
 	"   pandn	 0x30(%%ebx),%%mm3;\n"
-	
+
 	"   pcmpgtb	      %%mm0,%%mm2;\n"
 	"   pxor	      %%mm3,%%mm1;\n"
 	"   pandn	 0x38(%%ebx),%%mm4;\n"
 	"   addl           $8,%%edi;\n"
 	"   pxor	      %%mm4,%%mm1;\n"
 	"   addl           $8,%%esi;\n"
-	
+
 	"   movq      %%mm1,-8(%%edi);\n"
-	
+
 	"	cmpl %%ecx,%%esi;\n"
 	"	jb 1b;\n" :  :
 	"b" (exp8+(255-gf_log[c])*8),
@@ -251,8 +251,8 @@ static void mmx_addmul1(gf *dst1, gf *src1, gf c, int sz)
 void print(unsigned char *data, int s) {
     int i;
     for(i=0; i<s; i++)
-	fprintf(stderr,"%02x ", data[i]);
-    fprintf(stderr, "\n");
+	flprintf("%02x ", data[i]);
+    flprintf( "\n");
 }
 
 /* example: ./fec-test 10 256 10 </bin/ls >/tmp/x */
@@ -273,14 +273,14 @@ int main(int argc, char **argv) {
     struct timeval tv;
     int seed;
     long long begin, end;
-    
+
 #if 1
     gettimeofday(&tv, 0);
     seed = tv.tv_sec ^ tv.tv_usec;
 #endif
     seed=996035588;
     srandom(seed);
-    fprintf(stderr,"%d\n", seed);
+    flprintf("%d\n", seed);
 
 
     fstat(0, &buf);
@@ -288,18 +288,18 @@ int main(int argc, char **argv) {
     if(size > blocksize * 128)
 	size = blocksize * 128;
     nrBlocks = (size+blocksize-1)/blocksize;
-    fprintf(stderr, "Size=%d nr=%d\n", size, nrBlocks);
+    flprintf( "Size=%d nr=%d\n", size, nrBlocks);
 
     data = xmalloc(size+4096);
-    data += 4096 - ((unsigned long) data) % 4096; 
+    data += 4096 - ((unsigned long) data) % 4096;
     fec_size = blocksize*redundancy;
     fec_data = xmalloc(fec_size+4096);
-    fec_data += 4096 - ((unsigned long) fec_data) % 4096; 
+    fec_data += 4096 - ((unsigned long) fec_data) % 4096;
     fec_data2 = xmalloc(fec_size+4096);
-    fec_data2 += 4096 - ((unsigned long) fec_data2) % 4096; 
+    fec_data2 += 4096 - ((unsigned long) fec_data2) % 4096;
     n = read(0, data, size);
     if(n < size) {
-	fprintf(stderr, "Short read\n");
+	flprintf( "Short read\n");
 	exit(1);
     }
 
@@ -307,7 +307,7 @@ int main(int argc, char **argv) {
     init_fec();
     initFastTable();
     end = rdtsc(1);
-    fprintf(stderr, "%d cycles to create FEC buffer\n",
+    flprintf( "%d cycles to create FEC buffer\n",
 	    (unsigned int) (end-begin));
     for(i=0, j=0; i<size; i+=blocksize, j++) {
 	data_blocks[j] = data + i;
@@ -320,21 +320,21 @@ int main(int argc, char **argv) {
     fec_encode(blocksize, data_blocks, nrBlocks, fec_blocks, redundancy);
     end = rdtsc();
 
-    fprintf(stderr,"times %ld %f %f\n", 
+    flprintf("times %ld %f %f\n",
 	    (unsigned long) (end-begin),
-	    ((double) (end-begin)) / 
+	    ((double) (end-begin)) /
 	    blocksize / nrBlocks / redundancy,
 	    ((double) (end-begin)) / blocksize / nrBlocks);
 
-    fprintf(stderr, "old:\n");
+    flprintf( "old:\n");
 
     for(i=0; i<1024; i++)
 	zilch[i]=0;
 
-    for(i=0; i < corrupted; i++) {	
+    for(i=0; i < corrupted; i++) {
 	int corr = random() % nrBlocks;
 	memset(data+blocksize*corr,137,blocksize);
-	fprintf(stderr, "Corrupting %d\n", corr);
+	flprintf( "Corrupting %d\n", corr);
 	zilch[corr]=1;
     }
 
@@ -350,8 +350,8 @@ int main(int argc, char **argv) {
 		    fec_pos++;
 		erased_blocks[nr_fec_blocks] = i;
 		fec_block_nos[nr_fec_blocks] = fec_pos;
-		fprintf(stderr, "Fixing %d with %d (%p)\n",
-			i, fec_pos, fec_blocks[fec_pos]);		
+		flprintf( "Fixing %d with %d (%p)\n",
+			i, fec_pos, fec_blocks[fec_pos]);
 		dec_fec_blocks[nr_fec_blocks] = fec_blocks[fec_pos];
 		nr_fec_blocks++;
 		assert(fec_pos <= redundancy);
@@ -360,25 +360,25 @@ int main(int argc, char **argv) {
 	}
 #if 0
 	for(stripe=0; stripe<stripes; stripe++) {
-	    fprintf(stderr, "stripe%d: ", stripe);
+	    flprintf( "stripe%d: ", stripe);
 	    for(i=0; i<fec_blocks[stripe]; i++) {
 		int pos = i * stripes+stripe;
-		fprintf(stderr, "%p.%d.%d ",d[pos].adr, 
+		flprintf( "%p.%d.%d ",d[pos].adr,
 		       d[pos].erasedBlockNo, d[pos].fecBlockNo);
 	    }
-	    fprintf(stderr,"\n");
+	    flprintf("\n");
 	}
-#endif	
+#endif
 	begin = rdtsc();
-	fec_decode(blocksize, data_blocks, nrBlocks, 
-		   dec_fec_blocks, fec_block_nos, erased_blocks, 
+	fec_decode(blocksize, data_blocks, nrBlocks,
+		   dec_fec_blocks, fec_block_nos, erased_blocks,
 		   nr_fec_blocks);
 	end = rdtsc();
-	fprintf(stderr,"times %ld %f %f\n", 
+	flprintf("times %ld %f %f\n",
 		(unsigned long) (end-begin),
-		((double) (end-begin)) / 
+		((double) (end-begin)) /
 		blocksize / nrBlocks / redundancy,
-		((double) (end-begin)) / blocksize / nrBlocks);	
+		((double) (end-begin)) / blocksize / nrBlocks);
     }
     /* printDetail();*/
 
@@ -442,7 +442,7 @@ int main(int argc, char **argv) {
 	: : "S" (1) );
 
     for(i=0; i<8; i++)
-	fprintf(stderr, "%2d %02x %02x\n", i, out1[i],out2[i]);
+	flprintf( "%2d %02x %02x\n", i, out1[i],out2[i]);
     exit(0);
     */
 
@@ -520,7 +520,7 @@ int main(int argc, char **argv) {
 
     for(i=0; i<SIZE*5; i++) {
 	if(block[i] != block2[i]) {
-	    fprintf(stderr, "%05d %02x %02x %02x\n", i, 
+	    flprintf( "%05d %02x %02x %02x\n", i,
 		    block[i], block2[i], block3[i]);
 	    break;
 	}
@@ -528,7 +528,7 @@ int main(int argc, char **argv) {
 
     for(i=0; i<SIZE*5; i++) {
 	if(block[i] != block4[i]) {
-	    fprintf(stderr, "mmx %05d %02x %02x %02x\n", i, 
+	    flprintf( "mmx %05d %02x %02x %02x\n", i,
 		    block[i], block4[i], block3[i]);
 	    break;
 	}
@@ -569,11 +569,11 @@ int main(int argc, char **argv) {
     char result='X';
 
     asm("addl %%ecx, %%ebx; \n"
-	"movb (%%ebx), %%al" : 
-	"=al" (result) : 
+	"movb (%%ebx), %%al" :
+	"=al" (result) :
 	"ebx" (i), "ecx" (testing):
 	"esi");
-    
+
     printf("%c\n", result);
     return 0;
 }
--- a/fec.c
+++ b/fec.c
@@ -51,6 +51,7 @@
 #include <assert.h>
 #include "fec.h"
 #include "socklib.h"
+#include "log.h"
 
 /*
  * stuff used for testing purposes only
@@ -75,7 +76,7 @@
 	  if (t1 < t) t = 256000000 + t1 - t ; \
 	  else t = t1 - t ; \
 	  if (t == 0) t = 1 ;}
-	
+
 u_long ticks[10];	/* vars for timekeeping */
 #else
 #define DEB(x)
@@ -170,7 +171,7 @@ modnn(int x)
  * A value related to the multiplication is held in a local variable
  * declared with USE_GF_MULC . See usage in addmul1().
  */
-static gf gf_mul_table[(GF_SIZE + 1)*(GF_SIZE + 1)] 
+static gf gf_mul_table[(GF_SIZE + 1)*(GF_SIZE + 1)]
 #ifdef WINDOWS
 __attribute__((aligned (16)))
 #else
@@ -286,7 +287,7 @@ generate_gf(void)
  * unrolled 16 times, a good value for 486 and pentium-class machines.
  * The case c=0 is also optimized, whereas c=1 is not. These
  * calls are unfrequent in my typical apps so I did not bother.
- * 
+ *
  * Note that gcc on
  */
 #if 0
@@ -346,8 +347,8 @@ addmul1(gf *dst1, gf *src1, gf c, int sz)
 
     GF_MULC0(c) ;
 
-    if(((unsigned long)dst1 % LOOPSIZE) || 
-       ((unsigned long)src1 % LOOPSIZE) || 
+    if(((unsigned long)dst1 % LOOPSIZE) ||
+       ((unsigned long)src1 % LOOPSIZE) ||
        (sz % LOOPSIZE)) {
 	slow_addmul1(dst1, src1, c, sz);
 	return;
@@ -358,28 +359,28 @@ addmul1(gf *dst1, gf *src1, gf c, int sz)
 		 ".align 32;\n"
 		 "1:"
 		 "	addl  $8, %%edi;\n"
-		 
+
 		 "	movb  (%%esi), %%al;\n"
 		 "	movb 4(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	xorb  %%al,  (%%edi);\n"
 		 "	xorb  %%dl, 4(%%edi);\n"
-		 
+
 		 "	movb 1(%%esi), %%al;\n"
 		 "	movb 5(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	xorb  %%al, 1(%%edi);\n"
 		 "	xorb  %%dl, 5(%%edi);\n"
-		 
+
 		 "	movb 2(%%esi), %%al;\n"
 		 "	movb 6(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	xorb  %%al, 2(%%edi);\n"
 		 "	xorb  %%dl, 6(%%edi);\n"
-		 
+
 		 "	movb 3(%%esi), %%al;\n"
 		 "	movb 7(%%esi), %%dl;\n"
 		 "	addl  $8, %%esi;\n"
@@ -387,11 +388,11 @@ addmul1(gf *dst1, gf *src1, gf c, int sz)
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	xorb  %%al, 3(%%edi);\n"
 		 "	xorb  %%dl, 7(%%edi);\n"
-		 
+
 		 "	cmpl  %%ecx, %%esi;\n"
 		 "	jb 1b;"
-		 : : 
-		 
+		 : :
+
 		 "b" (__gf_mulc_),
 		 "D" (dst1-8),
 		 "S" (src1),
@@ -404,7 +405,7 @@ addmul1(gf *dst1, gf *src1, gf c, int sz)
 #endif
 
 static void addmul(gf *dst, gf *src, gf c, int sz) {
-    // fprintf(stderr, "Dst=%p Src=%p, gf=%02x sz=%d\n", dst, src, c, sz);
+    // flprintf( "Dst=%p Src=%p, gf=%02x sz=%d\n", dst, src, c, sz);
     if (c != 0) addmul1(dst, src, c, sz);
 }
 
@@ -414,7 +415,7 @@ static void addmul(gf *dst, gf *src, gf c, int sz) {
  * unrolled 16 times, a good value for 486 and pentium-class machines.
  * The case c=0 is also optimized, whereas c=1 is not. These
  * calls are unfrequent in my typical apps so I did not bother.
- * 
+ *
  * Note that gcc on
  */
 #if 0
@@ -469,8 +470,8 @@ mul1(gf *dst1, gf *src1, gf c, int sz)
 
     GF_MULC0(c) ;
 
-    if(((unsigned long)dst1 % LOOPSIZE) || 
-       ((unsigned long)src1 % LOOPSIZE) || 
+    if(((unsigned long)dst1 % LOOPSIZE) ||
+       ((unsigned long)src1 % LOOPSIZE) ||
        (sz % LOOPSIZE)) {
 	slow_mul1(dst1, src1, c, sz);
 	return;
@@ -482,28 +483,28 @@ mul1(gf *dst1, gf *src1, gf c, int sz)
 		 "	xorl %%edx,%%edx;\n"
 		 "1:"
 		 "	addl  $8, %%edi;\n"
-		 
+
 		 "	movb  (%%esi), %%al;\n"
 		 "	movb 4(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	movb  %%al,  (%%edi);\n"
 		 "	movb  %%dl, 4(%%edi);\n"
-		 
+
 		 "	movb 1(%%esi), %%al;\n"
 		 "	movb 5(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	movb  %%al, 1(%%edi);\n"
 		 "	movb  %%dl, 5(%%edi);\n"
-		 
+
 		 "	movb 2(%%esi), %%al;\n"
 		 "	movb 6(%%esi), %%dl;\n"
 		 "	movb  (%%ebx,%%eax), %%al;\n"
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	movb  %%al, 2(%%edi);\n"
 		 "	movb  %%dl, 6(%%edi);\n"
-		 
+
 		 "	movb 3(%%esi), %%al;\n"
 		 "	movb 7(%%esi), %%dl;\n"
 		 "	addl  $8, %%esi;\n"
@@ -511,13 +512,13 @@ mul1(gf *dst1, gf *src1, gf c, int sz)
 		 "	movb  (%%ebx,%%edx), %%dl;\n"
 		 "	movb  %%al, 3(%%edi);\n"
 		 "	movb  %%dl, 7(%%edi);\n"
-		 
+
 		 "	cmpl  %%ecx, %%esi;\n"
 		 "	jb 1b;\n"
 		 "	popl %%edx;\n"
 		 "	popl %%eax;"
-		 : : 
-		 
+		 : :
+
 		 "b" (__gf_mulc_),
 		 "D" (dst1-8),
 		 "S" (src1),
@@ -530,7 +531,7 @@ mul1(gf *dst1, gf *src1, gf c, int sz)
 #endif
 
 static inline void mul(gf *dst, gf *src, gf c, int sz) {
-    /*fprintf(stderr, "%p = %02x * %p\n", dst, c, src);*/
+    /*flprintf( "%p = %02x * %p\n", dst, c, src);*/
     if (c != 0) mul1(dst, src, c, sz); else memset(dst, 0, sz);
 }
 
@@ -584,14 +585,14 @@ invert_mat(gf *src, int k)
 				goto found_piv ;
 			    }
 			} else if (ipiv[ix] > 1) {
-			    fprintf(stderr, "singular matrix\n");
-			    goto fail ; 
+			    flprintf( "singular matrix\n");
+			    goto fail ;
 			}
 		}
 	    }
 	}
 	if (icol == -1) {
-	    fprintf(stderr, "XXX pivot not found!\n");
+	    flprintf( "XXX pivot not found!\n");
 	    goto fail ;
 	}
  found_piv:
@@ -611,7 +612,7 @@ invert_mat(gf *src, int k)
 	pivot_row = &src[icol*k] ;
 	c = pivot_row[icol] ;
 	if (c == 0) {
-	    fprintf(stderr, "singular matrix 2\n");
+	    flprintf( "singular matrix 2\n");
 	    goto fail ;
 	}
 	if (c != 1 ) { /* otherwhise this is a NOP */
@@ -646,9 +647,9 @@ invert_mat(gf *src, int k)
     } /* done all columns */
     for (col = k-1 ; col >= 0 ; col-- ) {
 	if (indxr[col] <0 || indxr[col] >= k)
-	    fprintf(stderr, "AARGH, indxr[col] %d\n", indxr[col]);
+	    flprintf( "AARGH, indxr[col] %d\n", indxr[col]);
 	else if (indxc[col] <0 || indxc[col] >= k)
-	    fprintf(stderr, "AARGH, indxc[col] %d\n", indxc[col]);
+	    flprintf( "AARGH, indxc[col] %d\n", indxc[col]);
 	else
 	    if (indxr[col] != indxc[col] ) {
 		for (row = 0 ; row < k ; row++ ) {
@@ -669,11 +670,11 @@ void fec_init(void)
     TICK(ticks[0]);
     generate_gf();
     TOCK(ticks[0]);
-    DDB(fprintf(stderr, "generate_gf took %ldus\n", ticks[0]);)
+    DDB(flprintf( "generate_gf took %ldus\n", ticks[0]);)
 	TICK(ticks[0]);
     init_mul_table();
     TOCK(ticks[0]);
-    DDB(fprintf(stderr, "init_mul_table took %ldus\n", ticks[0]);)
+    DDB(flprintf( "init_mul_table took %ldus\n", ticks[0]);)
 	fec_initialized = 1 ;
 }
 
@@ -708,7 +709,7 @@ void fec_init(void)
  *     col of inverse of top Vandermonde matrix)
  *
  *                _____
- *                 | | 
+ *                 | |
  *   P   =  K      | |    (x - i)
  *    col    col   | |
  *             0 < i < 128 &&
@@ -719,7 +720,7 @@ void fec_init(void)
  *                  1
  *           ---------------
  *   K    =       _____
- *    col          | | 
+ *    col          | |
  *                 | |    (col - i)
  *                 | |
  *             0 < i < 128 &&
@@ -734,13 +735,13 @@ void fec_init(void)
  *
  *     Which make P_col resolves to:
  *               _____
- *                | |    
+ *                | |
  *     P   =  K   | |    (x - i)
  *      col       | |
  *             0 < i < 128
  *           -------------------
  *              (x-col)
- * 
+ *
  *     When evaluating this for any x > 0x80, the following thing happens
  *     to the numerator: all (x-i) are different for i, and have high bit
  *     set. Thus, the set of top factors are all values from 0x80 to 0xff,
@@ -765,7 +766,7 @@ void fec_init(void)
 
 
 
-/* We do the matrix multiplication columns by column, instead of the 
+/* We do the matrix multiplication columns by column, instead of the
  * usual row-by-row, in order to capitalize on the cache freshness of
  * each data block . The data block only needs to be fetched once, and
  * can be used to be addmull'ed into all FEC blocks at once. No need
@@ -783,8 +784,8 @@ void fec_encode(int blockSize,
     int blockNo; /* loop for block counter */
     int row, col;
 
-    assert(fec_initialized);    
-    assert(nrDataBlocks <= 128);    
+    assert(fec_initialized);
+    assert(nrDataBlocks <= 128);
     assert(nrFecBlocks <= 128);
 
     if(!nrDataBlocks)
@@ -792,7 +793,7 @@ void fec_encode(int blockSize,
 
     for(row=0; row < nrFecBlocks; row++)
 	mul(fec_blocks[row], data_blocks[0], inverse[128 ^ row], blockSize);
-    
+
     for(col=129, blockNo=1; blockNo < nrDataBlocks; col++, blockNo ++) {
 	for(row=0; row < nrFecBlocks; row++)
 	    addmul(fec_blocks[row], data_blocks[blockNo],
@@ -894,15 +895,15 @@ static inline void resolve(int blockSize,
 
     if(r) {
 	int col;
-	fprintf(stderr,"Pivot not found\n");
-	fprintf(stderr, "Rows: ");
+	flprintf("Pivot not found\n");
+	flprintf( "Rows: ");
 	for(row=0; row<nr_fec_blocks; row++)
-	    fprintf(stderr, "%d ", 128 + fec_block_nos[row]);
-	fprintf(stderr, "\n");
-	fprintf(stderr, "Columns: ");
+	    flprintf( "%d ", 128 + fec_block_nos[row]);
+	flprintf( "\n");
+	flprintf( "Columns: ");
 	for(col = 0; col < nr_fec_blocks; col++, ptr++)
-	    fprintf(stderr, "%d ", erased_blocks[col]);
-	fprintf(stderr, "\n");
+	    flprintf( "%d ", erased_blocks[col]);
+	flprintf( "\n");
 	assert(0);
     }
 
@@ -953,7 +954,7 @@ void fec_decode(int blockSize,
 
 #ifdef PROFILE
 void printDetail(void) {
-    fprintf(stderr, "red=%9lld\nres=%9lld\ninv=%9lld\n",  
+    flprintf( "red=%9lld\nres=%9lld\ninv=%9lld\n",
 	    reduceTime, resolveTime, invTime);
 }
 #endif
@@ -961,7 +962,7 @@ void printDetail(void) {
 
 void fec_license(void)
 {
-  fprintf(stderr,
+  flprintf(
 	  "   udpcast and its FEC code are free software\n"
 	  "\n"
           "   you can redistribute udpcast core functionality and/or\n"
--- a/log.c
+++ b/log.c
@@ -24,7 +24,7 @@ int logprintf(FILE *logfile, const char *fmt, ...) {
     va_list ap;
 
     va_start(ap, fmt);
-    if(logfile != NULL) {	
+    if(logfile != NULL) {
 	char buf[9];
 	struct timeval tv;
 	int r;
@@ -44,6 +44,7 @@ int logprintf(FILE *logfile, const char *fmt, ...) {
  * since last statistics printout
  */
 int flprintf(const char *fmt, ...) {
+    return 0;
     va_list ap;
 
     va_start(ap, fmt);
@@ -67,11 +68,11 @@ int fatal(int code, const char *fmt, ...) {
     if(quitting)
 	_exit(code);
     quitting=1;
-    
+
     printNewlineIfNeeded();
     vfprintf(stderr, fmt, ap);
 #if 0
-    assert(0); /* make it easyer to use a debugger to see where this came 
+    assert(0); /* make it easyer to use a debugger to see where this came
 		* from */
 #endif
     exit(code);
@@ -86,7 +87,7 @@ int printLongNum(unsigned long long x) {
 
     if(x > 1000000000000LL) {
 	minDivisor = 1048576L;
-	suffix='M';	
+	suffix='M';
     } else if(x >= 1000000000) {
 	minDivisor = 1024L;
 	suffix='K';
@@ -112,7 +113,7 @@ int printLongNum(unsigned long long x) {
 	    fprintf(stderr, format, digits);
 	else
 	    fprintf(stderr, "    ");
-	    
+
 	if(digits) {
 	    nonzero = 1;
 	}
--- a/participants.c
+++ b/participants.c
@@ -9,7 +9,7 @@
 
 struct  participantsDb {
     int nrParticipants;
-    
+
     struct clientDesc {
 	struct sockaddr_in addr;
 	int used;
@@ -19,8 +19,8 @@ struct  participantsDb {
 };
 
 int addParticipant(participantsDb_t,
-		   struct sockaddr_in *addr, 
-		   int capabilities, 
+		   struct sockaddr_in *addr,
+		   int capabilities,
 		   unsigned int rcvbuf,
 		   int pointopoint);
 
@@ -30,8 +30,8 @@ int isParticipantValid(struct participantsDb *db, int i) {
 
 int removeParticipant(struct participantsDb *db, int i) {
     if(db->clientTable[i].used) {
-	char ipBuffer[16];	
-	flprintf("Disconnecting #%d (%s)\n", i, 
+	char ipBuffer[16];
+	flprintf("Disconnecting #%d (%s)\n", i,
 		 getIpString(&db->clientTable[i].addr, ipBuffer));
 #ifdef USE_SYSLOG
 	syslog(LOG_INFO, "Disconnecting #%d (%s)\n", i,
@@ -46,7 +46,7 @@ int removeParticipant(struct participantsDb *db, int i) {
 int lookupParticipant(struct participantsDb *db, struct sockaddr_in *addr) {
     int i;
     for (i=0; i < MAX_CLIENTS; i++) {
-	if (db->clientTable[i].used && 
+	if (db->clientTable[i].used &&
 	    ipIsEqual(&db->clientTable[i].addr, addr)) {
 	    return i;
 	}
@@ -59,7 +59,7 @@ int nrParticipants(participantsDb_t db) {
 }
 
 int addParticipant(participantsDb_t db,
-		   struct sockaddr_in *addr, 
+		   struct sockaddr_in *addr,
 		   int capabilities,
 		   unsigned int rcvbuf,
 		   int pointopoint) {
@@ -77,7 +77,7 @@ int addParticipant(participantsDb_t db,
 	    db->clientTable[i].rcvbuf = rcvbuf;
 	    db->nrParticipants++;
 
-	    flprintf("New connection from %s  (#%d) %08x\n", 
+	    flprintf("New connection from %s  (#%d) %08x\n",
 			  getIpString(addr, ipBuffer), i, capabilities);
 #ifdef USE_SYSLOG
 	    syslog(LOG_INFO, "New connection from %s  (#%d)\n",
@@ -110,23 +110,23 @@ struct sockaddr_in *getParticipantIp(participantsDb_t db, int i)
 {
     return &db->clientTable[i].addr;
 }
-    
+
 void printNotSet(participantsDb_t db, char *d)
 {
     int first=1;
     int i;
-    fprintf(stderr, "[");
+    flprintf( "[");
     for (i=0; i < MAX_CLIENTS; i++) {
 	if (db->clientTable[i].used) {
 	    if(!BIT_ISSET(i, d)) {
 		if(!first)
-		    fprintf(stderr,",");
+		    flprintf(",");
 		first=0;
-		fprintf(stderr, "%d", i);
+		flprintf( "%d", i);
 	    }
 	}
     }
-    fprintf(stderr, "]");
+    flprintf( "]");
 }
 
 
@@ -134,16 +134,16 @@ void printSet(participantsDb_t db, char *d)
 {
     int first=1;
     int i;
-    fprintf(stderr, "[");
+    flprintf( "[");
     for (i=0; i < MAX_CLIENTS; i++) {
 	if (db->clientTable[i].used) {
 	    if(BIT_ISSET(i, d)) {
 		if(!first)
-		    fprintf(stderr,",");
+		    flprintf(",");
 		first=0;
-		fprintf(stderr, "%d", i);
+		flprintf( "%d", i);
 	    }
 	}
     }
-    fprintf(stderr, "]");
+    flprintf( "]");
 }
--- a/rateGovernor.c
+++ b/rateGovernor.c
@@ -26,7 +26,7 @@
 void *rgInitGovernor(struct net_config *cfg, struct rateGovernor_t *gov)
 {
   if(cfg->nrGovernors == MAX_GOVERNORS) {
-    fprintf(stderr, "Too many rate governors\n");
+    flprintf( "Too many rate governors\n");
     exit(1);
   }
   cfg->rateGovernor[cfg->nrGovernors] = gov;
@@ -54,14 +54,14 @@ void rgParseRateGovernor(struct net_config *net_config, char *rg)
 
     rgdl = dlopen(dlname, RTLD_LAZY);
     if(rgdl == NULL) {
-	fprintf(stderr, "Library load error %s\n", dlerror());
+	flprintf( "Library load error %s\n", dlerror());
 	exit(1);
     }
     dlerror(); /* Clear any existing error */
 
     gov = dlsym(rgdl, "governor");
     if ((error = dlerror()) != NULL)  {
-	fprintf(stderr, "Symbol resolve error: %s\n", error);
+	flprintf( "Symbol resolve error: %s\n", error);
 	exit(1);
     }
 
@@ -71,7 +71,7 @@ void rgParseRateGovernor(struct net_config *net_config, char *rg)
     data = rgInitGovernor(net_config, gov);
 
     if(net_config->rateGovernorData == NULL) {
-	fprintf(stderr, "Rate governor initialization error\n");
+	flprintf( "Rate governor initialization error\n");
 	exit(1);
     }
 
--- a/receivedata.c
+++ b/receivedata.c
@@ -56,7 +56,7 @@ typedef struct slice {
 
 
     /* How many data blocks are there missing per stripe? */
-    short missing_data_blocks[MAX_FEC_INTERLEAVE]; 
+    short missing_data_blocks[MAX_FEC_INTERLEAVE];
 
 #ifdef BB_FEATURE_UDPCAST_FEC
     int fec_stripes; /* number of stripes for FEC */
@@ -82,7 +82,7 @@ struct clientState {
     struct slice *currentSlice;
     int currentSliceNo;
     receiver_stats_t stats;
-    
+
     produconsum_t free_slices_pc;
     struct slice slices[NR_SLICES];
 
@@ -111,8 +111,8 @@ struct clientState {
 
     int endReached; /* end of transmission reached:
 		       0: transmission in progress
-		       2: network transmission _and_ FEC 
-		          processing finished 
+		       2: network transmission _and_ FEC
+		          processing finished
 		    */
 
     int netEndReached; /* In case of a FEC transmission; network
@@ -138,45 +138,45 @@ struct clientState {
 static void printMissedBlockMap(struct clientState *clst, slice_t slice)
 {
     int i, first=1;
-    int blocksInSlice = (slice->bytes +  clst->net_config->blockSize - 1) / 
+    int blocksInSlice = (slice->bytes +  clst->net_config->blockSize - 1) /
 	clst->net_config->blockSize;
 
     for(i=0; i< blocksInSlice ; i++) {
 	if(!BIT_ISSET(i,slice->retransmit.map)) {
 	    if(first)
-		fprintf(stderr, "Missed blocks: ");
+		flprintf( "Missed blocks: ");
 	    else
-		fprintf(stderr, ",");
-	    fprintf(stderr, "%d",i);
+		flprintf( ",");
+	    flprintf( "%d",i);
 	    first=0;
 	}
     }
     if(!first)
-	fprintf(stderr, "\n");
+	flprintf( "\n");
     first=1;
 #ifdef BB_FEATURE_UDPCAST_FEC
     if(slice->fec_stripes != 0) {
 	for(i=0; i<MAX_SLICE_SIZE; i++) {
-	    if(i / slice->fec_stripes < 
+	    if(i / slice->fec_stripes <
 	       slice->fec_blocks[i % slice->fec_stripes]) {
 		if(first)
-		    fprintf(stderr, "FEC blocks: ");
+		    flprintf( "FEC blocks: ");
 		else
-		    fprintf(stderr, ",");
-		fprintf(stderr, "%d",slice->fec_descs[i].fecBlockNo);
+		    flprintf( ",");
+		flprintf( "%d",slice->fec_descs[i].fecBlockNo);
 		first=0;
-	    }	    
+	    }
 	}
     }
 #endif
     if(!first)
-	fprintf(stderr, "\n");
-    fprintf(stderr, "Blocks received: %d/%d/%d\n", 
+	flprintf( "\n");
+    flprintf( "Blocks received: %d/%d/%d\n",
 	    slice->dataBlocksTransferred, slice->blocksTransferred,
 	    blocksInSlice);
 #ifdef BB_FEATURE_UDPCAST_FEC
     for(i=0; i<slice->fec_stripes; i++) {
-	fprintf(stderr, "Stripe %2d: %3d/%3d %s\n", i,
+	flprintf( "Stripe %2d: %3d/%3d %s\n", i,
 		slice->missing_data_blocks[i],
 		slice->fec_blocks[i],
 		slice->missing_data_blocks[i] > slice->fec_blocks[i] ?
@@ -242,7 +242,7 @@ static void setNextBlock(struct clientState *clst)
  * Initialize slice for new slice number
  * memory is not touched
  */
-static struct slice *initSlice(struct clientState *clst, 
+static struct slice *initSlice(struct clientState *clst,
 			       struct slice *slice,
 			       int sliceNo)
 {
@@ -287,7 +287,7 @@ static struct slice *newSlice(struct clientState *clst, int sliceNo)
     int i;
 
 #if DEBUG
-    flprintf("Getting new slice %d\n", 
+    flprintf("Getting new slice %d\n",
 	     pc_getConsumerPosition(clst->free_slices_pc));
 #endif
     pc_consume(clst->free_slices_pc, 1);
@@ -302,11 +302,11 @@ static struct slice *newSlice(struct clientState *clst, int sliceNo)
     /* wait for free data memory */
     slice->base = pc_getConsumerPosition(clst->fifo->freeMemQueue);
 #if DEBUG
-    if(pc_consume(clst->fifo->freeMemQueue, 0) < 
+    if(pc_consume(clst->fifo->freeMemQueue, 0) <
        clst->net_config->blockSize * MAX_SLICE_SIZE)
 	flprintf("Pipeline full\n");
 #endif
-    pc_consume(clst->fifo->freeMemQueue, 
+    pc_consume(clst->fifo->freeMemQueue,
 	       clst->net_config->blockSize * MAX_SLICE_SIZE);
     initSlice(clst, slice, sliceNo);
     return slice;
@@ -316,7 +316,7 @@ static void checkSliceComplete(struct clientState *clst, struct slice *slice);
 
 static struct slice *findSlice(struct clientState *clst, int sliceNo);
 
-static void setSliceBytes(struct slice *slice, 
+static void setSliceBytes(struct slice *slice,
 			  struct clientState *clst,
 			  int bytes);
 
@@ -329,7 +329,7 @@ static void fakeSliceComplete(struct clientState *clst)
     if(! slice->bytesKnown )
 	setSliceBytes(slice, clst, slice->bytes);
     slice->blocksTransferred = slice->dataBlocksTransferred =
-	(slice->bytes + clst->net_config->blockSize - 1) / 
+	(slice->bytes + clst->net_config->blockSize - 1) /
 	clst->net_config->blockSize;
     checkSliceComplete(clst, slice);
 }
@@ -360,7 +360,7 @@ static struct slice *findSlice(struct clientState *clst, int sliceNo)
     if((clst->net_config->flags & FLAG_STREAMING) &&
        sliceNo != clst->currentSliceNo) {
 	assert(clst->currentSlice = &clst->slices[0]);
-	return initSlice(clst, clst->currentSlice, sliceNo);	    
+	return initSlice(clst, clst->currentSlice, sliceNo);
     }
 
     while(sliceNo > clst->receivedSliceNo + 2 ||
@@ -379,7 +379,7 @@ static struct slice *findSlice(struct clientState *clst, int sliceNo)
     return newSlice(clst, sliceNo);
 }
 
-static void setSliceBytes(struct slice *slice, 
+static void setSliceBytes(struct slice *slice,
 			  struct clientState *clst,
 			  int bytes) {
     assert(slice->magic == SLICEMAGIC);
@@ -408,7 +408,7 @@ static void setSliceBytes(struct slice *slice,
  */
 static void advanceReceivedPointer(struct clientState *clst) {
     int pos = clst->receivedPtr;
-    while(1) {	
+    while(1) {
 	slice_t slice = &clst->slices[pos];
 	if(
 #ifdef BB_FEATURE_UDPCAST_FEC
@@ -432,12 +432,12 @@ static void advanceReceivedPointer(struct clientState *clst) {
  */
 static void cleanupSlices(struct clientState *clst, unsigned int doneState)
 {
-    while(1) {	
+    while(1) {
 	int pos = pc_getProducerPosition(clst->free_slices_pc);
 	int bytes;
 	slice_t slice = &clst->slices[pos];
 #if DEBUG
-	flprintf("Attempting to clean slice %d %d %d %d at %d\n", 
+	flprintf("Attempting to clean slice %d %d %d %d at %d\n",
 		 slice->sliceNo,
 		 slice->state, doneState, clst->use_fec, pos);
 #endif
@@ -460,7 +460,7 @@ static void cleanupSlices(struct clientState *clst, unsigned int doneState)
 		 clst->slices[pos].sliceNo, pos, &clst->slices[pos]);
 #endif
 	pc_produce(clst->free_slices_pc, 1);
-	
+
 	/* if at end, exit this thread */
 	if(!bytes) {
 	    clst->endReached = 2;
@@ -477,13 +477,13 @@ static void checkSliceComplete(struct clientState *clst,
     int blocksInSlice;
 
     assert(slice->magic == SLICEMAGIC);
-    if(slice->state != SLICE_RECEIVING) 
+    if(slice->state != SLICE_RECEIVING)
 	/* bad starting state */
-	return; 
+	return;
 
     /* is this slice ready ? */
     assert(clst->net_config->blockSize != 0);
-    blocksInSlice = (slice->bytes + clst->net_config->blockSize - 1) / 
+    blocksInSlice = (slice->bytes + clst->net_config->blockSize - 1) /
 	clst->net_config->blockSize;
     if(blocksInSlice == slice->blocksTransferred) {
 	if(clst->net_config->flags & FLAG_STREAMING) {
@@ -558,7 +558,7 @@ static void fec_decode_one_stripe(struct clientState *clst,
 	if(!BIT_ISSET(i, map)) {
 #if DEBUG
 	    flprintf("Repairing block %d with %d@%p\n",
-		     i, 
+		     i,
 		     fec_descs[erasedIdx].fecBlockNo,
 		     fec_descs[erasedIdx].adr);
 #endif
@@ -581,7 +581,7 @@ static void fec_decode_one_stripe(struct clientState *clst,
 
     for(i=stripe, j=0; i< nrBlocks; i+=stripes, j++)
 	data_blocks[j] = ADR(i, config->blockSize);
-    fec_decode(config->blockSize,  data_blocks, j, 
+    fec_decode(config->blockSize,  data_blocks, j,
 	       fec_blocks,  fec_block_nos, erased_blocks, nr_fec_blocks);
 }
 
@@ -592,7 +592,7 @@ static THREAD_RETURN fecMain(void *args0)
     int pos;
     struct fifo *fifo = clst->fifo;
     struct net_config *config = clst->net_config;
-    
+
     assert(fifo->dataBufSize % config->blockSize == 0);
     assert(config->blockSize != 0);
 
@@ -614,7 +614,7 @@ static THREAD_RETURN fecMain(void *args0)
 	    int stripes = slice->fec_stripes;
 	    struct fec_desc *fec_descs = slice->fec_descs;
 	    int stripe;
-	    
+
 	    /* Record the addresses of FEC blocks */
 	    for(stripe=0; stripe<stripes; stripe++) {
 		assert(config->blockSize != 0);
@@ -706,7 +706,7 @@ static int processFecBlock(struct clientState *clst,
 	     stripes, sliceNo, blockNo, bytes);
 #endif
     assert(slice == NULL || slice->magic == SLICEMAGIC);
-    if(slice == NULL || 
+    if(slice == NULL ||
        slice->state == SLICE_FREE ||
        slice->state == SLICE_DONE ||
        slice->state == SLICE_FEC) {
@@ -723,7 +723,7 @@ static int processFecBlock(struct clientState *clst,
 	slice->fec_stripes = stripes;
 	initSliceForFec(clst, slice);
     } else if(slice->fec_stripes != stripes) {
-	udpc_flprintf("Interleave mismatch %d <-> %d", 
+	udpc_flprintf("Interleave mismatch %d <-> %d",
 		      slice->fec_stripes, stripes);
 	return 0;
     }
@@ -763,7 +763,7 @@ static int processFecBlock(struct clientState *clst,
     desc = &slice->fec_descs[adr];
     desc->adr = shouldAddress;
     desc->fecBlockNo = blockNo;
-    slice->fec_blocks[stripe]++;	   
+    slice->fec_blocks[stripe]++;
     slice->blocksTransferred++;
     setNextBlock(clst);
     slice->freePos = MAX_SLICE_SIZE;
@@ -784,7 +784,7 @@ static int processDataBlock(struct clientState *clst,
 
     assert(slice == NULL || slice->magic == SLICEMAGIC);
 
-    if(slice == NULL || 
+    if(slice == NULL ||
        slice->state == SLICE_FREE ||
        slice->state == SLICE_DONE
 #ifdef BB_FEATURE_UDPCAST_FEC
@@ -838,7 +838,7 @@ static int processDataBlock(struct clientState *clst,
 	    slice->fec_blocks[stripe]--;
 	    blockIdx = stripe+slice->fec_blocks[stripe]*slice->fec_stripes;
 	    assert(slice->fec_descs[blockIdx].adr != 0);
-	    clst->localBlockAddresses[clst->localPos++] = 
+	    clst->localBlockAddresses[clst->localPos++] =
 		slice->fec_descs[blockIdx].adr;
 	    slice->fec_descs[blockIdx].adr=0;
 	    slice->blocksTransferred--;
@@ -847,7 +847,7 @@ static int processDataBlock(struct clientState *clst,
 #endif
     slice->dataBlocksTransferred++;
     slice->blocksTransferred++;
-    while(slice->freePos < MAX_SLICE_SIZE && 
+    while(slice->freePos < MAX_SLICE_SIZE &&
 	  BIT_ISSET(slice->freePos, slice->retransmit.map))
 	slice->freePos++;
     checkSliceComplete(clst, slice);
@@ -856,13 +856,13 @@ static int processDataBlock(struct clientState *clst,
 
 static int processReqAck(struct clientState *clst,
 			 int sliceNo, int bytes, int rxmit)
-{   
+{
     struct slice *slice = findSlice(clst, sliceNo);
     int blocksInSlice;
     char *readySet = (char *) clst->data_hdr.msg_iov[1].iov_base;
 
 #if DEBUG
-    flprintf("Received REQACK (sn=%d, rxmit=%d sz=%d) %d\n", 
+    flprintf("Received REQACK (sn=%d, rxmit=%d sz=%d) %d\n",
 	     sliceNo, rxmit,  bytes, (slice - &clst->slices[0]));
 #endif
 
@@ -891,7 +891,7 @@ static int processReqAck(struct clientState *clst,
 
     setSliceBytes(slice, clst, bytes);
     assert(clst->net_config->blockSize != 0);
-    blocksInSlice = (slice->bytes + clst->net_config->blockSize - 1) / 
+    blocksInSlice = (slice->bytes + clst->net_config->blockSize - 1) /
 	clst->net_config->blockSize;
     if (blocksInSlice == slice->blocksTransferred) {
 	/* send ok */
@@ -922,7 +922,7 @@ static int processReqAck(struct clientState *clst,
 static void closeAllExcept(struct clientState *clst, int fd) {
     int i;
     int *socks = clst->client_config->socks;
-    
+
     if(clst->selectedFd >= 0)
       return;
 
@@ -949,7 +949,7 @@ static int dispatchMessage(struct clientState *clst)
 	clst->currentSlice->freePos < MAX_SLICE_SIZE) {
 	struct slice *slice = clst->currentSlice;
 	assert(slice == NULL || slice->magic == SLICEMAGIC);
-	clst->data_iov[1].iov_base = 
+	clst->data_iov[1].iov_base =
 	    ADR(slice->freePos, clst->net_config->blockSize);
     } else {
 	clst->data_iov[1].iov_base = clst->nextBlock;
@@ -1056,11 +1056,11 @@ static int dispatchMessage(struct clientState *clst)
 
 
 #if 0
-    flprintf("received packet for slice %d, block %d\n", 
+    flprintf("received packet for slice %d, block %d\n",
 	     ntohl(Msg.sliceNo), ntohs(db.blockNo));
 #endif
 
-    if(!udpc_isAddressEqual(&lserver, 
+    if(!udpc_isAddressEqual(&lserver,
 			    &clst->client_config->serverAddr)) {
 	char buffer1[16], buffer2[16];
 	udpc_flprintf("Rogue packet received %s:%d, expecting %s:%d\n",
@@ -1107,7 +1107,7 @@ static int dispatchMessage(struct clientState *clst)
 	    break;
     }
 
-    udpc_flprintf("Unexpected opcode %04x\n", 
+    udpc_flprintf("Unexpected opcode %04x\n",
 		  (unsigned short) clst->Msg.opCode);
     return -1;
 }
@@ -1116,7 +1116,7 @@ static int setupMessages(struct clientState *clst) {
     /* the messages received from the server */
     clst->data_iov[0].iov_base = (void *)&clst->Msg;
     clst->data_iov[0].iov_len = sizeof(clst->Msg);
-    
+
     /* namelen set just before reception */
     clst->data_hdr.msg_iov = clst->data_iov;
     /* iovlen set just before reception */
@@ -1126,12 +1126,12 @@ static int setupMessages(struct clientState *clst) {
 }
 
 static THREAD_RETURN netReceiverMain(void *args0)
-{    
+{
     struct clientState *clst = (struct clientState *) args0;
 
     clst->currentSliceNo = 0;
     setupMessages(clst);
-    
+
     clst->currentSliceNo = -1;
     clst->currentSlice = NULL;
     clst->promptPrinted = 0;
--- a/socklib.c
+++ b/socklib.c
@@ -707,8 +707,8 @@ net_if_t *getNetIf(const char *wanted) {
 
 
 	if(!chosen) {
-	    fprintf(stderr, "No suitable network interface found\n");
-	    fprintf(stderr, "The following interfaces are available:\n");
+	    flprintf( "No suitable network interface found\n");
+	    flprintf( "The following interfaces are available:\n");
 
 	    for (ifrp = (struct ifreq *) ifc.ifc_buf ; ifrp < ifend;
 #ifdef IFREQ_SIZE
@@ -722,7 +722,7 @@ net_if_t *getNetIf(const char *wanted) {
 		if(ifrp->ifr_addr.sa_family != PF_INET)
 		    continue;
 
-		fprintf(stderr, "\t%s\t%s\n",
+		flprintf( "\t%s\t%s\n",
 			ifrp->ifr_name,
 			udpc_getIpString((struct sockaddr_in *)&ifrp->ifr_addr, buffer));
 	    }
@@ -753,7 +753,7 @@ net_if_t *getNetIf(const char *wanted) {
 	/* WINSOCK initialization */
 	wVersionRequested = MAKEWORD(2, 0); /* Request Winsock v2.0 */
 	if (WSAStartup(wVersionRequested, &wsaData) != 0) /* Load Winsock DLL */ {
-	    fprintf(stderr,"WSAStartup() failed");
+	    flprintf("WSAStartup() failed");
 	    exit(1);
 	}
 	/* End WINSOCK initialization */
@@ -847,9 +847,9 @@ net_if_t *getNetIf(const char *wanted) {
 	}
 
 	if(!chosen) {
-	    fprintf(stderr, "No suitable network interface found%s%s\n",
+	    flprintf( "No suitable network interface found%s%s\n",
 		    wanted ? " for " : "", wanted ? wanted : "");
-	    fprintf(stderr, "The following interfaces are available:\n");
+	    flprintf( "The following interfaces are available:\n");
 
 	    for(i=0; i<iptab->dwNumEntries; i++) {
 		char buffer[16];
@@ -860,7 +860,7 @@ net_if_t *getNetIf(const char *wanted) {
 		addr.sin_addr.s_addr = iprow->dwAddr;
 		ifrow = getIfRow(iftab, iprow->dwIndex);
 		name = fmtName(ifrow);
-		fprintf(stderr, " %15s  %s\n",
+		flprintf( " %15s  %s\n",
 			udpc_getIpString(&addr, buffer),
 			name ? name : "");
 		if(name)
--- a/statistics.c
+++ b/statistics.c
@@ -62,7 +62,7 @@ static void initStats(struct stats *s,
     struct timeval now;
     gettimeofday(&now, 0);
     s->fd = fd;
-    s->statPeriod = statPeriod;    
+    s->statPeriod = statPeriod;
     s->printUncompressedPos = printUncompressedPos;
     s->lastPrinted = now;
 }
@@ -110,7 +110,7 @@ static void printFilePosition(int fd)
 	    }
 	    close(pfd);
 	} else {
-	    fprintf(stderr, "%s --> %s\n", fn, strerror(errno));
+	    flprintf( "%s --> %s\n", fn, strerror(errno));
 	}
 #else
 #ifdef HAVE_LSEEK64
@@ -120,7 +120,7 @@ static void printFilePosition(int fd)
 #else
 	off_t offset = lseek(fd, 0, SEEK_CUR);
 	if(offset != -1)
-	    fprintf(stderr, "%10d", offset);
+	    flprintf( "%10d", offset);
 #endif
 #endif
     }
@@ -157,29 +157,29 @@ void displayReceiverStats(receiver_stats_t rs, int isFinal) {
     if(!shouldPrint(&rs->s, &tv_now, isFinal))
 	return;
 
-    fprintf(stderr, "bytes=");
+    flprintf( "bytes=");
     printLongNum(rs->totalBytes);
-    fprintf(stderr, " (");
-    
+    flprintf( " (");
+
     timePassed = tv_now.tv_sec - rs->tv_start.tv_sec;
     timePassed *= 1000000;
     timePassed += tv_now.tv_usec - rs->tv_start.tv_usec;
     if (timePassed != 0) {
 	int mbps = (int) (rs->totalBytes * 800 / timePassed);
-	fprintf(stderr, "%3d.%02d", mbps / 100, mbps % 100);
+	flprintf( "%3d.%02d", mbps / 100, mbps % 100);
     } else {
-	fprintf(stderr, "***.**");
+	flprintf( "***.**");
     }
-    fprintf(stderr, " Mbps)");
+    flprintf( " Mbps)");
     if(rs->s.printUncompressedPos)
 	printFilePosition(rs->s.fd);
-    fprintf(stderr, "\r");
+    flprintf( "\r");
     fflush(stderr);
 }
 
 
 struct sender_stats {
-    FILE *log;    
+    FILE *log;
     unsigned long long totalBytes;
     unsigned long long retransmissions;
     int clNo;
@@ -226,7 +226,7 @@ void senderStatsAddBytes(sender_stats_t ss, long bytes) {
 void senderStatsAddRetransmissions(sender_stats_t ss, int retransmissions) {
     if(ss != NULL) {
 	ss->retransmissions += retransmissions;
-	logprintf(ss->log, "RETX %9lld %4d\n", ss->retransmissions, 
+	logprintf(ss->log, "RETX %9lld %4d\n", ss->retransmissions,
 		  retransmissions);
     }
 }
@@ -236,7 +236,7 @@ void displaySenderStats(sender_stats_t ss, int blockSize, int sliceSize,
 			int isFinal) {
     unsigned int blocks, percent;
     struct timeval tv_now;
-    
+
     if(ss == NULL)
 	return;
 
@@ -249,14 +249,14 @@ void displaySenderStats(sender_stats_t ss, int blockSize, int sliceSize,
       percent = 0;
     else
       percent = (1000L * ss->retransmissions) / blocks;
-    
-    fprintf(stderr, "bytes=");
+
+    flprintf( "bytes=");
     printLongNum(ss->totalBytes);
-    fprintf(stderr, " re-xmits=%07llu (%3u.%01u%%) slice=%04d ",
+    flprintf( " re-xmits=%07llu (%3u.%01u%%) slice=%04d ",
 	    ss->retransmissions, percent / 10, percent % 10, sliceSize);
     if(ss->s.printUncompressedPos)
 	printFilePosition(ss->s.fd);
-    fprintf(stderr, "- %3d\r", ss->clNo);
+    flprintf( "- %3d\r", ss->clNo);
     fflush(stderr);
 }
 
--- a/udp-receiver.c
+++ b/udp-receiver.c
@@ -88,10 +88,10 @@ static void intHandler(int nr) {
 #ifdef NO_BB
 static void usage(char *progname) {
 #ifdef HAVE_GETOPT_LONG
-    fprintf(stderr, "%s [--file file] [--pipe pipe] [--portbase portbase] [--interface net-interface] [--log file] [--ttl time-to-live] [--mcast-rdv-address mcast-rdv-address] [--rcvbuf buf] [--nokbd] [--exit-wait milliseconds] [--nosync] [--sync] [--start-timeout sto] [--license] [-x uncomprStatPrint] [-z statPeriod] [--print-uncompressed-position flag] [--stat-period millis] [--ignore-lost-data]\n", 
+    flprintf( "%s [--file file] [--pipe pipe] [--portbase portbase] [--interface net-interface] [--log file] [--ttl time-to-live] [--mcast-rdv-address mcast-rdv-address] [--rcvbuf buf] [--nokbd] [--exit-wait milliseconds] [--nosync] [--sync] [--start-timeout sto] [--license] [-x uncomprStatPrint] [-z statPeriod] [--print-uncompressed-position flag] [--stat-period millis] [--ignore-lost-data]\n",
 	    progname);
 #else /* HAVE_GETOPT_LONG */
-    fprintf(stderr, "%s [--f file] [--p pipe] [-P portbase] [-i net-interface] [-l logfile] [-t time-to-live] [-M mcast-rdv-address] [-b rcvbuf] [-k] [-w exit-wait-milliseconds] [-n] [-y] [-s start-timeout] [-L] [-x uncomprStatPrint] [-z statPeriod] [-Z]\n", 
+    flprintf( "%s [--f file] [--p pipe] [-P portbase] [-i net-interface] [-l logfile] [-t time-to-live] [-M mcast-rdv-address] [-b rcvbuf] [-k] [-w exit-wait-milliseconds] [-n] [-y] [-s start-timeout] [-L] [-x uncomprStatPrint] [-z statPeriod] [-Z]\n",
 	    progname);
 #endif /* HAVE_GETOPT_LONG */
     exit(1);
@@ -145,7 +145,7 @@ int main(int argc, char **argv)
 	ptr = argv[0];
     else
 	ptr++;
-    
+
     net_config.net_if = NULL;
     if (strcmp(ptr, "init") == 0) {
 	doWarn = 1;
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
 		break;
 
 	    case 's': /* start-timeout */
-		net_config.startTimeout = atoi(optarg);		
+		net_config.startTimeout = atoi(optarg);
 		break;
 
 	    case 'z':
@@ -244,7 +244,7 @@ int main(int argc, char **argv)
 	}
     }
 
-    fprintf(stderr, "Udp-receiver %s\n", version);
+    flprintf( "Udp-receiver %s\n", version);
 
 #ifdef LOSSTEST
     if(!seedSet)
@@ -255,10 +255,10 @@ int main(int argc, char **argv)
 #ifdef USE_SYSLOG
     openlog((const char *)"udpcast", LOG_NDELAY|LOG_PID, LOG_SYSLOG);
 #endif
-    
+
     ret= startReceiver(doWarn, &disk_config, &net_config, &stat_config, ifName);
     if(ret < 0) {
-      fprintf(stderr, "Receiver error\n");
+      flprintf( "Receiver error\n");
     }
     return ret;
 }
--- a/udp-sender.c
+++ b/udp-sender.c
@@ -134,18 +134,18 @@ static struct option options[] = {
 #ifdef NO_BB
 static void usage(char *progname) {
 #ifdef HAVE_GETOPT_LONG
-    fprintf(stderr, "%s [--file file] [--full-duplex] [--pipe pipe] [--portbase portbase] [--blocksize size] [--interface net-interface] [--mcast-data-address data-mcast-address] [--mcast-rdv-address mcast-rdv-address] [--max-bitrate bitrate] [--pointopoint] [--async] [--log file] [--min-slice-size min] [--max-slice-size max] [--slice-size] [--ttl time-to-live] [--fec <stripes>x<redundancy>/<stripesize>] [--print-seed] [--rexmit-hello-interval interval] [--autostart autostart] [--broadcast] [--min-receivers receivers] [--min-wait sec] [--max-wait sec] [--start-timeout n] [--retries-until-drop n] [--nokbd] [--bw-period n] [--streaming] [--rehello-offset offs]"
+    flprintf( "%s [--file file] [--full-duplex] [--pipe pipe] [--portbase portbase] [--blocksize size] [--interface net-interface] [--mcast-data-address data-mcast-address] [--mcast-rdv-address mcast-rdv-address] [--max-bitrate bitrate] [--pointopoint] [--async] [--log file] [--min-slice-size min] [--max-slice-size max] [--slice-size] [--ttl time-to-live] [--fec <stripes>x<redundancy>/<stripesize>] [--print-seed] [--rexmit-hello-interval interval] [--autostart autostart] [--broadcast] [--min-receivers receivers] [--min-wait sec] [--max-wait sec] [--start-timeout n] [--retries-until-drop n] [--nokbd] [--bw-period n] [--streaming] [--rehello-offset offs]"
 #ifdef DL_RATE_GOVERNOR
-	    " [--rate-governor module:parameters]" 
+	    " [--rate-governor module:parameters]"
 #endif
 #ifdef FLAG_AUTORATE
 	    " [--autorate]"
 #endif
 	    "[--license]\n", progname); /* FIXME: copy new options to busybox */
 #else /* HAVE_GETOPT_LONG */
-    fprintf(stderr, "%s [-f file] [-d] [-p pipe] [-P portbase] [-b size] [-i net-interface] [-m data-mcast-address] [-M mcast-rdv-address] [-r bitrate] [-1] [-a] [-l logfile] [-t time-to-live] [-F <stripes>x<redundancy>/<stripesize>][-H hello-retransmit-interval] [-S autostart] [-B] [-C min-receivers] [-w min-wait-sec] [-w max-wait-sec] [-T start-timeout] [-R n] [-k] [-I n] [-x uncomprStatPrint] [-z statPeriod] [-Z] [-Y rehello-offset]"
+    flprintf( "%s [-f file] [-d] [-p pipe] [-P portbase] [-b size] [-i net-interface] [-m data-mcast-address] [-M mcast-rdv-address] [-r bitrate] [-1] [-a] [-l logfile] [-t time-to-live] [-F <stripes>x<redundancy>/<stripesize>][-H hello-retransmit-interval] [-S autostart] [-B] [-C min-receivers] [-w min-wait-sec] [-w max-wait-sec] [-T start-timeout] [-R n] [-k] [-I n] [-x uncomprStatPrint] [-z statPeriod] [-Z] [-Y rehello-offset]"
 #ifdef DL_RATE_GOVERNOR
-	    " [-g rate-governor:parameters ]" 
+	    " [-g rate-governor:parameters ]"
 #endif
 #ifdef FLAG_AUTORATE
 	    " [-A]"
@@ -230,7 +230,7 @@ int main(int argc, char **argv)
 	disk_config.pipeName = strdup("/bin/gzip -c");
 	disk_config.fileName = "/dev/hda";
     } else {
-	const char *argLetters = 
+	const char *argLetters =
 	    "b:C:f:F:"
 #ifdef DL_RATE_GOVERNOR
 	    "g:"
@@ -240,7 +240,7 @@ int main(int argc, char **argv)
 	    "A"
 #endif
 	    "BcdDkLY:Z";
-        while( (c=getopt_l(argc, argv, argLetters)) 
+        while( (c=getopt_l(argc, argv, argLetters))
 	       != EOF ) {
 	    switch(c) {
 		case 'a':
@@ -252,7 +252,7 @@ int main(int argc, char **argv)
 		    break;
 		case 'd':
 		    net_config.flags |= FLAG_SN;
-		    break;		    
+		    break;
 		case 'f':
 		    disk_config.fileName=optarg;
 		    break;
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
 #ifdef FLAG_AUTORATE
 		    rgInitGovernor(&net_config, &autoRate);
 #else
-		    fatal(1, 
+		    fatal(1,
 			  "Auto rate limit not supported on this platform\n");
 #endif
 		    break;
@@ -333,7 +333,7 @@ int main(int argc, char **argv)
 			char *eptr;
 			ptr = strchr(optarg, 'x');
 			if(ptr) {
-			    net_config.fec_stripes = 
+			    net_config.fec_stripes =
 				strtoul(optarg, &eptr, 10);
 			    if(ptr != eptr) {
 				flprintf("%s != %s\n", ptr, eptr);
@@ -347,7 +347,7 @@ int main(int argc, char **argv)
 			net_config.fec_redundancy = strtoul(ptr, &eptr, 10);
 			if(*eptr == '/') {
 			    ptr = eptr+1;
-			    net_config.fec_stripesize = 
+			    net_config.fec_stripesize =
 				strtoul(ptr, &eptr, 10);
 			} else {
 			    net_config.fec_stripesize = 128;
@@ -356,7 +356,7 @@ int main(int argc, char **argv)
 			    flprintf("string not at end %s\n", eptr);
 			    usage(argv[0]);
 			}
-			fprintf(stderr, "stripes=%d redund=%d stripesize=%d\n",
+			flprintf( "stripes=%d redund=%d stripesize=%d\n",
 				net_config.fec_stripes,
 				net_config.fec_redundancy,
 				net_config.fec_stripesize);
@@ -395,10 +395,10 @@ int main(int argc, char **argv)
 		    break;
 	        case 'B': /* broadcast */
 		    net_config.flags |= FLAG_BCAST;
-		    break;		    
+		    break;
 	        case 's': /* sendbuf */
 		    net_config.requestedBufSize=parseSize(optarg);
-		    break;		    
+		    break;
 	        case 'C': /* min-clients */
 		    net_config.min_receivers = atoi(optarg);
 		    break;
@@ -448,7 +448,7 @@ int main(int argc, char **argv)
       if(dataMcastSupplied)
 	net_config.flags &= ~FLAG_POINTOPOINT;
       if(net_config.flags & FLAG_POINTOPOINT) {
-	fprintf(stderr, "Pointopoint supplied together with async, but no dataMcastAddress (-m)\n");
+	flprintf( "Pointopoint supplied together with async, but no dataMcastAddress (-m)\n");
 	return -1;
       }
     }
@@ -458,7 +458,7 @@ int main(int argc, char **argv)
     }
 
     if(optind < argc) {
-	fprintf(stderr, "Extra argument \"%s\" ignored\n", argv[optind]);
+	flprintf( "Extra argument \"%s\" ignored\n", argv[optind]);
     }
 
     if((net_config.flags & FLAG_POINTOPOINT) &&
@@ -476,23 +476,23 @@ int main(int argc, char **argv)
 #endif
     if(net_config.flags &  FLAG_ASYNC) {
 	if(net_config.rateGovernor == 0) {
-	    fprintf(stderr, 
+	    flprintf(
 		    "Async mode chosen but no rate governor ==> unsafe\n");
-	    fprintf(stderr, 
+	    flprintf(
 		    "Transmission would fail due to buffer overrung\n");
-	    fprintf(stderr, 
+	    flprintf(
 		    "Add \"--max-bitrate 9500k\" to commandline (for example)\n");
 	    exit(1);
 	}
 #ifdef BB_FEATURE_UDPCAST_FEC
-	if(! (net_config.flags & FLAG_FEC)) 
+	if(! (net_config.flags & FLAG_FEC))
 #endif
 	  {
-	    fprintf(stderr, 
+	    flprintf(
 		    "Warning: Async mode but no forward error correction\n");
-	    fprintf(stderr, 
+	    flprintf(
 		    "Transmission may fail due to packet loss\n");
-	    fprintf(stderr, 
+	    flprintf(
 		    "Add \"--fec 8x8\" to commandline\n");
 	}
     }
@@ -508,7 +508,7 @@ int main(int argc, char **argv)
 	    net_config.default_slice_size = net_config.max_slice_size;
     }
 
-    fprintf(stderr, "Udp-sender %s\n", version);
+    flprintf( "Udp-sender %s\n", version);
 
     /*
     if(disk_config.fileName == NULL && disk_config.pipeName == NULL) {
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
 #ifdef USE_SYSLOG
     openlog((const char *)"udpcast", LOG_NDELAY|LOG_PID, LOG_SYSLOG);
 #endif
-    
+
     do {
 	r= startSender(&disk_config, &net_config, &stat_config, ifName);
     } while(daemon_mode);
--- a/udps-negotiate.c
+++ b/udps-negotiate.c
@@ -311,7 +311,7 @@ int startSender(struct disk_config *disk_config,
 
     if(! (net_config->flags & (FLAG_SN | FLAG_NOTSN)) ) {
       if(isFullDuplex(sock[0], net_config->net_if->name) == 1) {
-	fprintf(stderr, "Using full duplex mode\n");
+	flprintf( "Using full duplex mode\n");
 	net_config->flags |= FLAG_SN;
       }
     }
@@ -406,7 +406,7 @@ int startSender(struct disk_config *disk_config,
 	   udpc_nrParticipants(db) > 0)
 	  doTransfer(sock[0], db, disk_config, net_config, stat_config);
 	else
-	  fprintf(stderr, "No participants... exiting\n");
+	  flprintf( "No participants... exiting\n");
     }
     free(db);
     closesocket(sock[0]);
