#endif
#include <string.h>
+#include <stdarg.h>
#include "lib/unaligned.h"
int (*config)(struct fastbuf *, uns, int); /* Configure the stream */
};
-/* FastIO on standard files */
+/* FastIO on standard files (specify buffer size 0 to enable mmaping) */
struct fastbuf *bopen(byte *name, uns mode, uns buffer);
struct fastbuf *bopen_tmp(uns buffer);
/* Direct I/O on buffers */
-static inline int
+static inline uns
bdirect_read_prepare(struct fastbuf *f, byte **buf)
{
if (f->bptr == f->bstop && !f->refill(f))
- return EOF;
+ return 0;
*buf = f->bptr;
return f->bstop - f->bptr;
}
f->bptr = pos;
}
-static inline int
+static inline uns
bdirect_write_prepare(struct fastbuf *f, byte **buf)
{
if (f->bptr == f->bufend)
f->bptr = pos;
}
+/* Formatted output */
+
+int bprintf(struct fastbuf *b, byte *msg, ...);
+int vbprintf(struct fastbuf *b, byte *msg, va_list args);
+
#endif