2016-07-11 14:11:52 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
|
|
|
|
#include "blaze822.h"
|
|
|
|
|
2016-07-11 14:28:22 +00:00
|
|
|
static size_t l;
|
|
|
|
static char *hdr;
|
|
|
|
|
2016-07-11 14:11:52 +00:00
|
|
|
void
|
2016-07-11 14:28:22 +00:00
|
|
|
header(char *file)
|
2016-07-11 14:11:52 +00:00
|
|
|
{
|
|
|
|
struct message *msg;
|
|
|
|
|
|
|
|
msg = blaze822(file);
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
char *v = blaze822_hdr_(msg, hdr, l);
|
|
|
|
if (v)
|
|
|
|
printf("%s\n", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2016-07-11 14:28:22 +00:00
|
|
|
l = strlen(argv[1])+2;
|
|
|
|
hdr = malloc(l);
|
2016-07-11 14:11:52 +00:00
|
|
|
hdr[0] = 0;
|
|
|
|
char *s = hdr+1;
|
|
|
|
char *t = argv[1];
|
|
|
|
while (*t)
|
|
|
|
*s++ = tolower(*t++);
|
|
|
|
*s = ':';
|
|
|
|
|
2016-07-11 14:28:22 +00:00
|
|
|
int i = blaze822_loop(argc-2, argv+2, header);
|
|
|
|
|
2016-07-11 14:11:52 +00:00
|
|
|
printf("%d mails scanned\n", i);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|