changeset 24344:cac0f8a1c696

Stop segfault when starting Octave with conflicting options (bug #52567). * octave.cc: Replace warning() function calls with direct print of message to std::cerr.
author Rik <rik@octave.org>
date Fri, 01 Dec 2017 11:24:33 -0800
parents 1b17a5d82e3f
children 0fa322bf312d
files libinterp/octave.cc
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave.cc	Fri Dec 01 11:08:26 2017 -0800
+++ b/libinterp/octave.cc	Fri Dec 01 11:24:33 2017 -0800
@@ -232,7 +232,7 @@
     // Check for various incompatible argument pairs
     if (m_force_gui && m_no_gui)
       {
-        warning ("only one of --force-gui and --no-gui may be used");
+        std::cerr << "error: only one of --force-gui and --no-gui may be used\n";
 
         octave_print_terse_usage_and_exit ();
       }
@@ -364,7 +364,7 @@
 
     if (m_have_eval_option_code && m_have_script_file)
       {
-        warning (R"(--eval "CODE" and script file are mutually exclusive options)");
+        std::cerr << R"(error: --eval "CODE" and script file are mutually exclusive options)" << std::endl;
 
         octave_print_terse_usage_and_exit ();
       }
@@ -397,14 +397,15 @@
   if (embedded)
     {
       if (argc > 0)
-        warning ("ignoring command line options for embedded octave");
+        std::cerr << "warning: ignoring command line options for embedded octave\n";
 
       static octave::interpreter embedded_interpreter;
       return embedded_interpreter.execute ();
     }
   else
     {
-      warning ("octave_main should only be used to create an embedded interpreter");
+      std::cerr << "warning: octave_main should only be used to create an embedded interpreter";
+
       static octave::cli_application app (argc, argv);
       return app.execute ();
     }