/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mmap-util.h"
#include "mail-index-private.h"
#include "mail-index-strmap.h"
#include "doveadm-dump.h"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
{
return sizeof(*hdr);
}
{
/* <uid diff> <n> <crc32>*count <str_idx>*count */
return -1;
if (mail_index_unpack_num(p, end, &n) < 0)
return -1;
return -1;
for (i = 0; i < count; i++) {
if (i == 0)
printf(" - message-id: ");
else if (i == 1) {
if (n == 1)
printf(" - in-reply-to: ");
else
printf(" - references[1]: ");
} else {
printf(" - references[%u]: ", i);
}
if (idx > max_likely_index)
printf(" - index probably broken\n");
}
*p += size;
return 0;
}
{
const uint8_t *p;
return -1;
if (block_size == 0) {
/* finished */
return -1;
}
printf(" - broken!\n");
return -1;
}
p = data + sizeof(block_size);
end = p + block_size;
*uid += 1;
while (p != end) {
printf(" - broken\n");
return -1;
}
}
return p - data;
}
{
unsigned int pos;
if (fd < 0)
if (map == MAP_FAILED)
i_fatal("mmap() failed: %m");
uid = 0;
do {
T_BEGIN {
} T_END;
} while (ret > 0);
i_close_fd(&fd);
}
{
const char *p;
}
"thread",
};