6 * rfc822 - Parsing of RFC822 emails
8 * This code allows easy processing of RFC822/RFC2822/RFC5322
9 * formatted email messages. For now only read-only operation is
12 * The important design goals are these:
13 * - Be lazy. Don't compute immediately compute fancy indexes for the
14 * message. Just reading messages into the system and then sending
15 * them out again should not incur a serious performance hit.
16 * - But cache. Once the user does request data that needs parsing,
17 * cache the results in suitable data structures so that if lots
18 * more lookups are done they're then fast.
19 * - Cope with ill-formatted messages. Even if the input is not
20 * RFC822 compliant, don't SEGV and try to return as much useful
24 * char buf[] = "From: <from@example.com>\n"
25 * "To: <to@example.com>\n\n"
27 * struct rfc822_msg *msg;
28 * struct bytestring body;
30 * msg = rfc822_start(NULL, buf, sizeof(buf));
31 * body = rfc822_body(msg);
32 * fwrite(body.ptr, 1, body.len, stdout);
34 * License: LGPL (v2.1 or any later version)
36 int main(int argc, char *argv[])
38 /* Expect exactly one argument */
42 if (strcmp(argv[1], "depends") == 0) {
43 printf("ccan/array_size\n");
44 printf("ccan/talloc\n");
45 printf("ccan/list\n");
46 printf("ccan/foreach\n");
47 printf("ccan/failtest\n");
49 printf("ccan/bytestring\n");