tfmtfdflush.c - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
tfmtfdflush.c (412B)
---
     1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
     2 #include 
     3 #include 
     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 }