9 #include <ccan/talloc/talloc.h>
10 #include <ccan/grab_file/grab_file.h>
11 #include <ccan/rfc822/rfc822.h>
13 static void process_file(const char *name)
15 void *ctx = talloc_new(NULL);
18 struct rfc822_msg *msg;
19 struct rfc822_header *hdr;
21 buf = grab_file(ctx, name, &size);
23 msg = rfc822_start(ctx, buf, size);
25 rfc822_for_each_header(msg, hdr) {
26 struct bytestring hname = rfc822_header_raw_name(msg, hdr);
28 printf("%.*s\n", hname.len, hname.ptr);
34 int main(int argc, char *argv[])
38 for (i = 0; i < (argc - 1); i++)
39 process_file(argv[i + 1]);