/*
* Copyright (C) 1996-2001 Michael R. Elkins <me@cs.hmc.edu>
* Copyright (C) 1999-2001 Thomas Roessler <roessler@guug.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
/*
* This file contains routines specific to MH and ``maildir'' style
* mailboxes.
*/
#include "mutt.h"
#include "mailbox.h"
#include "mx.h"
#include "copy.h"
#include "buffy.h"
#include "sort.h"
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
struct maildir
{
HEADER *h;
char *canon_fname;
struct maildir *next;
};
struct mh_sequences
{
int max;
short *flags;
};
/* mh_sequences support */
#define MH_SEQ_UNSEEN (1 << 0)
#define MH_SEQ_REPLIED (1 << 1)
#define MH_SEQ_FLAGGED (1 << 2)
static void mhs_alloc (struct mh_sequences *mhs, int i)
{
int j;
int newmax;
if (i > mhs->max || !mhs->flags)
{
newmax = i + 128;
safe_realloc ((void **) &mhs->flags, sizeof (mhs->flags[0]) *