6 * tal/grab_file - file helper routines
8 * This contains simple functions for getting the contents of a file.
14 * #include <ccan/tal/grab_file/grab_file.h>
15 * #include <ccan/tal/tal.h> // for tal_free
17 * int main(int argc, char *argv[])
21 * file = grab_file(NULL, argv[1]);
23 * err(1, "Could not read file %s", argv[1]);
24 * if (strlen(file)+1 != tal_count(file))
25 * printf("File contains NUL characters\n");
26 * else if (tal_count(file) == 1)
27 * printf("File contains nothing\n");
28 * else if (strchr(file, '\n'))
29 * printf("File contains multiple lines\n");
31 * printf("File contains one line\n");
37 * License: LGPL (v2.1 or any later version)
38 * Author: Rusty Russell <rusty@rustcorp.com.au>
40 int main(int argc, char *argv[])
45 if (strcmp(argv[1], "depends") == 0) {
47 printf("ccan/noerr\n");
50 if (strcmp(argv[1], "testdepends") == 0) {
51 printf("ccan/tal/str\n");