39 #include <sys/types.h>
185 octave_argv.
resize (argc - 1);
190 octave_argv[i-1] = *(argv+i);
196 @deftypefn {Built-in Function} {retval =} __version_info__ (@var{name}, @var{version}, @var{release}, @var{date})\n\
197 Undocumented internal function.\n\
204 int nargin = args.
length ();
210 vinfo.
assign (
"Name", args (0));
211 vinfo.
assign (
"Version", args (1));
212 vinfo.
assign (
"Release", args (2));
213 vinfo.
assign (
"Date", args (3));
229 else if (nargin == 0)
245 args(0) =
"GNU Octave";
253 std::cerr <<
"error: " << msg <<
"\n"
254 <<
"error: execution of " << file <<
" failed\n"
255 <<
"error: trying to make my way to a command prompt"
266 const std::string&
context = std::string (),
267 bool verbose =
false,
bool require_file =
true,
268 const std::string& warn_for = std::string ())
274 catch (octave_interrupt_exception)
281 catch (octave_execution_exception)
299 bool require_file =
false;
320 bool home_rc_already_executed =
false;
324 if (initfile.empty ())
325 initfile =
".octaverc";
331 std::string local_rc;
333 if (! home_rc.empty ())
348 home_rc_already_executed =
same_file (home_rc, local_rc);
352 if (! home_rc_already_executed)
354 if (local_rc.empty ())
383 int parse_status = 0;
389 catch (octave_interrupt_exception)
396 catch (octave_execution_exception)
399 std::cerr <<
"error: unhandled execution exception -- eval failed"
435 = (pos != std::string::npos) ? fname.substr (pos+1) : fname;
438 bool verbose =
false;
439 bool require_file =
true;
448 va_start (args, fmt);
459 va_start (args, fmt);
526 octave_cmdline_argc = argc;
527 octave_cmdline_argv = argv;
580 command_line_path.push_back (optarg);
699 error (
"error: only one of --force-gui and --no-gui may be used");
712 setlocale (LC_NUMERIC,
"C");
713 setlocale (LC_TIME,
"C");
715 octave_embedded = embedded;
761 for (std::list<std::string>::const_iterator it = command_line_path.begin ();
762 it != command_line_path.end (); it++)
822 std::cout << std::endl;
828 int last_arg_idx = optind;
830 int remaining_args = octave_cmdline_argc - last_arg_idx;
836 if (! (
persist || remaining_args > 0))
844 if (remaining_args > 0)
849 intern_argv (remaining_args, octave_cmdline_argv+last_arg_idx);
866 intern_argv (octave_cmdline_argc, octave_cmdline_argv);
934 int last_arg_idx = optind;
935 int remaining_args = octave_cmdline_argc - last_arg_idx;
955 @deftypefn {Built-in Function} {} isguirunning ()\n\
956 Return true if Octave is running in GUI mode and false otherwise.\n\
961 if (args.length () == 0)
976 @deftypefn {Built-in Function} {} argv ()\n\
977 Return the command line arguments passed to Octave. For example,\n\
978 if you invoked Octave using the command\n\
981 octave --no-line-editing --silent\n\
985 @code{argv} would return a cell array of strings with the elements\n\
986 @option{--no-line-editing} and @option{--silent}.\n\
988 If you write an executable Octave script, @code{argv} will return the\n\
989 list of arguments passed to the script. @xref{Executable Octave Programs},\n\
990 for an example of how to create an executable Octave script.\n\
995 if (args.length () == 0)
996 retval =
Cell (octave_argv);
1010 @deftypefn {Built-in Function} {} program_invocation_name ()\n\
1011 Return the name that was typed at the shell prompt to run Octave.\n\
1013 If executing a script from the command line (e.g., @code{octave foo.m})\n\
1014 or using an executable Octave script, the program name is set to the\n\
1015 name of the script. @xref{Executable Octave Programs}, for an example of\n\
1016 how to create an executable Octave script.\n\
1017 @seealso{program_name}\n\
1022 if (args.length () == 0)
1037 @deftypefn {Built-in Function} {} program_name ()\n\
1038 Return the last component of the value returned by\n\
1039 @code{program_invocation_name}.\n\
1040 @seealso{program_invocation_name}\n\
1045 if (args.length () == 0)