Index: error.cc =================================================================== RCS file: /cvs/octave/src/error.cc,v retrieving revision 1.121 diff -c -r1.121 error.cc *** error.cc 30 May 2007 06:35:52 -0000 1.121 --- error.cc 1 Oct 2007 20:08:20 -0000 *************** *** 70,75 **** --- 70,78 ---- //updated static bool Vquiet_warning = false; + // TRUE means that Octave will use terminal colors to print error messages + static bool Vcolor_error = true; + // A structure containing (most of) the current state of warnings. static Octave_map warning_options; *************** *** 207,217 **** --- 210,226 ---- if (to_beep_or_not_to_beep_p) output_buf << "\a"; + if (Vterminal_color) + output_buf << "\033[31m"; + if (name) output_buf << name << ": "; octave_vformat (output_buf, fmt, args); + if (Vterminal_color) + output_buf << "\033[0m"; + output_buf << std::endl; // FIXME -- we really want to capture the message before it Index: input.cc =================================================================== RCS file: /cvs/octave/src/input.cc,v retrieving revision 1.182 diff -c -r1.182 input.cc *** input.cc 18 Sep 2007 18:58:13 -0000 1.182 --- input.cc 1 Oct 2007 20:08:22 -0000 *************** *** 144,149 **** --- 144,152 ---- // the next user prompt. static bool Vdrawnow_requested = false; + // TRUE means octave should use terminal colors + bool Vterminal_color = false; + static void do_input_echo (const std::string& input_string) { *************** *** 183,190 **** if (line_editing || force_readline) { bool eof; ! retval = command_editor::readline (s, eof); if (! eof && retval.empty ()) retval = "\n"; --- 186,197 ---- if (line_editing || force_readline) { bool eof; + std::string prompt = s; + + if (Vterminal_color) + prompt = "\033[34m" + prompt + "\033[0m"; ! retval = command_editor::readline (prompt, eof); if (! eof && retval.empty ()) retval = "\n"; Index: input.h =================================================================== RCS file: /cvs/octave/src/input.h,v retrieving revision 1.43 diff -c -r1.43 input.h *** input.h 6 Dec 2006 20:23:19 -0000 1.43 --- input.h 1 Oct 2007 20:08:22 -0000 *************** *** 106,111 **** --- 106,113 ---- extern octave_time Vlast_prompt_time; + extern bool Vterminal_color; + #endif /* Index: octave.cc =================================================================== RCS file: /cvs/octave/src/octave.cc,v retrieving revision 1.236 diff -c -r1.236 octave.cc *** octave.cc 1 Oct 2007 15:59:33 -0000 1.236 --- octave.cc 1 Oct 2007 20:08:23 -0000 *************** *** 124,130 **** // Usage message static const char *usage_string = ! "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\ [--exec-path path] [--help] [--image-path path] [--info-file file]\n\ [--info-program prog] [--interactive] [--line-editing] [--no-history] [--no-init-file]\n\ [--no-line-editing] [--no-site-file] [--no-init-path] [-p path]\n\ --- 124,130 ---- // Usage message static const char *usage_string = ! "octave [-?HVdfhiqvx] [--color] [--debug] [--echo-commands] [--eval CODE]\n\ [--exec-path path] [--help] [--image-path path] [--info-file file]\n\ [--info-program prog] [--interactive] [--line-editing] [--no-history] [--no-init-file]\n\ [--no-line-editing] [--no-site-file] [--no-init-path] [-p path]\n\ *************** *** 155,162 **** --- 155,164 ---- #define PERSIST_OPTION 10 #define TRADITIONAL_OPTION 11 #define LINE_EDITING_OPTION 12 + #define TERMINAL_COLOR_OPTION 13 long_options long_opts[] = { + { "color", prog_args::no_arg, 0, TERMINAL_COLOR_OPTION }, { "debug", prog_args::no_arg, 0, 'd' }, { "braindead", prog_args::no_arg, 0, TRADITIONAL_OPTION }, { "echo-commands", prog_args::no_arg, 0, 'x' }, *************** *** 441,446 **** --- 443,449 ---- \n\ Options:\n\ \n\ + --color Use terminal colors.\n\ --debug, -d Enter parser debugging mode.\n\ --echo-commands, -x Echo commands as they are executed.\n\ --eval CODE Evaluate CODE. Exit when done unless --persist.\n\ *************** *** 686,691 **** --- 689,698 ---- persist = true; break; + case TERMINAL_COLOR_OPTION: + Vterminal_color = true; + break; + default: usage (); break;