X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Frfc822%2F_info;h=7c3ca08eda7a0a3affc069257b1db31305f3b24c;hp=3eea31ed854e3c08bc796fe5664a3c8126b5f635;hb=9a483e66096528915f59d875931a48eab523ca82;hpb=07962f1c3f6f2916f412b95b28513314294aba2e diff --git a/ccan/rfc822/_info b/ccan/rfc822/_info index 3eea31ed..7c3ca08e 100644 --- a/ccan/rfc822/_info +++ b/ccan/rfc822/_info @@ -20,22 +20,35 @@ * RFC822 compliant, don't SEGV and try to return as much useful * data as possible. * + * Define TAL_USE_TALLOC to use libtalloc as the allocator, otherwise + * it will use ccan/tal (usually done on the cmdline, as tal/str will need + * it too). + * * Example: + * // Given '' outputs 'body' + * // Given 'From' outputs ' ' + * // Given 'To' outputs ' ' * char buf[] = "From: \n" * "To: \n\n" * "body\n"; * struct rfc822_msg *msg; - * struct bytestring body; + * struct bytestring out; * * msg = rfc822_start(NULL, buf, sizeof(buf)); - * body = rfc822_body(msg); - * fwrite(body.ptr, 1, body.len, stdout); + * if (!argv[1] || !argv[1][0]) + * out = rfc822_body(msg); + * else { + * struct rfc822_header *hdr; + * hdr = rfc822_first_header_of_name(msg, argv[1]); + * if (!hdr) + * exit(1); + * out = rfc822_header_unfolded_value(msg, hdr); + * } + * fwrite(out.ptr, 1, out.len, stdout); + * rfc822_free(msg); * * License: LGPL (v2.1 or any later version) * - * Ccanlint: - * // The failtest module is only used for tests: ccanlint is overzealous - * license_depends_compat FAIL */ int main(int argc, char *argv[]) { @@ -44,13 +57,23 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("ccan/array_size\n"); - printf("ccan/talloc\n"); +#ifdef TAL_USE_TALLOC + printf("ccan/tal/talloc\n"); +#else + printf("ccan/tal\n"); +#endif printf("ccan/list\n"); - printf("ccan/foreach\n"); - printf("ccan/failtest\n"); printf("ccan/str\n"); printf("ccan/bytestring\n"); + printf("ccan/memmem\n"); + return 0; + } + + if (strcmp(argv[1], "testdepends") == 0) { + printf("ccan/failtest\n"); + printf("ccan/foreach\n"); + printf("ccan/array_size\n"); + printf("ccan/tal/str\n"); return 0; }