]> git.ozlabs.org Git - ccan/blob - ccan/rfc822/_info
560812d41f4540ba1ca43330649dc8107c7cdef2
[ccan] / ccan / rfc822 / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * rfc822 - Parsing of RFC822 emails
7  *
8  * This code allows easy processing of RFC822/RFC2822/RFC5322
9  * formatted email messages.  For now only read-only operation is
10  * supported.
11  *
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
21  *   data as possible.
22  *
23  * Example:
24  *      char buf[] = "From: <from@example.com>\n"
25  *                   "To: <to@example.com>\n\n"
26  *                   "body\n";
27  *      struct rfc822_msg *msg;
28  *      struct bytestring body;
29  *
30  *      msg = rfc822_start(NULL, buf, sizeof(buf));
31  *      body = rfc822_body(msg);
32  *      fwrite(body.ptr, 1, body.len, stdout);
33  *
34  * License: LGPL (v2.1 or any later version)
35  */
36 int main(int argc, char *argv[])
37 {
38         /* Expect exactly one argument */
39         if (argc != 2)
40                 return 1;
41
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");
48                 printf("ccan/str\n");
49                 printf("ccan/bytestring\n");
50                 return 0;
51         }
52
53         return 1;
54 }