1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
|
23 // Born February 20, 1992. |
|
24 |
240
|
25 #ifdef HAVE_CONFIG_H |
1192
|
26 #include <config.h> |
1
|
27 #endif |
|
28 |
1355
|
29 #include <cassert> |
|
30 #include <cstdlib> |
|
31 #include <cstring> |
|
32 #include <ctime> |
|
33 |
3503
|
34 #include <fstream> |
|
35 #include <iostream> |
|
36 #include <strstream> |
1355
|
37 |
|
38 #ifdef HAVE_UNISTD_H |
2442
|
39 #ifdef HAVE_SYS_TYPES_H |
1
|
40 #include <sys/types.h> |
2442
|
41 #endif |
139
|
42 #include <unistd.h> |
|
43 #endif |
1355
|
44 |
2926
|
45 #include "cmd-edit.h" |
3690
|
46 #include "f77-fcn.h" |
2926
|
47 #include "file-stat.h" |
240
|
48 #include "lo-error.h" |
2926
|
49 #include "oct-env.h" |
3019
|
50 #include "pathsearch.h" |
1907
|
51 #include "str-vec.h" |
223
|
52 |
2492
|
53 #include <defaults.h> |
1355
|
54 #include "defun.h" |
|
55 #include "error.h" |
|
56 #include "file-io.h" |
1
|
57 #include "input.h" |
|
58 #include "lex.h" |
1742
|
59 #include "oct-hist.h" |
3195
|
60 #include "oct-obj.h" |
2375
|
61 #include "ops.h" |
1670
|
62 #include "toplev.h" |
1
|
63 #include "parse.h" |
2982
|
64 #include "pt-plot.h" |
562
|
65 #include "procstream.h" |
1817
|
66 #include "prog-args.h" |
1355
|
67 #include "sighandlers.h" |
|
68 #include "sysdep.h" |
2375
|
69 #include "ov.h" |
1
|
70 #include "unwind-prot.h" |
1355
|
71 #include "utils.h" |
|
72 #include "variables.h" |
2492
|
73 #include <version.h> |
1
|
74 |
3690
|
75 // Kluge. |
3887
|
76 extern "C" void F77_FUNC (xerbla, XERBLA) (const char *, int); |
3690
|
77 |
2910
|
78 extern void install_builtins (void); |
|
79 |
1704
|
80 #if !defined (HAVE_ATEXIT) && defined (HAVE_ON_EXIT) |
|
81 extern "C" int on_exit (); |
|
82 #define atexit on_exit |
|
83 #endif |
|
84 |
1907
|
85 // The command-line options. |
|
86 static string_vector octave_argv; |
1
|
87 |
2239
|
88 // TRUE means we read ~/.octaverc and ./.octaverc. |
|
89 // (--norc; --no-init-file; -f) |
|
90 static bool read_init_files = true; |
|
91 |
|
92 // TRUE means we read the site-wide octaverc files. |
|
93 // (--norc; --no-site-file; -f) |
2240
|
94 static bool read_site_files = true; |
1
|
95 |
3019
|
96 // TRUE means we don't print the usual startup message. |
616
|
97 // (--quiet; --silent; -q) |
2239
|
98 static bool inhibit_startup_message = false; |
1
|
99 |
3019
|
100 // TRUE means we turn on compatibility options. |
1410
|
101 // (--traditional) |
2239
|
102 static bool traditional = false; |
1410
|
103 |
3019
|
104 // If TRUE, print verbose info in some cases. |
1825
|
105 // (--verbose; -V) |
2239
|
106 static bool verbose_flag = false; |
1825
|
107 |
1
|
108 // Usage message |
139
|
109 static const char *usage_string = |
3180
|
110 "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--exec-path path]\n\ |
2239
|
111 [--help] [--info-file file] [--info-program prog] [--interactive]\n\ |
3180
|
112 [--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\ |
|
113 [-p path] [--path path] [--silent] [--traditional] [--verbose]\n\ |
|
114 [--version] [file]"; |
1
|
115 |
1358
|
116 // This is here so that it's more likely that the usage message and |
1410
|
117 // the real set of options will agree. Note: the `+' must come first |
|
118 // to prevent getopt from permuting arguments! |
3180
|
119 static const char *short_opts = "+?HVdfhip:qvx"; |
139
|
120 |
1103
|
121 // Long options. See the comments in getopt.h for the meanings of the |
|
122 // fields in this structure. |
1613
|
123 #define EXEC_PATH_OPTION 1 |
|
124 #define INFO_FILE_OPTION 2 |
|
125 #define INFO_PROG_OPTION 3 |
2240
|
126 #define NO_INIT_FILE_OPTION 4 |
|
127 #define NO_LINE_EDITING_OPTION 5 |
|
128 #define NO_SITE_FILE_OPTION 6 |
|
129 #define TRADITIONAL_OPTION 7 |
1817
|
130 long_options long_opts[] = |
139
|
131 { |
1855
|
132 { "debug", prog_args::no_arg, 0, 'd' }, |
2277
|
133 { "braindead", prog_args::no_arg, 0, TRADITIONAL_OPTION }, |
1855
|
134 { "echo-commands", prog_args::no_arg, 0, 'x' }, |
|
135 { "exec-path", prog_args::required_arg, 0, EXEC_PATH_OPTION }, |
|
136 { "help", prog_args::no_arg, 0, 'h' }, |
|
137 { "info-file", prog_args::required_arg, 0, INFO_FILE_OPTION }, |
|
138 { "info-program", prog_args::required_arg, 0, INFO_PROG_OPTION }, |
|
139 { "interactive", prog_args::no_arg, 0, 'i' }, |
3180
|
140 { "no-history", prog_args::no_arg, 0, 'H' }, |
2239
|
141 { "no-init-file", prog_args::no_arg, 0, NO_INIT_FILE_OPTION }, |
1855
|
142 { "no-line-editing", prog_args::no_arg, 0, NO_LINE_EDITING_OPTION }, |
2239
|
143 { "no-site-file", prog_args::no_arg, 0, NO_SITE_FILE_OPTION }, |
1855
|
144 { "norc", prog_args::no_arg, 0, 'f' }, |
|
145 { "path", prog_args::required_arg, 0, 'p' }, |
|
146 { "quiet", prog_args::no_arg, 0, 'q' }, |
|
147 { "silent", prog_args::no_arg, 0, 'q' }, |
|
148 { "traditional", prog_args::no_arg, 0, TRADITIONAL_OPTION }, |
|
149 { "verbose", prog_args::no_arg, 0, 'V' }, |
|
150 { "version", prog_args::no_arg, 0, 'v' }, |
3019
|
151 { 0, 0, 0, 0 } |
139
|
152 }; |
1
|
153 |
1355
|
154 // Store the command-line options for later use. |
|
155 |
|
156 static void |
|
157 intern_argv (int argc, char **argv) |
|
158 { |
3259
|
159 bind_builtin_variable ("nargin", static_cast<double> (argc-1), |
|
160 true, true, 0); |
3195
|
161 |
|
162 octave_value_list octave_argv; |
|
163 |
1355
|
164 if (argc > 1) |
|
165 { |
2495
|
166 // Skip program name in argv. |
3195
|
167 while (--argc > 0) |
|
168 octave_argv(argc-1) = octave_value (*(argv+argc)); |
1411
|
169 |
1355
|
170 } |
1907
|
171 |
3259
|
172 bind_builtin_constant ("argv", octave_argv, true, true); |
|
173 bind_builtin_constant ("__argv__", octave_argv, true, true); |
1355
|
174 } |
|
175 |
1792
|
176 static void |
|
177 initialize_pathsearch (void) |
|
178 { |
|
179 // This may seem odd, but doing it this way means that we don't have |
|
180 // to modify the kpathsea library... |
|
181 |
3523
|
182 std::string odb = octave_env::getenv ("OCTAVE_DB_PATH"); |
3141
|
183 |
|
184 // For backward compatibility. |
1792
|
185 |
2926
|
186 if (odb.empty ()) |
3141
|
187 odb = octave_env::getenv ("OCTAVE_DB_DIR"); |
1792
|
188 |
3141
|
189 if (odb.empty ()) |
3523
|
190 odb = Vdata_dir + std::string ("/octave:") + Vlibexec_dir + std::string ("/octave"); |
3141
|
191 |
3834
|
192 octave_original_texmfdbs = octave_env::getenv ("TEXMFDBS"); |
|
193 |
3141
|
194 octave_env::putenv ("TEXMFDBS", odb); |
1792
|
195 } |
|
196 |
581
|
197 // Initialize by reading startup files. |
|
198 |
1
|
199 static void |
|
200 execute_startup_files (void) |
|
201 { |
2985
|
202 unwind_protect::begin_frame ("execute_startup_files"); |
315
|
203 |
1651
|
204 // XXX FIXME XXX -- need to make it possible to set this in startup |
|
205 // files. |
1588
|
206 |
3019
|
207 unwind_protect_bool (input_from_startup_file); |
1651
|
208 |
3019
|
209 input_from_startup_file = true; |
315
|
210 |
793
|
211 int verbose = (verbose_flag && ! inhibit_startup_message); |
578
|
212 |
2239
|
213 if (read_site_files) |
1
|
214 { |
2239
|
215 // Execute commands from the site-wide configuration file. |
|
216 // First from the file $(prefix)/lib/octave/site/m/octaverc |
|
217 // (if it exists), then from the file |
3597
|
218 // $(prefix)/share/octave/$(version)/m/octaverc (if it exists). |
1755
|
219 |
2897
|
220 parse_and_execute (Vlocal_site_defaults_file, verbose); |
1755
|
221 |
2897
|
222 parse_and_execute (Vsite_defaults_file, verbose); |
1
|
223 } |
|
224 |
2239
|
225 if (read_init_files) |
|
226 { |
2512
|
227 // Try to execute commands from $HOME/$OCTAVE_INITFILE and |
|
228 // $OCTAVE_INITFILE. If $OCTAVE_INITFILE is not set, .octaverc |
|
229 // is assumed. |
2239
|
230 |
|
231 int home_rc_already_executed = 0; |
2512
|
232 |
3523
|
233 std::string initfile = octave_env::getenv ("OCTAVE_INITFILE"); |
2512
|
234 |
2926
|
235 if (initfile.empty ()) |
2512
|
236 initfile = ".octaverc"; |
|
237 |
3523
|
238 std::string home_dir = octave_env::get_home_directory (); |
2926
|
239 |
3523
|
240 std::string home_rc = home_dir + "/" + initfile; |
|
241 std::string local_rc = std::string ("./") + initfile; |
2239
|
242 |
2926
|
243 if (! home_dir.empty ()) |
2239
|
244 { |
2897
|
245 parse_and_execute (home_rc, verbose); |
2239
|
246 |
|
247 // Names alone are not enough. |
|
248 |
|
249 file_stat fs_home_rc (home_rc); |
|
250 |
|
251 if (fs_home_rc) |
|
252 { |
2512
|
253 file_stat fs_dot_rc (local_rc); |
2239
|
254 |
|
255 if (fs_dot_rc && fs_home_rc.ino () == fs_dot_rc.ino ()) |
|
256 home_rc_already_executed = 1; |
|
257 } |
|
258 } |
|
259 |
|
260 if (! home_rc_already_executed) |
2897
|
261 parse_and_execute (local_rc, verbose); |
2239
|
262 } |
315
|
263 |
2985
|
264 unwind_protect::run_frame ("execute_startup_files"); |
1
|
265 } |
|
266 |
581
|
267 // Usage message with extra help. |
|
268 |
1
|
269 static void |
|
270 verbose_usage (void) |
|
271 { |
3922
|
272 std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY "\n\ |
1613
|
273 \n\ |
|
274 Usage: octave [options]\n\ |
|
275 \n\ |
|
276 Options:\n\ |
1119
|
277 \n\ |
3180
|
278 --debug, -d Enter parser debugging mode.\n\ |
|
279 --echo-commands, -x Echo commands as they are executed.\n\ |
1613
|
280 --exec-path PATH Set path for executing subprograms.\n\ |
3180
|
281 --help, -h, -? Print short help message and exit.\n\ |
1613
|
282 --info-file FILE Use top-level info file FILE.\n\ |
|
283 --info-program PROGRAM Use PROGRAM for reading info files.\n\ |
3180
|
284 --interactive, -i Force interactive behavior.\n\ |
|
285 --no-history, -H Don't save commands to the history list\n\ |
2470
|
286 --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ |
2212
|
287 --no-line-editing Don't use readline for command-line editing.\n\ |
2470
|
288 --no-site-file Don't read the site-wide octaverc file.\n\ |
3238
|
289 --norc, -f Don't read any initialization files.\n\ |
3180
|
290 --path PATH, -p PATH Set initial LOADPATH to PATH.\n\ |
|
291 --silent, -q Don't print message at startup.\n\ |
1613
|
292 --traditional Set compatibility variables.\n\ |
3180
|
293 --verbose, -V Enable verbose output in some cases.\n\ |
|
294 --version, -v Print version number and exit.\n\ |
1119
|
295 \n\ |
1613
|
296 FILE Execute commands from FILE.\n\ |
2375
|
297 \n\ |
|
298 Additional information about Octave is available via the WWW at\n\ |
3917
|
299 http://www.octave.org.\n\ |
2375
|
300 \n\ |
3917
|
301 Please report bugs to the bug-octave@bevo.che.wisc.edu mailing list.\n"; |
285
|
302 |
613
|
303 exit (0); |
1
|
304 } |
|
305 |
581
|
306 // Terse usage messsage. |
|
307 |
1
|
308 static void |
|
309 usage (void) |
|
310 { |
3531
|
311 std::cerr << "usage: " << usage_string << "\n"; |
1
|
312 exit (1); |
|
313 } |
|
314 |
|
315 static void |
|
316 print_version_and_exit (void) |
|
317 { |
3922
|
318 std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS "\n"; |
1
|
319 exit (0); |
|
320 } |
|
321 |
721
|
322 static void |
|
323 initialize_error_handlers () |
|
324 { |
|
325 set_liboctave_error_handler (error); |
3325
|
326 set_liboctave_warning_handler (warning); |
721
|
327 } |
|
328 |
1410
|
329 // What happens on --traditional. |
|
330 |
|
331 static void |
|
332 maximum_braindamage (void) |
|
333 { |
|
334 bind_builtin_variable ("PS1", ">> "); |
|
335 bind_builtin_variable ("PS2", ""); |
2402
|
336 bind_builtin_variable ("beep_on_error", 1.0); |
3189
|
337 bind_builtin_variable ("crash_dumps_octave_core", 0.0); |
2993
|
338 bind_builtin_variable ("default_eval_print_flag", 0.0); |
3156
|
339 bind_builtin_variable ("default_global_variable_value", Matrix ()); |
1410
|
340 bind_builtin_variable ("default_save_format", "mat-binary"); |
2402
|
341 bind_builtin_variable ("define_all_return_values", 1.0); |
|
342 bind_builtin_variable ("do_fortran_indexing", 1.0); |
|
343 bind_builtin_variable ("empty_list_elements_ok", 1.0); |
3105
|
344 bind_builtin_variable ("fixed_point_format", 1.0); |
3110
|
345 bind_builtin_variable ("implicit_num_to_str_ok", 1.0); |
2402
|
346 bind_builtin_variable ("implicit_str_to_num_ok", 1.0); |
3156
|
347 bind_builtin_variable ("initialize_global_variables", 1.0); |
2402
|
348 bind_builtin_variable ("ok_to_lose_imaginary_part", 1.0); |
|
349 bind_builtin_variable ("page_screen_output", 0.0); |
|
350 bind_builtin_variable ("prefer_column_vectors", 0.0); |
|
351 bind_builtin_variable ("print_empty_dimensions", 0.0); |
|
352 bind_builtin_variable ("treat_neg_dim_as_zero", 1.0); |
|
353 bind_builtin_variable ("warn_function_name_clash", 0.0); |
1410
|
354 bind_builtin_variable ("whitespace_in_literal_matrix", "traditional"); |
|
355 } |
|
356 |
581
|
357 // You guessed it. |
|
358 |
1
|
359 int |
|
360 main (int argc, char **argv) |
|
361 { |
3019
|
362 octave_env::set_program_name (argv[0]); |
|
363 |
3024
|
364 dir_path::set_program_name (argv[0]); |
|
365 |
2205
|
366 // The order of these calls is important. The call to |
2926
|
367 // install_defaults must come before install_builtins because |
3019
|
368 // default variable values must be available for the variables to be |
2205
|
369 // installed, and the call to install_builtins must come before the |
|
370 // options are processed because some command line options override |
|
371 // defaults by calling bind_builtin_variable. |
721
|
372 |
1
|
373 sysdep_init (); |
|
374 |
721
|
375 initialize_error_handlers (); |
223
|
376 |
2926
|
377 install_defaults (); |
1
|
378 |
1792
|
379 initialize_pathsearch (); |
1744
|
380 |
2205
|
381 install_signal_handlers (); |
|
382 |
|
383 initialize_file_io (); |
|
384 |
2375
|
385 initialize_symbol_tables (); |
|
386 |
|
387 install_types (); |
|
388 |
|
389 install_ops (); |
2205
|
390 |
|
391 install_builtins (); |
|
392 |
1817
|
393 prog_args args (argc, argv, short_opts, long_opts); |
|
394 |
139
|
395 int optc; |
1817
|
396 while ((optc = args.getopt ()) != EOF) |
1
|
397 { |
139
|
398 switch (optc) |
1
|
399 { |
3180
|
400 case 'H': |
|
401 bind_builtin_variable ("saving_history", 0.0); |
|
402 break; |
|
403 |
793
|
404 case 'V': |
2239
|
405 verbose_flag = true; |
793
|
406 break; |
|
407 |
1
|
408 case 'd': |
|
409 yydebug++; |
|
410 break; |
777
|
411 |
1
|
412 case 'f': |
2239
|
413 read_init_files = false; |
|
414 read_site_files = false; |
1
|
415 break; |
777
|
416 |
1
|
417 case 'h': |
|
418 case '?': |
|
419 verbose_usage (); |
|
420 break; |
777
|
421 |
1
|
422 case 'i': |
3019
|
423 forced_interactive = true; |
1
|
424 break; |
777
|
425 |
1
|
426 case 'p': |
1817
|
427 if (args.optarg ()) |
2205
|
428 bind_builtin_variable ("LOADPATH", args.optarg ()); |
1
|
429 break; |
777
|
430 |
1
|
431 case 'q': |
2239
|
432 inhibit_startup_message = true; |
1
|
433 break; |
777
|
434 |
1
|
435 case 'x': |
2205
|
436 { |
|
437 double tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE); |
|
438 bind_builtin_variable ("echo_executing_commands", tmp); |
|
439 } |
1
|
440 break; |
777
|
441 |
1
|
442 case 'v': |
|
443 print_version_and_exit (); |
|
444 break; |
777
|
445 |
1613
|
446 case EXEC_PATH_OPTION: |
1817
|
447 if (args.optarg ()) |
2205
|
448 bind_builtin_variable ("EXEC_PATH", args.optarg ()); |
1613
|
449 break; |
|
450 |
186
|
451 case INFO_FILE_OPTION: |
1817
|
452 if (args.optarg ()) |
2205
|
453 bind_builtin_variable ("INFO_FILE", args.optarg ()); |
186
|
454 break; |
777
|
455 |
1613
|
456 case INFO_PROG_OPTION: |
1817
|
457 if (args.optarg ()) |
2205
|
458 bind_builtin_variable ("INFO_PROGRAM", args.optarg ()); |
1613
|
459 break; |
|
460 |
2239
|
461 case NO_INIT_FILE_OPTION: |
|
462 read_init_files = false; |
|
463 break; |
|
464 |
1821
|
465 case NO_LINE_EDITING_OPTION: |
3019
|
466 line_editing = false; |
2239
|
467 break; |
|
468 |
|
469 case NO_SITE_FILE_OPTION: |
|
470 read_site_files = 0; |
1821
|
471 break; |
|
472 |
1410
|
473 case TRADITIONAL_OPTION: |
2239
|
474 traditional = true; |
1410
|
475 break; |
|
476 |
1
|
477 default: |
|
478 usage (); |
|
479 break; |
|
480 } |
|
481 } |
|
482 |
1651
|
483 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) |
2077
|
484 // Make sure we clean up when we exit. Also allow users to register |
|
485 // functions. If we don't have atexit or on_exit, we're going to |
|
486 // leave some junk files around if we exit abnormally. |
|
487 |
|
488 atexit (do_octave_atexit); |
318
|
489 #endif |
1
|
490 |
1358
|
491 // These can come after command line args since none of them set any |
|
492 // defaults that might be changed by command line options. |
581
|
493 |
2926
|
494 initialize_command_input (); |
315
|
495 |
578
|
496 if (! inhibit_startup_message) |
3538
|
497 std::cout << OCTAVE_STARTUP_MESSAGE "\n" << std::endl; |
578
|
498 |
1410
|
499 if (traditional) |
|
500 maximum_braindamage (); |
|
501 |
2239
|
502 execute_startup_files (); |
1651
|
503 |
2926
|
504 command_history::read (false); |
1
|
505 |
578
|
506 if (! inhibit_startup_message && reading_startup_message_printed) |
3538
|
507 std::cout << std::endl; |
578
|
508 |
1358
|
509 // Avoid counting commands executed from startup files. |
|
510 |
2926
|
511 command_editor::reset_current_command_number (1); |
1
|
512 |
1358
|
513 // If there is an extra argument, see if it names a file to read. |
|
514 // Additional arguments are taken as command line options for the |
|
515 // script. |
1
|
516 |
1817
|
517 int last_arg_idx = args.optind (); |
3019
|
518 |
1817
|
519 int remaining_args = argc - last_arg_idx; |
3019
|
520 |
1355
|
521 if (remaining_args > 0) |
149
|
522 { |
3019
|
523 reading_script_file = true; |
|
524 |
1817
|
525 curr_fcn_file_name = argv[last_arg_idx]; |
1608
|
526 curr_fcn_file_full_name = curr_fcn_file_name; |
1411
|
527 |
984
|
528 FILE *infile = get_input_from_file (curr_fcn_file_name); |
1411
|
529 |
529
|
530 if (infile) |
287
|
531 { |
3019
|
532 input_from_command_line_file = true; |
1516
|
533 |
1411
|
534 bind_builtin_variable ("program_invocation_name", |
|
535 curr_fcn_file_name); |
|
536 |
1755
|
537 size_t pos = curr_fcn_file_name.rfind ('/'); |
|
538 |
3523
|
539 std::string tmp = (pos != NPOS) |
1755
|
540 ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name; |
1411
|
541 |
|
542 bind_builtin_variable ("program_name", tmp); |
|
543 |
1817
|
544 intern_argv (remaining_args, argv+last_arg_idx); |
1411
|
545 |
2926
|
546 command_editor::blink_matching_paren (false); |
|
547 |
287
|
548 switch_to_buffer (create_buffer (infile)); |
|
549 } |
529
|
550 else |
|
551 clean_up_and_exit (1); |
1
|
552 } |
|
553 else |
|
554 { |
1355
|
555 // Is input coming from a terminal? If so, we are probably |
|
556 // interactive. |
1
|
557 |
|
558 interactive = (isatty (fileno (stdin)) && isatty (fileno (stdout))); |
1355
|
559 |
|
560 intern_argv (argc, argv); |
|
561 |
|
562 switch_to_buffer (create_buffer (get_input_from_stdin ())); |
1
|
563 } |
|
564 |
1358
|
565 // Force input to be echoed if not really interactive, but the user |
|
566 // has forced interactive behavior. |
1
|
567 |
1907
|
568 if (! interactive && forced_interactive) |
287
|
569 { |
2926
|
570 command_editor::blink_matching_paren (false); |
1588
|
571 |
|
572 // XXX FIXME XXX -- is this the right thing to do? |
|
573 |
|
574 bind_builtin_variable ("echo_executing_commands", |
2800
|
575 static_cast<double> (ECHO_CMD_LINE)); |
287
|
576 } |
1
|
577 |
1410
|
578 if (! interactive) |
3019
|
579 line_editing = false; |
1
|
580 |
1907
|
581 int retval = main_loop (); |
1
|
582 |
1005
|
583 if (retval == 1 && ! error_state) |
|
584 retval = 0; |
|
585 |
1
|
586 clean_up_and_exit (retval); |
|
587 } |
|
588 |
560
|
589 /* |
1
|
590 ;;; Local Variables: *** |
|
591 ;;; mode: C++ *** |
|
592 ;;; End: *** |
|
593 */ |