changeset 16600:e84b77df8940

ensure TERM environment variable is set when GUI starts * octave-gui.cc (octave_start_gui): If TERM environment variable is not set, set it to "xterm".
author John W. Eaton <jwe@octave.org>
date Wed, 01 May 2013 02:24:04 -0400
parents 49832f60282e
children 189241a7c3a9
files libgui/src/octave-gui.cc
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc
+++ b/libgui/src/octave-gui.cc
@@ -49,7 +49,7 @@
 static void
 dissociate_terminal (void)
 {
-#if ! defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN)
+#if ! defined (__WIN32__) || defined (__CYGWIN__)
 # if defined (HAVE_SYS_IOCTL_H) && defined (TIOCNOTTY)
 
   ioctl (0, TIOCNOTTY);
@@ -115,6 +115,17 @@
           // update network-settings
           resource_manager::update_network_settings ();
 
+#if ! defined (__WIN32__) || defined (__CYGWIN__)
+          // If we were started from a launcher, TERM might not be
+          // defined, but we provide a terminal with xterm
+          // capabilities.
+
+          std::string term = octave_env::getenv ("TERM");
+
+          if (term.empty ())
+            octave_env::putenv ("TERM", "xterm");
+#endif
+
           // create main window, read settings, and show window
           main_window w;
           w.read_settings ();  // get widget settings after construction