chiark / gitweb /
Allow default text editor to be set by configure.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 23 Jan 2011 20:20:58 +0000 (20:20 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 23 Jan 2011 20:20:58 +0000 (20:20 +0000)
Normally defaults to vi.
For the Debian package, default to editor.

configure.ac
debian/rules
src/editor.cc

index 1db2dab..c4f9db2 100644 (file)
@@ -27,6 +27,9 @@ AC_PROG_RANLIB
 AC_DEFINE([_GNU_SOURCE], [1], [use GNU extensions if available])
 AC_DEFINE([PATHSEP], ['/'], [define to path separator character])
 AC_DEFINE([PATHSEPSTR], ["/"], [define to path separator as a string])
+AC_ARG_VAR([EDITOR],[default text editor])
+EDITOR="${EDITOR:-vi}"
+AC_DEFINE_UNQUOTED([EDITOR],["${EDITOR}"],[default text editor])
 AC_CHECK_LIB([curl],[curl_easy_init])
 AC_CHECK_LIB([expat],[XML_ParserCreate])
 # Cygwin's iconv.h redirects to non-standard names, breaking the usual
index 6e212c3..d091697 100755 (executable)
@@ -17,7 +17,7 @@
 #
 
 # Options to configure.  This can be overridden by the caller if necessary.
-CONFIGURE=--prefix=/usr --mandir=/usr/share/man
+CONFIGURE=--prefix=/usr --mandir=/usr/share/man EDITOR=editor
 
 # Install commands.  You wouldn't normally override these.
 INSTALL=install
index fbc70e5..10df109 100644 (file)
@@ -33,7 +33,7 @@ int editor(vector<string> &file) {
   if(!editor)
     editor = getenv("EDITOR");
   if(!editor)
-    editor = "vi";              // traditional fallback
+    editor = EDITOR;
   ostringstream cmd;
   cmd << editor << " " << tmpfile.path();
   int rc = system(cmd.str().c_str());