| fmtnull.c - 9base - revived minimalist port of Plan 9 userland to Unix | |
| git clone git://git.suckless.org/9base | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| fmtnull.c (521B) | |
| --- | |
| 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" | |
| 7 | |
| 8 /* | |
| 9 * Absorb output without using resources. | |
| 10 */ | |
| 11 static Rune nullbuf[32]; | |
| 12 | |
| 13 static int | |
| 14 __fmtnullflush(Fmt *f) | |
| 15 { | |
| 16 f->to = nullbuf; | |
| 17 f->nfmt = 0; | |
| 18 return 0; | |
| 19 } | |
| 20 | |
| 21 int | |
| 22 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 } | |
| 33 |