summaryrefslogtreecommitdiff
path: root/lib/ccan/read_write_all/_info
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-02-22 14:59:32 +1030
committerAmitay Isaacs <amitay@gmail.com>2012-03-07 13:16:16 +1100
commit361f3ea9ee577c5a3e2fed687a0b417b257c31de (patch)
tree6d356c3aa64317c609ff4e208be76e18996a55f8 /lib/ccan/read_write_all/_info
parent4f5412dda687c3ff76b426842bf284d01d56a997 (diff)
downloadsamba-361f3ea9ee577c5a3e2fed687a0b417b257c31de.tar.gz
samba-361f3ea9ee577c5a3e2fed687a0b417b257c31de.tar.bz2
samba-361f3ea9ee577c5a3e2fed687a0b417b257c31de.zip
lib/ccan: import failtest and required ccan modules for TDB2 unit tests.
New modules: failtest, list, time, read_write_all and tlist. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan/read_write_all/_info')
-rw-r--r--lib/ccan/read_write_all/_info44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/ccan/read_write_all/_info b/lib/ccan/read_write_all/_info
new file mode 100644
index 0000000000..d70cbd1d15
--- /dev/null
+++ b/lib/ccan/read_write_all/_info
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <string.h>
+#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 <err.h>
+ * #include <stdio.h>
+ * #include <unistd.h>
+ * #include <ccan/read_write_all/read_write_all.h>
+ *
+ * #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;
+ * }
+ *
+ * License: LGPL (v2.1 or any later version)
+ * Author: Rusty Russell <rusty@rustcorp.com.au>
+ */
+int main(int argc, char *argv[])
+{
+ if (argc != 2)
+ return 1;
+
+ if (strcmp(argv[1], "depends") == 0) {
+ return 0;
+ }
+
+ return 1;
+}