2006-05-21 20:49:16 +00:00
|
|
|
/* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
|
2004-02-29 22:11:15 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <unistd.h>
|
2004-12-26 21:50:14 +00:00
|
|
|
#include "plan9.h"
|
2004-02-29 22:11:15 +00:00
|
|
|
#include "fmt.h"
|
|
|
|
|
#include "fmtdef.h"
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* generic routine for flushing a formatting buffer
|
|
|
|
|
* to a file descriptor
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
__fmtFdFlush(Fmt *f)
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
n = (char*)f->to - (char*)f->start;
|
2005-12-29 21:41:54 +00:00
|
|
|
if(n && write((uintptr)f->farg, f->start, n) != n)
|
2004-02-29 22:11:15 +00:00
|
|
|
return 0;
|
|
|
|
|
f->to = f->start;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|