it, so …
one more step toward mutt build system simplification.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
BUILT_SOURCES = keymap_defs.h version.h
BUILT_SOURCES = keymap_defs.h version.h
-bin_PROGRAMS = muttng @DOTLOCK_TARGET@ @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
+bin_PROGRAMS = muttng muttng_dotlock @PGPAUX_TARGET@ @SMIMEAUX_TARGET@
muttng_SOURCES = $(BUILT_SOURCES) \
alias.c attach.c base64.c browser.c buffy.c \
charset.c color.c compress.c crypt.c cryptglue.c commands.c complete.c \
muttng_SOURCES = $(BUILT_SOURCES) \
alias.c attach.c base64.c browser.c buffy.c \
charset.c color.c compress.c crypt.c cryptglue.c commands.c complete.c \
-AC_ARG_ENABLE(external_dotlock, AC_HELP_STRING([--enable-external-dotlock], [Force use of an external dotlock program]),
- [mutt_cv_external_dotlock="$enableval"])
-
-if test "x$mutt_cv_setgid" = "xyes" || test "x$mutt_cv_fchdir" = "xno" \
- || test "x$mutt_cv_external_dotlock" = "xyes"
-then
- AC_DEFINE(DL_STANDALONE,1,[ Define if you want to use an external dotlocking program. ])
- DOTLOCK_TARGET="muttng_dotlock"
-else
- MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS dotlock.o"
-fi
-
-AC_SUBST(DOTLOCK_TARGET)
-
-
AC_MSG_CHECKING(where to put the documentation)
AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
[mutt_cv_docdir=$withval],
AC_MSG_CHECKING(where to put the documentation)
AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
[mutt_cv_docdir=$withval],
* please see the file GPL in the top level source directory.
*/
* please see the file GPL in the top level source directory.
*/
-/*
- * This module either be compiled into Mutt, or it can be
- * built as a separate program. For building it
- * separately, define the DL_STANDALONE preprocessor
- * macro.
- */
-
#if HAVE_CONFIG_H
# include "config.h"
#endif
#if HAVE_CONFIG_H
# include "config.h"
#endif
#define MAXLINKS 1024 /* maximum link depth */
#define MAXLINKS 1024 /* maximum link depth */
# define LONG_STRING 1024
# define MAXLOCKATTEMPT 5
# define LONG_STRING 1024
# define MAXLOCKATTEMPT 5
extern int snprintf (char *, size_t, const char *, ...);
# endif
extern int snprintf (char *, size_t, const char *, ...);
# endif
-#else /* DL_STANDALONE */
-
-# ifdef USE_SETGID
-# error Do not try to compile dotlock as a mutt module when requiring egid switching!
-# endif
-
-# include "mutt.h"
-# include "mx.h"
-
-#endif /* DL_STANDALONE */
-
#include <lib-lib/str.h>
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
#include <lib-lib/str.h>
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
#ifdef USE_SETGID
static gid_t UserGid;
#ifdef USE_SETGID
static gid_t UserGid;
static int dotlock_check_stats (struct stat *, struct stat *);
static int dotlock_dispatch (const char *, int fd);
static int dotlock_check_stats (struct stat *, struct stat *);
static int dotlock_dispatch (const char *, int fd);
static int dotlock_init_privs (void);
static void usage (const char *);
static int dotlock_init_privs (void);
static void usage (const char *);
static void dotlock_expand_link (char *, const char *, const char *);
static void BEGIN_PRIVILEGED (void);
static void dotlock_expand_link (char *, const char *, const char *);
static void BEGIN_PRIVILEGED (void);
static int dotlock_lock (const char *);
static int dotlock_lock (const char *);
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
int main (int argc, char **argv)
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
int main (int argc, char **argv)
-#else /* DL_STANDALONE */
-
-/*
- * This function is intended to be invoked from within
- * mutt instead of mx.c's invoke_dotlock ().
- */
-
-int dotlock_invoke (const char *path, int fd, int flags, int retry)
-{
- int currdir;
- int r;
-
- DotlockFlags = flags;
-
- if ((currdir = open (".", O_RDONLY)) == -1)
- return DL_EX_ERROR;
-
- if (!(DotlockFlags & DL_FL_RETRY) || retry)
- Retry = MAXLOCKATTEMPT;
- else
- Retry = 0;
-
- r = dotlock_dispatch (path, fd);
-
- fchdir (currdir);
- close (currdir);
-
- return r;
-}
-
-#endif /* DL_STANDALONE */
-
-
static int dotlock_dispatch (const char *f, int fd)
{
char realpath[_POSIX_PATH_MAX];
static int dotlock_dispatch (const char *f, int fd)
{
char realpath[_POSIX_PATH_MAX];
/*
* Usage information.
*
/*
* Usage information.
*
/*
* Access checking: Let's avoid to lock other users' mail
* spool files if we aren't permitted to read them.
/*
* Access checking: Let's avoid to lock other users' mail
* spool files if we aren't permitted to read them.
#define DL_FL_ACTIONS (DL_FL_TRY|DL_FL_UNLOCK|DL_FL_UNLINK)
#define DL_FL_ACTIONS (DL_FL_TRY|DL_FL_UNLOCK|DL_FL_UNLINK)
int dotlock_invoke (const char *, int, int, int);
int dotlock_invoke (const char *, int, int, int);
WHERE char Quotebuf[SHORT_STRING];
WHERE char Quotebuf[SHORT_STRING];
-#if defined(DL_STANDALONE) && defined(USE_DOTLOCK)
WHERE address_t *EnvFrom;
WHERE address_t *From;
WHERE address_t *EnvFrom;
WHERE address_t *From;
# ifndef USE_DOTLOCK
# define USE_DOTLOCK
# endif
# ifndef USE_DOTLOCK
# define USE_DOTLOCK
# endif
-# ifndef DL_STANDALONE
-# define DL_STANDALONE
-# endif
# ifndef USE_HCACHE
# define USE_HCACHE
# endif
# ifndef USE_HCACHE
# define USE_HCACHE
# endif
** is viewed it is passed as standard input to $$display_filter, and the
** filtered message is read from the standard output.
*/
** is viewed it is passed as standard input to $$display_filter, and the
** filtered message is read from the standard output.
*/
-#if defined(DL_STANDALONE) && defined(USE_DOTLOCK)
+#if defined(USE_DOTLOCK)
{"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, "$muttng_bindir/muttng_dotlock"},
/*
** .pp
{"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, "$muttng_bindir/muttng_dotlock"},
/*
** .pp
- ** Availability: Standalone and Dotlock
+ ** Availability: Dotlock
**
** .pp
** Contains the path of the \fTmuttng_dotlock(1)\fP binary to be used by
**
** .pp
** Contains the path of the \fTmuttng_dotlock(1)\fP binary to be used by
#ifdef USE_DOTLOCK
"dotlock",
#endif
#ifdef USE_DOTLOCK
"dotlock",
#endif
-#ifdef DL_STANDALONE
- "standalone",
-#endif
#ifdef USE_POP
"pop",
#endif
#ifdef USE_POP
"pop",
#endif
#else
"-USE_DOTLOCK "
#endif
#else
"-USE_DOTLOCK "
#endif
-#ifdef DL_STANDALONE
- "+DL_STANDALONE "
-#else
- "-DL_STANDALONE "
-#endif
- "\n "
#ifdef USE_FCNTL
"+USE_FCNTL "
#else
#ifdef USE_FCNTL
"+USE_FCNTL "
#else
* retry - should retry if unable to lock?
*/
* retry - should retry if unable to lock?
*/
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
return mutt_system (cmd);
}
return mutt_system (cmd);
}
-#else
-
-#define invoke_dotlock dotlock_invoke
-
-#endif
-
static int dotlock_file (const char *path, int fd, int retry)
{
int r;
static int dotlock_file (const char *path, int fd, int retry)
{
int r;