istream-raw-mbox.c revision 0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "istream-internal.h"
#include "istream-raw-mbox.h"
#include "mbox-from.h"
struct raw_mbox_istream {
};
{
}
{
}
{
}
void (*timeout_cb)(void *), void *context)
{
}
{
static const char *mbox_from = "\nFrom ";
const unsigned char *buf, *p;
const char *fromp;
do {
/* EOF */
return -1;
}
/* read the full From-line */
/* EOF - shouldn't happen */
return -1;
}
}
if (rstream->from_offset != 0) {
buf++;
pos--;
}
/* beginning of mbox */
else
/* broken From - should happen only at beginning of
file if this isn't a mbox.. */
return -1;
}
if (rstream->from_offset == 0)
else
/* we'll skip over From-line and try again */
}
if (pos >= 31) {
return -1;
}
}
} else if (ret == -1) {
/* last few bytes, can't contain From-line */
return ret;
}
/* See if we have From-line here - note that it works right only
because all characters are different in mbox_from. */
if (*++fromp == '\0') {
/* potential From-line - stop here */
i++;
break;
}
} else {
fromp++;
}
}
return ret;
}
{
}
{
struct raw_mbox_istream *rstream;
}
{
const unsigned char *data;
/* minimal: "From x Thu Nov 29 22:33:52 2001" = 31 chars */
return -1;
/* EOF */
return TRUE;
}
return FALSE;
break;
}
return FALSE;
return TRUE;
}
{
struct raw_mbox_istream *rstream =
const unsigned char *data;
if (istream_raw_mbox_is_valid_from(rstream) > 0) {
return body_size;
}
}
/* have to read through the message body */
}
{
struct raw_mbox_istream *rstream =
}
{
struct raw_mbox_istream *rstream =
/* kludgy */
}