Using "/usr/ucb/vi" as defaut fallback EDITOR is not going to work on
most of distributions where this package is installed. That said it
might work somewhere, so searching the vi editor at configure time is the
sensible thing to do, if user does not want to define the default.
Signed-off-by: Sami Kerola <kerolasa(a)iki.fi>
---
configure.ac | 9 +++++++++
src/pathnames.h | 9 ---------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6cbca34..2a33485 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,15 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
dnl Checking for programs
+AC_ARG_WITH([editor],
+ [AC_HELP_STRING([--with-editor=EDITOR], [path to default editor])],
+ [editor_defined="$with_editor"],
+ [editor_defined="no"])
+AS_IF([test "x$editor_defined" = "xno"], [
+ AC_PATH_PROG([editor_defined], [vi], [/usr/bin/vi])
+])
+AC_DEFINE_UNQUOTED([EDITOR], ["$editor_defined"], [default editor])
+
AC_MSG_CHECKING(username to run under)
AC_ARG_WITH(daemon_username,
[AS_HELP_STRING([--with-daemon_username=DAEMON_USERNAME], [Username to run under (default
daemon) ])],
diff --git a/src/pathnames.h b/src/pathnames.h
index b5d5c70..1d716be 100644
--- a/src/pathnames.h
+++ b/src/pathnames.h
@@ -45,15 +45,6 @@
#define _PATH_CRON_PID PIDDIR PIDFILE
#define REBOOT_LOCK PIDDIR "cron.reboot"
- /* what editor to use if no EDITOR or VISUAL
- * environment variable specified.
- */
-#if defined(_PATH_VI)
-# define EDITOR _PATH_VI
-#else
-# define EDITOR "/usr/ucb/vi"
-#endif
-
#ifndef _PATH_BSHELL
# define _PATH_BSHELL "/bin/sh"
#endif
--
1.8.0