-mbx_read (FILE *fp, long pos, struct drop **drops, int noisy)
+mbx_read (FILE *fp, long pos, struct drop **drops)
- register struct drop *cp, *dp, *ep, *pp;
+ struct drop *cp, *dp, *ep, *pp;
- pp = (struct drop *) mh_xcalloc ((size_t) (len = MAXFOLDER), sizeof(*dp));
- if (pp == NULL) {
- if (noisy)
- admonish (NULL, "unable to allocate drop storage");
- return NOTOK;
- }
+ len = MAXFOLDER;
+ pp = mh_xcalloc(len, sizeof *pp);
cp = (struct drop *) mh_xrealloc ((char *) pp,
(size_t) (len += MAXFOLDER) * sizeof(*pp));
cp = (struct drop *) mh_xrealloc ((char *) pp,
(size_t) (len += MAXFOLDER) * sizeof(*pp));
mbx_write(char *mailbox, int md, FILE *fp, int id, long last,
long pos, off_t stop, int mapping, int noisy)
{
mbx_write(char *mailbox, int md, FILE *fp, int id, long last,
long pos, off_t stop, int mapping, int noisy)
{
tp = dctime(dlocaltimenow());
snprintf (buffer, sizeof(buffer), "From %.*s %s",
(int)(fp - ep), ep, tp);
tp = dctime(dlocaltimenow());
snprintf (buffer, sizeof(buffer), "From %.*s %s",
(int)(fp - ep), ep, tp);
strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
ep = tmpbuffer + 17;
snprintf (buffer, sizeof(buffer), "From %s", ep);
strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
ep = tmpbuffer + 17;
snprintf (buffer, sizeof(buffer), "From %s", ep);
/*
* If there is already a "From " line,
* then leave it alone. Else we add one.
/*
* If there is already a "From " line,
* then leave it alone. Else we add one.
* If this is not first line, and begins with
* "From ", then prepend line with ">".
*/
* If this is not first line, and begins with
* "From ", then prepend line with ">".
*/
if (write (md, ">", 1) < 0) {
advise (mailbox, "write");
}
if (write (md, ">", 1) < 0) {
advise (mailbox, "write");
}
static char buffer[BUFSIZ];
if ((dp = strchr(cp = r1bindex (file, '/'), '.')) == NULL)
static char buffer[BUFSIZ];
if ((dp = strchr(cp = r1bindex (file, '/'), '.')) == NULL)
int
map_read (char *file, long pos, struct drop **drops, int noisy)
{
int
map_read (char *file, long pos, struct drop **drops, int noisy)
{
if ((md = open (cp = map_name (file), O_RDONLY)) == NOTOK
|| map_chk (cp, md, mp = &d, pos, noisy)) {
if ((md = open (cp = map_name (file), O_RDONLY)) == NOTOK
|| map_chk (cp, md, mp = &d, pos, noisy)) {
memcpy((char *) dp, (char *) mp, sizeof(*dp));
lseek (md, (off_t) sizeof(*mp), SEEK_SET);
if ((i = read (md, (char *) (dp + 1), msgp * sizeof(*dp))) <
(int) sizeof(*dp)) {
i = 0;
memcpy((char *) dp, (char *) mp, sizeof(*dp));
lseek (md, (off_t) sizeof(*mp), SEEK_SET);
if ((i = read (md, (char *) (dp + 1), msgp * sizeof(*dp))) <
(int) sizeof(*dp)) {
i = 0;
map_write (char *mailbox, int md, int id, long last, off_t start,
off_t stop, long pos, int size, int noisy)
{
map_write (char *mailbox, int md, int id, long last, off_t start,
off_t stop, long pos, int size, int noisy)
{