hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

fmtfdflush.c (412B)


      1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
      2 #include <stdarg.h>
      3 #include <unistd.h>
      4 #include "plan9.h"
      5 #include "fmt.h"
      6 #include "fmtdef.h"
      7 
      8 /*
      9  * generic routine for flushing a formatting buffer
     10  * to a file descriptor
     11  */
     12 int
     13 __fmtFdFlush(Fmt *f)
     14 {
     15 	int n;
     16 
     17 	n = (char*)f->to - (char*)f->start;
     18 	if(n && write((uintptr)f->farg, f->start, n) != n)
     19 		return 0;
     20 	f->to = f->start;
     21 	return 1;
     22 }