Blob


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"
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;
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 }