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> |
1355
|
36 |
|
37 #ifdef HAVE_UNISTD_H |
2442
|
38 #ifdef HAVE_SYS_TYPES_H |
1
|
39 #include <sys/types.h> |
2442
|
40 #endif |
139
|
41 #include <unistd.h> |
|
42 #endif |
1355
|
43 |
2926
|
44 #include "cmd-edit.h" |
3690
|
45 #include "f77-fcn.h" |
2926
|
46 #include "file-stat.h" |
240
|
47 #include "lo-error.h" |
2926
|
48 #include "oct-env.h" |
3019
|
49 #include "pathsearch.h" |
1907
|
50 #include "str-vec.h" |
223
|
51 |
2492
|
52 #include <defaults.h> |
3933
|
53 #include "Cell.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 |
3933
|
162 Cell octave_argv; |
3195
|
163 |
1355
|
164 if (argc > 1) |
|
165 { |
3933
|
166 Array<octave_value> tmp (argc-1); |
|
167 |
2495
|
168 // Skip program name in argv. |
3933
|
169 int i = argc; |
|
170 while (--i > 0) |
|
171 tmp(i-1) = octave_value (*(argv+i)); |
1411
|
172 |
3933
|
173 octave_argv = Cell (tmp, argc-1, 1); |
1355
|
174 } |
1907
|
175 |
3259
|
176 bind_builtin_constant ("argv", octave_argv, true, true); |
1355
|
177 } |
|
178 |
1792
|
179 static void |
|
180 initialize_pathsearch (void) |
|
181 { |
|
182 // This may seem odd, but doing it this way means that we don't have |
|
183 // to modify the kpathsea library... |
|
184 |
3523
|
185 std::string odb = octave_env::getenv ("OCTAVE_DB_PATH"); |
3141
|
186 |
|
187 // For backward compatibility. |
1792
|
188 |
2926
|
189 if (odb.empty ()) |
3141
|
190 odb = octave_env::getenv ("OCTAVE_DB_DIR"); |
1792
|
191 |
3141
|
192 if (odb.empty ()) |
3523
|
193 odb = Vdata_dir + std::string ("/octave:") + Vlibexec_dir + std::string ("/octave"); |
3141
|
194 |
3834
|
195 octave_original_texmfdbs = octave_env::getenv ("TEXMFDBS"); |
|
196 |
3141
|
197 octave_env::putenv ("TEXMFDBS", odb); |
1792
|
198 } |
|
199 |
581
|
200 // Initialize by reading startup files. |
|
201 |
1
|
202 static void |
|
203 execute_startup_files (void) |
|
204 { |
2985
|
205 unwind_protect::begin_frame ("execute_startup_files"); |
315
|
206 |
1651
|
207 // XXX FIXME XXX -- need to make it possible to set this in startup |
|
208 // files. |
1588
|
209 |
3019
|
210 unwind_protect_bool (input_from_startup_file); |
1651
|
211 |
3019
|
212 input_from_startup_file = true; |
315
|
213 |
793
|
214 int verbose = (verbose_flag && ! inhibit_startup_message); |
578
|
215 |
2239
|
216 if (read_site_files) |
1
|
217 { |
2239
|
218 // Execute commands from the site-wide configuration file. |
|
219 // First from the file $(prefix)/lib/octave/site/m/octaverc |
|
220 // (if it exists), then from the file |
3597
|
221 // $(prefix)/share/octave/$(version)/m/octaverc (if it exists). |
1755
|
222 |
2897
|
223 parse_and_execute (Vlocal_site_defaults_file, verbose); |
1755
|
224 |
2897
|
225 parse_and_execute (Vsite_defaults_file, verbose); |
1
|
226 } |
|
227 |
2239
|
228 if (read_init_files) |
|
229 { |
2512
|
230 // Try to execute commands from $HOME/$OCTAVE_INITFILE and |
|
231 // $OCTAVE_INITFILE. If $OCTAVE_INITFILE is not set, .octaverc |
|
232 // is assumed. |
2239
|
233 |
|
234 int home_rc_already_executed = 0; |
2512
|
235 |
3523
|
236 std::string initfile = octave_env::getenv ("OCTAVE_INITFILE"); |
2512
|
237 |
2926
|
238 if (initfile.empty ()) |
2512
|
239 initfile = ".octaverc"; |
|
240 |
3523
|
241 std::string home_dir = octave_env::get_home_directory (); |
2926
|
242 |
3523
|
243 std::string home_rc = home_dir + "/" + initfile; |
|
244 std::string local_rc = std::string ("./") + initfile; |
2239
|
245 |
2926
|
246 if (! home_dir.empty ()) |
2239
|
247 { |
2897
|
248 parse_and_execute (home_rc, verbose); |
2239
|
249 |
|
250 // Names alone are not enough. |
|
251 |
|
252 file_stat fs_home_rc (home_rc); |
|
253 |
|
254 if (fs_home_rc) |
|
255 { |
2512
|
256 file_stat fs_dot_rc (local_rc); |
2239
|
257 |
|
258 if (fs_dot_rc && fs_home_rc.ino () == fs_dot_rc.ino ()) |
|
259 home_rc_already_executed = 1; |
|
260 } |
|
261 } |
|
262 |
|
263 if (! home_rc_already_executed) |
2897
|
264 parse_and_execute (local_rc, verbose); |
2239
|
265 } |
315
|
266 |
2985
|
267 unwind_protect::run_frame ("execute_startup_files"); |
1
|
268 } |
|
269 |
581
|
270 // Usage message with extra help. |
|
271 |
1
|
272 static void |
|
273 verbose_usage (void) |
|
274 { |
3922
|
275 std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY "\n\ |
1613
|
276 \n\ |
|
277 Usage: octave [options]\n\ |
|
278 \n\ |
|
279 Options:\n\ |
1119
|
280 \n\ |
3180
|
281 --debug, -d Enter parser debugging mode.\n\ |
|
282 --echo-commands, -x Echo commands as they are executed.\n\ |
1613
|
283 --exec-path PATH Set path for executing subprograms.\n\ |
3180
|
284 --help, -h, -? Print short help message and exit.\n\ |
1613
|
285 --info-file FILE Use top-level info file FILE.\n\ |
|
286 --info-program PROGRAM Use PROGRAM for reading info files.\n\ |
3180
|
287 --interactive, -i Force interactive behavior.\n\ |
|
288 --no-history, -H Don't save commands to the history list\n\ |
2470
|
289 --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ |
2212
|
290 --no-line-editing Don't use readline for command-line editing.\n\ |
2470
|
291 --no-site-file Don't read the site-wide octaverc file.\n\ |
3238
|
292 --norc, -f Don't read any initialization files.\n\ |
3180
|
293 --path PATH, -p PATH Set initial LOADPATH to PATH.\n\ |
|
294 --silent, -q Don't print message at startup.\n\ |
1613
|
295 --traditional Set compatibility variables.\n\ |
3180
|
296 --verbose, -V Enable verbose output in some cases.\n\ |
|
297 --version, -v Print version number and exit.\n\ |
1119
|
298 \n\ |
1613
|
299 FILE Execute commands from FILE.\n\ |
2375
|
300 \n\ |
|
301 Additional information about Octave is available via the WWW at\n\ |
3917
|
302 http://www.octave.org.\n\ |
2375
|
303 \n\ |
3917
|
304 Please report bugs to the bug-octave@bevo.che.wisc.edu mailing list.\n"; |
285
|
305 |
613
|
306 exit (0); |
1
|
307 } |
|
308 |
581
|
309 // Terse usage messsage. |
|
310 |
1
|
311 static void |
|
312 usage (void) |
|
313 { |
3531
|
314 std::cerr << "usage: " << usage_string << "\n"; |
1
|
315 exit (1); |
|
316 } |
|
317 |
|
318 static void |
|
319 print_version_and_exit (void) |
|
320 { |
3922
|
321 std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS "\n"; |
1
|
322 exit (0); |
|
323 } |
|
324 |
721
|
325 static void |
|
326 initialize_error_handlers () |
|
327 { |
|
328 set_liboctave_error_handler (error); |
3325
|
329 set_liboctave_warning_handler (warning); |
721
|
330 } |
|
331 |
1410
|
332 // What happens on --traditional. |
|
333 |
|
334 static void |
|
335 maximum_braindamage (void) |
|
336 { |
|
337 bind_builtin_variable ("PS1", ">> "); |
|
338 bind_builtin_variable ("PS2", ""); |
2402
|
339 bind_builtin_variable ("beep_on_error", 1.0); |
3189
|
340 bind_builtin_variable ("crash_dumps_octave_core", 0.0); |
2993
|
341 bind_builtin_variable ("default_eval_print_flag", 0.0); |
3156
|
342 bind_builtin_variable ("default_global_variable_value", Matrix ()); |
1410
|
343 bind_builtin_variable ("default_save_format", "mat-binary"); |
2402
|
344 bind_builtin_variable ("define_all_return_values", 1.0); |
|
345 bind_builtin_variable ("do_fortran_indexing", 1.0); |
3105
|
346 bind_builtin_variable ("fixed_point_format", 1.0); |
3110
|
347 bind_builtin_variable ("implicit_num_to_str_ok", 1.0); |
2402
|
348 bind_builtin_variable ("implicit_str_to_num_ok", 1.0); |
3156
|
349 bind_builtin_variable ("initialize_global_variables", 1.0); |
2402
|
350 bind_builtin_variable ("ok_to_lose_imaginary_part", 1.0); |
|
351 bind_builtin_variable ("page_screen_output", 0.0); |
|
352 bind_builtin_variable ("prefer_column_vectors", 0.0); |
|
353 bind_builtin_variable ("print_empty_dimensions", 0.0); |
|
354 bind_builtin_variable ("treat_neg_dim_as_zero", 1.0); |
|
355 bind_builtin_variable ("warn_function_name_clash", 0.0); |
1410
|
356 bind_builtin_variable ("whitespace_in_literal_matrix", "traditional"); |
|
357 } |
|
358 |
581
|
359 // You guessed it. |
|
360 |
1
|
361 int |
|
362 main (int argc, char **argv) |
|
363 { |
3019
|
364 octave_env::set_program_name (argv[0]); |
|
365 |
3024
|
366 dir_path::set_program_name (argv[0]); |
|
367 |
2205
|
368 // The order of these calls is important. The call to |
2926
|
369 // install_defaults must come before install_builtins because |
3019
|
370 // default variable values must be available for the variables to be |
2205
|
371 // installed, and the call to install_builtins must come before the |
|
372 // options are processed because some command line options override |
|
373 // defaults by calling bind_builtin_variable. |
721
|
374 |
1
|
375 sysdep_init (); |
|
376 |
721
|
377 initialize_error_handlers (); |
223
|
378 |
2926
|
379 install_defaults (); |
1
|
380 |
1792
|
381 initialize_pathsearch (); |
1744
|
382 |
2205
|
383 install_signal_handlers (); |
|
384 |
|
385 initialize_file_io (); |
|
386 |
2375
|
387 initialize_symbol_tables (); |
|
388 |
|
389 install_types (); |
|
390 |
|
391 install_ops (); |
2205
|
392 |
|
393 install_builtins (); |
|
394 |
1817
|
395 prog_args args (argc, argv, short_opts, long_opts); |
|
396 |
139
|
397 int optc; |
1817
|
398 while ((optc = args.getopt ()) != EOF) |
1
|
399 { |
139
|
400 switch (optc) |
1
|
401 { |
3180
|
402 case 'H': |
|
403 bind_builtin_variable ("saving_history", 0.0); |
|
404 break; |
|
405 |
793
|
406 case 'V': |
2239
|
407 verbose_flag = true; |
793
|
408 break; |
|
409 |
1
|
410 case 'd': |
|
411 yydebug++; |
|
412 break; |
777
|
413 |
1
|
414 case 'f': |
2239
|
415 read_init_files = false; |
|
416 read_site_files = false; |
1
|
417 break; |
777
|
418 |
1
|
419 case 'h': |
|
420 case '?': |
|
421 verbose_usage (); |
|
422 break; |
777
|
423 |
1
|
424 case 'i': |
3019
|
425 forced_interactive = true; |
1
|
426 break; |
777
|
427 |
1
|
428 case 'p': |
1817
|
429 if (args.optarg ()) |
2205
|
430 bind_builtin_variable ("LOADPATH", args.optarg ()); |
1
|
431 break; |
777
|
432 |
1
|
433 case 'q': |
2239
|
434 inhibit_startup_message = true; |
1
|
435 break; |
777
|
436 |
1
|
437 case 'x': |
2205
|
438 { |
|
439 double tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE); |
|
440 bind_builtin_variable ("echo_executing_commands", tmp); |
|
441 } |
1
|
442 break; |
777
|
443 |
1
|
444 case 'v': |
|
445 print_version_and_exit (); |
|
446 break; |
777
|
447 |
1613
|
448 case EXEC_PATH_OPTION: |
1817
|
449 if (args.optarg ()) |
2205
|
450 bind_builtin_variable ("EXEC_PATH", args.optarg ()); |
1613
|
451 break; |
|
452 |
186
|
453 case INFO_FILE_OPTION: |
1817
|
454 if (args.optarg ()) |
2205
|
455 bind_builtin_variable ("INFO_FILE", args.optarg ()); |
186
|
456 break; |
777
|
457 |
1613
|
458 case INFO_PROG_OPTION: |
1817
|
459 if (args.optarg ()) |
2205
|
460 bind_builtin_variable ("INFO_PROGRAM", args.optarg ()); |
1613
|
461 break; |
|
462 |
2239
|
463 case NO_INIT_FILE_OPTION: |
|
464 read_init_files = false; |
|
465 break; |
|
466 |
1821
|
467 case NO_LINE_EDITING_OPTION: |
3019
|
468 line_editing = false; |
2239
|
469 break; |
|
470 |
|
471 case NO_SITE_FILE_OPTION: |
|
472 read_site_files = 0; |
1821
|
473 break; |
|
474 |
1410
|
475 case TRADITIONAL_OPTION: |
2239
|
476 traditional = true; |
1410
|
477 break; |
|
478 |
1
|
479 default: |
|
480 usage (); |
|
481 break; |
|
482 } |
|
483 } |
|
484 |
1651
|
485 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) |
2077
|
486 // Make sure we clean up when we exit. Also allow users to register |
|
487 // functions. If we don't have atexit or on_exit, we're going to |
|
488 // leave some junk files around if we exit abnormally. |
|
489 |
|
490 atexit (do_octave_atexit); |
318
|
491 #endif |
1
|
492 |
1358
|
493 // These can come after command line args since none of them set any |
|
494 // defaults that might be changed by command line options. |
581
|
495 |
2926
|
496 initialize_command_input (); |
315
|
497 |
578
|
498 if (! inhibit_startup_message) |
3538
|
499 std::cout << OCTAVE_STARTUP_MESSAGE "\n" << std::endl; |
578
|
500 |
1410
|
501 if (traditional) |
|
502 maximum_braindamage (); |
|
503 |
2239
|
504 execute_startup_files (); |
1651
|
505 |
2926
|
506 command_history::read (false); |
1
|
507 |
578
|
508 if (! inhibit_startup_message && reading_startup_message_printed) |
3538
|
509 std::cout << std::endl; |
578
|
510 |
1358
|
511 // Avoid counting commands executed from startup files. |
|
512 |
2926
|
513 command_editor::reset_current_command_number (1); |
1
|
514 |
1358
|
515 // If there is an extra argument, see if it names a file to read. |
|
516 // Additional arguments are taken as command line options for the |
|
517 // script. |
1
|
518 |
1817
|
519 int last_arg_idx = args.optind (); |
3019
|
520 |
1817
|
521 int remaining_args = argc - last_arg_idx; |
3019
|
522 |
1355
|
523 if (remaining_args > 0) |
149
|
524 { |
3019
|
525 reading_script_file = true; |
|
526 |
1817
|
527 curr_fcn_file_name = argv[last_arg_idx]; |
1608
|
528 curr_fcn_file_full_name = curr_fcn_file_name; |
1411
|
529 |
984
|
530 FILE *infile = get_input_from_file (curr_fcn_file_name); |
1411
|
531 |
529
|
532 if (infile) |
287
|
533 { |
3019
|
534 input_from_command_line_file = true; |
1516
|
535 |
1411
|
536 bind_builtin_variable ("program_invocation_name", |
|
537 curr_fcn_file_name); |
|
538 |
1755
|
539 size_t pos = curr_fcn_file_name.rfind ('/'); |
|
540 |
3523
|
541 std::string tmp = (pos != NPOS) |
1755
|
542 ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name; |
1411
|
543 |
|
544 bind_builtin_variable ("program_name", tmp); |
|
545 |
1817
|
546 intern_argv (remaining_args, argv+last_arg_idx); |
1411
|
547 |
2926
|
548 command_editor::blink_matching_paren (false); |
|
549 |
287
|
550 switch_to_buffer (create_buffer (infile)); |
|
551 } |
529
|
552 else |
|
553 clean_up_and_exit (1); |
1
|
554 } |
|
555 else |
|
556 { |
1355
|
557 // Is input coming from a terminal? If so, we are probably |
|
558 // interactive. |
1
|
559 |
|
560 interactive = (isatty (fileno (stdin)) && isatty (fileno (stdout))); |
1355
|
561 |
|
562 intern_argv (argc, argv); |
|
563 |
|
564 switch_to_buffer (create_buffer (get_input_from_stdin ())); |
1
|
565 } |
|
566 |
1358
|
567 // Force input to be echoed if not really interactive, but the user |
|
568 // has forced interactive behavior. |
1
|
569 |
1907
|
570 if (! interactive && forced_interactive) |
287
|
571 { |
2926
|
572 command_editor::blink_matching_paren (false); |
1588
|
573 |
|
574 // XXX FIXME XXX -- is this the right thing to do? |
|
575 |
|
576 bind_builtin_variable ("echo_executing_commands", |
2800
|
577 static_cast<double> (ECHO_CMD_LINE)); |
287
|
578 } |
1
|
579 |
1410
|
580 if (! interactive) |
3019
|
581 line_editing = false; |
1
|
582 |
1907
|
583 int retval = main_loop (); |
1
|
584 |
1005
|
585 if (retval == 1 && ! error_state) |
|
586 retval = 0; |
|
587 |
1
|
588 clean_up_and_exit (retval); |
|
589 } |
|
590 |
560
|
591 /* |
1
|
592 ;;; Local Variables: *** |
|
593 ;;; mode: C++ *** |
|
594 ;;; End: *** |
|
595 */ |