/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
* Copyright (C) 1999-2000 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "mutt.h"
#include "mx.h"
#include "rfc2047.h"
#include "sort.h"
#include "mailbox.h"
#include "copy.h"
#include "keymap.h"
#ifdef HAVE_PGP
#include "pgp.h"
#endif
#ifdef USE_IMAP
#include "imap.h"
#endif
#ifdef BUFFY_SIZE
#include "buffy.h"
#endif
#ifdef USE_DOTLOCK
#include "dotlock.h"
#endif
#include <dirent.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifndef BUFFY_SIZE
#include <utime.h>
#endif
#define mutt_is_spool(s) (mutt_strcmp (Spoolfile, s) == 0)
#ifdef USE_DOTLOCK
/* parameters:
* path - file to lock
* retry - should retry if unable to lock?
*/
#ifdef DL_STANDALONE
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
char f[SHORT_STRING + _POSIX_PATH_MAX];
char r[SHORT_STRING];
if (flags & DL_FL_RETRY)
snpri