]> xenbits.xensource.com Git - libvirt.git/commitdiff
Make editor used for 'virsh edit' configurable
authorGuido Günther <agx@sigxcpu.org>
Sun, 28 Sep 2014 08:34:03 +0000 (10:34 +0200)
committerGuido Günther <agx@sigxcpu.org>
Wed, 1 Oct 2014 18:17:48 +0000 (20:17 +0200)
Debian wants to use 'sensible-editor' instead of vi other distros might
want to use other defaults. This avoids distro specific patches.

configure.ac
tools/virsh.c

index c5acb062a0fafbfec2cb066e4cffedcaa8c3c596..ec9d028e8f25c516d509eb71fb3cfc0055d2cae0 100644 (file)
@@ -2773,6 +2773,14 @@ test "x$lv_cv_static_analysis" = xyes && t=1
 AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
   [Define to 1 when performing static analysis.])
 
+AC_ARG_WITH([default-editor],
+  [AS_HELP_STRING([--with-default-editor],
+    [Editor to use for interactive commands
+     @<:@default=vi@:>@])],
+  [DEFAULT_EDITOR=${withval}],
+  [DEFAULT_EDITOR=vi])
+AC_DEFINE_UNQUOTED([DEFAULT_EDITOR], ["$DEFAULT_EDITOR"], [Default editor to use])
+
 # Some GNULIB base64 symbols clash with a kerberos library
 AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
 AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
@@ -2973,6 +2981,7 @@ AC_MSG_NOTICE([            numad: $with_numad])
 AC_MSG_NOTICE([      XML Catalog: $XML_CATALOG_FILE])
 AC_MSG_NOTICE([      Init script: $with_init_script])
 AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files])
+AC_MSG_NOTICE([   Default Editor: $DEFAULT_EDITOR])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Developer Tools])
 AC_MSG_NOTICE([])
index 64195a40db47a4ed6f25fd66f473ceb14b1862e2..589f3b4cd19abf7dbfab560d423b279bb442cd57 100644 (file)
@@ -785,7 +785,7 @@ vshEditFile(vshControl *ctl, const char *filename)
     if (!editor)
         editor = virGetEnvBlockSUID("EDITOR");
     if (!editor)
-        editor = "vi"; /* could be cruel & default to ed(1) here */
+        editor = DEFAULT_EDITOR;
 
     /* Check that filename doesn't contain shell meta-characters, and
      * if it does, refuse to run.  Follow the Unix conventions for