always build the dotlock program standalone, many other appplications use
authorPierre Habouzit <madcoder@debian.org>
Sat, 4 Nov 2006 14:37:53 +0000 (15:37 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sat, 4 Nov 2006 14:37:53 +0000 (15:37 +0100)
it, so …

one more step toward mutt build system simplification.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Makefile.am
configure.ac
dotlock.c
dotlock.h
globals.h
init.h
main.c
mx.c

index 65d7140..9c3ba5d 100644 (file)
@@ -25,7 +25,7 @@ bin_SCRIPTS = muttngbug fleang
 
 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 \
index 5b381ac..b61d428 100644 (file)
@@ -438,21 +438,6 @@ int main (int argc, char **argv)
         fi
 fi
 
-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],
index 8fdc117..19e2ad6 100644 (file)
--- a/dotlock.c
+++ b/dotlock.c
@@ -8,13 +8,6 @@
  * 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
@@ -46,8 +39,6 @@
 
 #define MAXLINKS 1024           /* maximum link depth */
 
-#ifdef DL_STANDALONE
-
 # define LONG_STRING 1024
 # define MAXLOCKATTEMPT 5
 
 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;
 
-#ifdef DL_STANDALONE
 static char *Hostname;
-#endif
 
 #ifdef USE_SETGID
 static gid_t UserGid;
@@ -98,10 +76,8 @@ static int dotlock_prepare (char *, size_t, const char *, int fd);
 static int dotlock_check_stats (struct stat *, struct stat *);
 static int dotlock_dispatch (const char *, int fd);
 
-#ifdef DL_STANDALONE
 static int dotlock_init_privs (void);
 static void usage (const char *);
-#endif
 
 static void dotlock_expand_link (char *, const char *, const char *);
 static void BEGIN_PRIVILEGED (void);
@@ -118,8 +94,6 @@ static int dotlock_unlink (const char *);
 static int dotlock_lock (const char *);
 
 
-#ifdef DL_STANDALONE
-
 #define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
 
 int main (int argc, char **argv)
@@ -215,39 +189,6 @@ static int dotlock_init_privs (void)
 }
 
 
-#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];
@@ -323,8 +264,6 @@ static void END_PRIVILEGED (void)
 #endif
 }
 
-#ifdef DL_STANDALONE
-
 /*
  * Usage information.
  * 
@@ -349,8 +288,6 @@ static void usage (const char *av0)
   exit (DL_EX_ERROR);
 }
 
-#endif
-
 /*
  * Access checking: Let's avoid to lock other users' mail
  * spool files if we aren't permitted to read them.
index 385f500..16ecce3 100644 (file)
--- a/dotlock.h
+++ b/dotlock.h
@@ -30,8 +30,6 @@
 
 #define DL_FL_ACTIONS (DL_FL_TRY|DL_FL_UNLOCK|DL_FL_UNLINK)
 
-#ifndef DL_STANDALONE
 int dotlock_invoke (const char *, int, int, int);
-#endif
 
 #endif
index 7a624d9..a627708 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -25,9 +25,7 @@ WHERE char AttachmentMarker[STRING];
 
 WHERE char Quotebuf[SHORT_STRING];
 
-#if defined(DL_STANDALONE) && defined(USE_DOTLOCK)
 WHERE char *MuttDotlock;
-#endif
 
 WHERE address_t *EnvFrom;
 WHERE address_t *From;
diff --git a/init.h b/init.h
index 1d93b5a..e510b4e 100644 (file)
--- a/init.h
+++ b/init.h
@@ -108,9 +108,6 @@ struct option_t {
 # ifndef USE_DOTLOCK
 #  define USE_DOTLOCK
 # endif
-# ifndef DL_STANDALONE
-#  define DL_STANDALONE
-# endif
 # ifndef USE_HCACHE
 #  define USE_HCACHE
 # endif
@@ -597,11 +594,11 @@ struct option_t MuttVars[] = {
    ** 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
-   ** Availability: Standalone and Dotlock
+   ** Availability: Dotlock
    **
    ** .pp
    ** Contains the path of the \fTmuttng_dotlock(1)\fP binary to be used by
@@ -3873,9 +3870,6 @@ static const char* Features[] = {
 #ifdef USE_DOTLOCK
   "dotlock",
 #endif
-#ifdef DL_STANDALONE
-  "standalone",
-#endif
 #ifdef USE_POP
   "pop",
 #endif
diff --git a/main.c b/main.c
index a2fad56..13749ce 100644 (file)
--- a/main.c
+++ b/main.c
@@ -284,12 +284,6 @@ static void show_version (void)
 #else
          "-USE_DOTLOCK  "
 #endif
-#ifdef DL_STANDALONE
-         "+DL_STANDALONE  "
-#else
-         "-DL_STANDALONE  "
-#endif
-         "\n  "
 #ifdef USE_FCNTL
          "+USE_FCNTL  "
 #else
diff --git a/mx.c b/mx.c
index 6f6f779..b596bca 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -83,8 +83,6 @@ static list2_t* MailboxFormats = NULL;
  * 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];
@@ -109,12 +107,6 @@ static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
   return mutt_system (cmd);
 }
 
-#else
-
-#define invoke_dotlock dotlock_invoke
-
-#endif
-
 static int dotlock_file (const char *path, int fd, int retry)
 {
   int r;