X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstr_talloc%2F_info.c;fp=ccan%2Fstr_talloc%2F_info.c;h=3186b2bacbc68e70e09536d06ca910ce841ba6cf;hp=0000000000000000000000000000000000000000;hb=9965fc25fcc92dc76d1cd4cf9595dc3dc9ebc586;hpb=963fa5ca9303d146d635e2fba04814f4f791c559 diff --git a/ccan/str_talloc/_info.c b/ccan/str_talloc/_info.c new file mode 100644 index 00000000..3186b2ba --- /dev/null +++ b/ccan/str_talloc/_info.c @@ -0,0 +1,52 @@ +#include +#include +#include "config.h" + +/** + * str_talloc - string helper routines which use talloc + * + * This is a grab bag of fnctions for string operations, designed to enhance + * the standard string.h; these are separated from the non-talloc-needing + * string utilities in "str.h". + * + * Example: + * #include "str_talloc/str_talloc.h" + * #include "talloc/talloc.h" + * #include "grab_file/grab_file.h" + * #include + * + * // Dumb demo program to double-linespace a file. + * int main(int argc, char *argv[]) + * { + * char *textfile; + * char **lines; + * + * // Grab lines in file. + * textfile = grab_file(NULL, argv[1], NULL); + * if (!textfile) + * err(1, "Failed reading %s", argv[1]); + * lines = strsplit(textfile, textfile, "\n", NULL); + * + * // Join them back together with two linefeeds. + * printf("%s", strjoin(textfile, lines, "\n\n")); + * + * // Free everything, just because we can. + * talloc_free(textfile); + * 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) { + printf("ccan/talloc\n"); + printf("ccan/noerr\n"); + return 0; + } + + return 1; +}