X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fread_write_all%2F_info;fp=ccan%2Fread_write_all%2F_info;h=32fccc88e60b19963cad03963ab93ac6f98153d0;hb=570c9c555f076e74f46141bb42b5d1d7ac89f632;hp=0000000000000000000000000000000000000000;hpb=8f61c0bccb152b2365baf70deac1e59264d7feb7;p=ccan diff --git a/ccan/read_write_all/_info b/ccan/read_write_all/_info new file mode 100644 index 00000000..32fccc88 --- /dev/null +++ b/ccan/read_write_all/_info @@ -0,0 +1,43 @@ +#include +#include +#include "config.h" + +/** + * read_write_all - read_all and write_all routines. + * + * Successful read and write calls may only partly complete if a + * signal is received or they are not operating on a normal file. + * + * read_all() and write_all() do the looping for you. + * + * Example: + * #include + * #include + * #include + * #include + * + * #define BUFFER_SIZE 10 + * int main(int argc, char *argv[]) + * { + * char buffer[BUFFER_SIZE+1]; + * + * if (!read_all(STDIN_FILENO, buffer, BUFFER_SIZE)) + * err(1, "Could not read %u characters", BUFFER_SIZE); + * buffer[BUFFER_SIZE] = '\0'; + * printf("I read '%.*s'\n", BUFFER_SIZE, buffer); + * return 0; + * } + * + * Licence: LGPL (2 or any later version) + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + return 0; + } + + return 1; +}