6 * rbuf - buffered I/O input primitive.
8 * This code is like stdio, only simpler and more transparent to the user.
10 * Author: Rusty Russell <rusty@rustcorp.com.au>
14 * #include <ccan/rbuf/rbuf.h>
15 * #include <ccan/err/err.h>
19 * // Dumb demo program to replace ' ' with '*'.
20 * int main(int argc, char *argv[])
26 * if (!rbuf_open(&in, argv[1], NULL, 0, membuf_realloc))
27 * err(1, "Failed opening %s", argv[1]);
29 * rbuf_init(&in, STDIN_FILENO, NULL, 0, membuf_realloc);
31 * while ((word = rbuf_read_str(&in, ' ')) != NULL)
32 * printf("%s*", word);
35 * err(1, "Reading %s", argv[1] ? argv[1] : "<stdin>");
37 * // Free the buffer, just because we can.
38 * free(rbuf_cleanup(&in));
42 int main(int argc, char *argv[])
44 /* Expect exactly one argument */
48 if (strcmp(argv[1], "depends") == 0) {
49 printf("ccan/membuf\n");