wordsplit str_ctype str_upper bucket conf object sorter \
finger proctitle ipaccess profile bitsig randomkey \
hashfunc base64 base224 fb-temp fb-mmap fb-printf urlkey \
- partmap fb-limfd
+ partmap fb-limfd fb-buffer
LIBSH_MOD_PATHS=$(addprefix obj/lib/,$(LIBSH_MODS)) $(CUSTOM_LIB_MODULES)
obj/lib/libsh.a: $(addsuffix .o,$(LIBSH_MOD_PATHS))
struct fastbuf *bopen_limited_fd(int fd, uns bufsize, uns limit);
+/* FastIO on static buffers */
+
+void fbbuf_init_read(struct fastbuf *f, byte *buffer, uns size);
+void fbbuf_init_write(struct fastbuf *f, byte *buffer, uns size);
+static inline uns
+fbbuf_count_written(struct fastbuf *f)
+{
+ return f->bptr - f->bstop;
+}
+
/* Configuring stream parameters */
int bconfig(struct fastbuf *f, uns type, int data);
--- /dev/null
+/*
+ * Sherlock Library -- Fast Buffered I/O on Static Buffers
+ *
+ * (c) 2003 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#include "lib/lib.h"
+#include "lib/fastbuf.h"
+
+static int
+fbbuf_refill(struct fastbuf *f UNUSED)
+{
+ return 0;
+}
+
+void
+fbbuf_init_read(struct fastbuf *f, byte *buf, uns size)
+{
+ f->buffer = f->bptr = buf;
+ f->bstop = f->bufend = buf + size;
+ f->name = "fbbuf-read";
+ f->pos = size;
+ f->refill = fbbuf_refill;
+ f->spout = NULL;
+ f->seek = NULL;
+ f->close = NULL;
+ f->config = NULL;
+}
+
+static void
+fbbuf_spout(struct fastbuf *f UNUSED)
+{
+ die("fbbuf: buffer overflow on write");
+}
+
+void
+fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
+{
+ f->buffer = f->bstop = f->bptr = buf;
+ f->bufend = buf + size;
+ f->name = "fbbuf-write";
+ f->pos = size;
+ f->refill = NULL;
+ f->spout = fbbuf_spout;
+ f->seek = NULL;
+ f->close = NULL;
+ f->config = NULL;
+}