changeset 2445:e167f557c591

* added code for checking VISUAL and EDITOR before falling back to emacs
author rotor <rotor>
date Tue, 05 Feb 2008 13:48:45 +0000
parents e921f805ee3c
children 95e7da575e96
files progs/mincedit/mincedit
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/progs/mincedit/mincedit
+++ b/progs/mincedit/mincedit
@@ -6,7 +6,10 @@
 #
 # Modifications: 
 #   $Log: mincedit,v $
-#   Revision 6.7  2008-01-16 00:45:34  rotor
+#   Revision 6.8  2008-02-05 13:48:45  rotor
+#    * added code for checking VISUAL and EDITOR before falling back to emacs
+#
+#   Revision 6.7  2008/01/16 00:45:34  rotor
 #    * replaced mincdump -h with mincheader to preserver image ranges
 #
 #   Revision 6.6  2008/01/09 14:42:24  rotor
@@ -68,7 +71,6 @@
 # software for any purpose.  It is provided "as is" without
 # express or implied warranty.
 
-set -o nounset
 
 # simple little function to emulate perl's die();
 die () {
@@ -89,9 +91,6 @@
    exit 1
    }
 
-# Set default editor
-editor="emacs"
-
 # check arguments
 case $# in
    1)
@@ -101,9 +100,17 @@
          exit 0
       fi
       
-      if [ $?EDITOR ]
+      # if no editor is specified, find a suitable one
+      if [ -n "$VISUAL" ]
       then
-         editor=${EDITOR}
+         editor=${VISUAL}
+      else
+         if [ -n "$EDITOR" ]
+         then
+            editor=${EDITOR}
+         else
+            editor="emacs"
+         fi
       fi
       ;;