Blob
1 /* Copyright (c) 2004 Google Inc.; see LICENSE */2 #include <stdarg.h>3 #include <string.h>4 #include "plan9.h"5 #include "fmt.h"6 #include "fmtdef.h"8 /*9 * Absorb output without using resources.10 */11 static Rune nullbuf[32];13 static int14 __fmtnullflush(Fmt *f)15 {16 f->to = nullbuf;17 f->nfmt = 0;18 return 0;19 }21 int22 fmtnullinit(Fmt *f)23 {24 memset(&f, 0, sizeof *f);25 f->runes = 1;26 f->start = nullbuf;27 f->to = nullbuf;28 f->stop = nullbuf+nelem(nullbuf);29 f->flush = __fmtnullflush;30 fmtlocaleinit(f, nil, nil, nil);31 return 0;32 }