X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2F_info;h=6e95e4ab9e18b7b494b4624ea53f64dd0bd95c15;hb=bc6d22ecf820d0b4547ace17ff7e7ecebf0e415b;hp=6dd633abdfc4db651112c13c443f71262d44c91e;hpb=cdffdf5d61f8330cfc3467e73a84876eb3928e9b;p=ccan diff --git a/ccan/io/_info b/ccan/io/_info index 6dd633ab..6e95e4ab 100644 --- a/ccan/io/_info +++ b/ccan/io/_info @@ -11,7 +11,7 @@ * plans. * * Example: - * // Given tr A-Z a-z outputs tr a-z a-z + * // Given "tr A-Z a-z" outputs tr a-z a-z * #include * #include * #include @@ -51,7 +51,7 @@ * * // No room? Wait for writer * if (b->end == sizeof(b->buf)) - * return io_wait(c, b, IO_IN, read_in, b); + * return io_wait(c, b, read_in, b); * * return io_read_partial(c, b->buf + b->end, sizeof(b->buf) - b->end, * &b->rlen, read_in, b); @@ -61,9 +61,10 @@ * { * // Remove what we just wrote. * b->start += b->wlen; + * b->wlen = 0; * assert(b->start <= sizeof(b->buf)); * - * // If we wrote something, wake writer. + * // If we wrote something, wake reader. * if (b->wlen != 0) * io_wake(b); * @@ -71,7 +72,7 @@ * if (b->end == b->start) { * if (b->finished) * return io_close(c); - * return io_wait(c, b, IO_OUT, write_out, b); + * return io_wait(c, b, write_out, b); * } * * return io_write_partial(c, b->buf + b->start, b->end - b->start, @@ -114,11 +115,12 @@ * io_new_conn(NULL, tochild[1], write_out, &to); * * // Read from child, write to stdout. + * memset(&from, 0, sizeof(from)); * reader = io_new_conn(NULL, fromchild[0], read_in, &from); * io_set_finish(reader, finish, &from); * io_new_conn(NULL, STDOUT_FILENO, write_out, &from); * - * io_loop(); + * io_loop(NULL, NULL); * wait(&status); * * return WIFEXITED(status) ? WEXITSTATUS(status) : 2; @@ -133,7 +135,11 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { + printf("ccan/container_of\n"); + printf("ccan/list\n"); printf("ccan/tal\n"); + printf("ccan/time\n"); + printf("ccan/timer\n"); printf("ccan/typesafe_cb\n"); return 0; }