6 * str_talloc - string helper routines which use talloc
8 * This is a grab bag of fnctions for string operations, designed to enhance
9 * the standard string.h; these are separated from the non-talloc-needing
10 * string utilities in "str.h".
13 * #include <ccan/str_talloc/str_talloc.h>
14 * #include <ccan/talloc/talloc.h>
15 * #include <ccan/grab_file/grab_file.h>
18 * // Dumb demo program to double-linespace a file.
19 * int main(int argc, char *argv[])
24 * // Grab lines in file.
25 * textfile = grab_file(NULL, argv[1], NULL);
27 * err(1, "Failed reading %s", argv[1]);
28 * lines = strsplit(textfile, textfile, "\n");
30 * // Join them back together with two linefeeds.
31 * printf("%s", strjoin(textfile, lines, "\n\n"));
33 * // Free everything, just because we can.
34 * talloc_free(textfile);
38 * License: LGPL (v2.1 or any later version)
39 * Author: Rusty Russell <rusty@rustcorp.com.au>
41 int main(int argc, char *argv[])
46 if (strcmp(argv[1], "depends") == 0) {
48 printf("ccan/talloc\n");