1
|
1 /* |
|
2 |
1884
|
3 Copyright (C) 1996 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 <csignal> |
|
31 #include <cstdlib> |
|
32 #include <cstring> |
|
33 #include <ctime> |
|
34 |
|
35 #include <fstream.h> |
|
36 #include <iostream.h> |
|
37 #include <strstream.h> |
|
38 |
|
39 #ifdef HAVE_UNISTD_H |
1
|
40 #include <sys/types.h> |
139
|
41 #include <unistd.h> |
|
42 #endif |
1355
|
43 |
1
|
44 #include <pwd.h> |
636
|
45 |
240
|
46 #include "lo-error.h" |
1907
|
47 #include "str-vec.h" |
223
|
48 |
1355
|
49 #include "builtins.h" |
|
50 #include "defaults.h" |
|
51 #include "defun.h" |
703
|
52 #include "dynamic-ld.h" |
1355
|
53 #include "error.h" |
|
54 #include "file-io.h" |
1766
|
55 #include "file-ops.h" |
1355
|
56 #include "help.h" |
1
|
57 #include "input.h" |
|
58 #include "lex.h" |
1742
|
59 #include "oct-hist.h" |
2375
|
60 #include "ops.h" |
1670
|
61 #include "toplev.h" |
1
|
62 #include "parse.h" |
1355
|
63 #include "pathsearch.h" |
562
|
64 #include "procstream.h" |
1817
|
65 #include "prog-args.h" |
1355
|
66 #include "sighandlers.h" |
|
67 #include "sysdep.h" |
2375
|
68 #include "ov.h" |
1742
|
69 #include "pt-misc.h" |
|
70 #include "pt-plot.h" |
1
|
71 #include "unwind-prot.h" |
1355
|
72 #include "utils.h" |
|
73 #include "variables.h" |
1
|
74 #include "version.h" |
|
75 |
1704
|
76 #if !defined (HAVE_ATEXIT) && defined (HAVE_ON_EXIT) |
|
77 extern "C" int on_exit (); |
|
78 #define atexit on_exit |
|
79 #endif |
|
80 |
1792
|
81 // Don't redefine the variables if glibc already has. |
|
82 #ifndef HAVE_PROGRAM_INVOCATION_NAME |
|
83 char *program_invocation_name; |
|
84 char *program_invocation_short_name; |
|
85 #else |
|
86 extern char *program_invocation_name; |
|
87 extern char *program_invocation_short_name; |
|
88 #endif |
|
89 |
1684
|
90 // This is from readline's paren.c: |
|
91 extern int rl_blink_matching_paren; |
1516
|
92 |
1907
|
93 // The command-line options. |
|
94 static string_vector octave_argv; |
1
|
95 |
2239
|
96 // TRUE means we read ~/.octaverc and ./.octaverc. |
|
97 // (--norc; --no-init-file; -f) |
|
98 static bool read_init_files = true; |
|
99 |
|
100 // TRUE means we read the site-wide octaverc files. |
|
101 // (--norc; --no-site-file; -f) |
2240
|
102 static bool read_site_files = true; |
1
|
103 |
1358
|
104 // Nonzero means we don't print the usual startup message. |
616
|
105 // (--quiet; --silent; -q) |
2239
|
106 static bool inhibit_startup_message = false; |
1
|
107 |
1410
|
108 // Nonzero means we turn on compatibility options. |
|
109 // (--traditional) |
2239
|
110 static bool traditional = false; |
1410
|
111 |
1825
|
112 // If nonzero, print verbose info in some cases. |
|
113 // (--verbose; -V) |
2239
|
114 static bool verbose_flag = false; |
1825
|
115 |
1
|
116 // Usage message |
139
|
117 static const char *usage_string = |
1613
|
118 "octave [-?Vdfhiqvx] [--debug] [--echo-commands] [--exec-path path]\n\ |
2239
|
119 [--help] [--info-file file] [--info-program prog] [--interactive]\n\ |
|
120 [--no-init-file] [--no-line-editing] [--no-site-file] [-p path]\n\ |
|
121 [--path path] [--silent] [--traditional] [--verbose] [--version] [file]"; |
1
|
122 |
1358
|
123 // This is here so that it's more likely that the usage message and |
1410
|
124 // the real set of options will agree. Note: the `+' must come first |
|
125 // to prevent getopt from permuting arguments! |
|
126 static const char *short_opts = "+?Vdfhip:qvx"; |
139
|
127 |
1103
|
128 // Long options. See the comments in getopt.h for the meanings of the |
|
129 // fields in this structure. |
1613
|
130 #define EXEC_PATH_OPTION 1 |
|
131 #define INFO_FILE_OPTION 2 |
|
132 #define INFO_PROG_OPTION 3 |
2240
|
133 #define NO_INIT_FILE_OPTION 4 |
|
134 #define NO_LINE_EDITING_OPTION 5 |
|
135 #define NO_SITE_FILE_OPTION 6 |
|
136 #define TRADITIONAL_OPTION 7 |
1817
|
137 long_options long_opts[] = |
139
|
138 { |
1855
|
139 { "debug", prog_args::no_arg, 0, 'd' }, |
2277
|
140 { "braindead", prog_args::no_arg, 0, TRADITIONAL_OPTION }, |
1855
|
141 { "echo-commands", prog_args::no_arg, 0, 'x' }, |
|
142 { "exec-path", prog_args::required_arg, 0, EXEC_PATH_OPTION }, |
|
143 { "help", prog_args::no_arg, 0, 'h' }, |
|
144 { "info-file", prog_args::required_arg, 0, INFO_FILE_OPTION }, |
|
145 { "info-program", prog_args::required_arg, 0, INFO_PROG_OPTION }, |
|
146 { "interactive", prog_args::no_arg, 0, 'i' }, |
2239
|
147 { "no-init-file", prog_args::no_arg, 0, NO_INIT_FILE_OPTION }, |
1855
|
148 { "no-line-editing", prog_args::no_arg, 0, NO_LINE_EDITING_OPTION }, |
2239
|
149 { "no-site-file", prog_args::no_arg, 0, NO_SITE_FILE_OPTION }, |
1855
|
150 { "norc", prog_args::no_arg, 0, 'f' }, |
|
151 { "path", prog_args::required_arg, 0, 'p' }, |
|
152 { "quiet", prog_args::no_arg, 0, 'q' }, |
|
153 { "silent", prog_args::no_arg, 0, 'q' }, |
|
154 { "traditional", prog_args::no_arg, 0, TRADITIONAL_OPTION }, |
|
155 { "verbose", prog_args::no_arg, 0, 'V' }, |
|
156 { "version", prog_args::no_arg, 0, 'v' }, |
1103
|
157 { 0, 0, 0, 0 } |
139
|
158 }; |
1
|
159 |
1355
|
160 // Store the command-line options for later use. |
|
161 |
|
162 static void |
|
163 intern_argv (int argc, char **argv) |
|
164 { |
|
165 if (argc > 1) |
|
166 { |
1572
|
167 int max_len = 0; |
1355
|
168 for (int i = 1; i < argc; i++) |
1572
|
169 { |
|
170 int tmp_len = strlen (argv[i]); |
|
171 if (tmp_len > max_len) |
|
172 max_len = tmp_len; |
|
173 } |
|
174 |
1907
|
175 octave_argv.resize (argc-1); |
1572
|
176 |
|
177 for (int i = 1; i < argc; i++) |
1907
|
178 octave_argv[i-1] = argv[i]; |
1411
|
179 |
|
180 bind_builtin_variable ("argv", octave_argv, 1, 1, 0); |
1355
|
181 } |
1907
|
182 |
|
183 bind_builtin_variable ("nargin", (double) argc-1, 1, 1, 0); |
1355
|
184 } |
|
185 |
581
|
186 // Initialize some global variables for later use. |
|
187 |
1
|
188 static void |
1755
|
189 initialize_globals (const string& name) |
1
|
190 { |
1792
|
191 // Kpathsea needs this. |
|
192 |
|
193 #ifndef HAVE_PROGRAM_INVOCATION_NAME |
|
194 program_invocation_name = strsave (name.c_str ()); |
|
195 program_invocation_short_name = strrchr (program_invocation_name, '/'); |
|
196 if (! program_invocation_short_name) |
|
197 program_invocation_short_name = program_invocation_name; |
|
198 #endif |
|
199 |
2205
|
200 Vprogram_invocation_name = name; |
|
201 size_t pos = Vprogram_invocation_name.rfind ('/'); |
|
202 Vprogram_name = (pos == NPOS) |
|
203 ? Vprogram_invocation_name : Vprogram_invocation_name.substr (pos+1); |
1355
|
204 |
1
|
205 struct passwd *entry = getpwuid (getuid ()); |
2205
|
206 Vuser_name = entry ? entry->pw_name : "I have no name!"; |
1
|
207 |
|
208 char hostname[256]; |
2205
|
209 int status = gethostname (hostname, 255); |
|
210 Vhost_name = (status < 0) ? "I have no host!" : hostname; |
1
|
211 |
|
212 char *hd = getenv ("HOME"); |
2205
|
213 Vhome_directory = hd ? hd : "I have no home!"; |
186
|
214 |
2205
|
215 install_defaults (); |
1
|
216 } |
|
217 |
1792
|
218 static void |
|
219 initialize_pathsearch (void) |
|
220 { |
|
221 // This may seem odd, but doing it this way means that we don't have |
|
222 // to modify the kpathsea library... |
|
223 |
|
224 char *odb = getenv ("OCTAVE_DB_DIR"); |
|
225 |
|
226 if (odb) |
|
227 oct_putenv ("TEXMF", odb); |
|
228 else |
|
229 { |
|
230 char *oh = getenv ("OCTAVE_HOME"); |
|
231 |
|
232 if (oh) |
|
233 { |
|
234 int len = strlen (oh) + 12; |
|
235 char *putenv_val = new char [len]; |
|
236 sprintf (putenv_val, "%s/lib/octave", oh); |
|
237 oct_putenv ("TEXMF", putenv_val); |
|
238 } |
|
239 else |
|
240 oct_putenv ("TEXMF", OCTAVE_DATADIR "/octave"); |
|
241 } |
|
242 } |
|
243 |
581
|
244 // Initialize by reading startup files. |
|
245 |
1
|
246 static void |
|
247 execute_startup_files (void) |
|
248 { |
315
|
249 begin_unwind_frame ("execute_startup_files"); |
|
250 |
1651
|
251 // XXX FIXME XXX -- need to make it possible to set this in startup |
|
252 // files. |
1588
|
253 |
1651
|
254 unwind_protect_int (input_from_startup_file); |
|
255 |
|
256 input_from_startup_file = 1; |
315
|
257 |
793
|
258 int verbose = (verbose_flag && ! inhibit_startup_message); |
578
|
259 |
2239
|
260 if (read_site_files) |
1
|
261 { |
2239
|
262 // Execute commands from the site-wide configuration file. |
|
263 // First from the file $(prefix)/lib/octave/site/m/octaverc |
|
264 // (if it exists), then from the file |
|
265 // $(prefix)/lib/octave/$(version)/m/octaverc (if it exists). |
1755
|
266 |
2239
|
267 parse_and_execute (Vlocal_site_defaults_file, 0, verbose); |
1755
|
268 |
2239
|
269 parse_and_execute (Vsite_defaults_file, 0, verbose); |
1
|
270 } |
|
271 |
2239
|
272 if (read_init_files) |
|
273 { |
|
274 // Try to execute commands from $HOME/.octaverc and |
|
275 // ./.octaverc. |
|
276 |
|
277 int home_rc_already_executed = 0; |
|
278 string home_rc; |
|
279 |
|
280 if (! Vhome_directory.empty ()) |
|
281 { |
|
282 home_rc = Vhome_directory; |
|
283 home_rc.append ("/.octaverc"); |
|
284 parse_and_execute (home_rc, 0, verbose); |
|
285 |
|
286 // Names alone are not enough. |
|
287 |
|
288 file_stat fs_home_rc (home_rc); |
|
289 |
|
290 if (fs_home_rc) |
|
291 { |
|
292 file_stat fs_dot_rc ("./.octaverc"); |
|
293 |
|
294 if (fs_dot_rc && fs_home_rc.ino () == fs_dot_rc.ino ()) |
|
295 home_rc_already_executed = 1; |
|
296 } |
|
297 } |
|
298 |
|
299 if (! home_rc_already_executed) |
|
300 parse_and_execute ("./.octaverc", 0, verbose); |
|
301 } |
315
|
302 |
|
303 run_unwind_frame ("execute_startup_files"); |
1
|
304 } |
|
305 |
581
|
306 // Usage message with extra help. |
|
307 |
1
|
308 static void |
|
309 verbose_usage (void) |
|
310 { |
2375
|
311 cout << OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\ |
1613
|
312 \n\ |
|
313 Usage: octave [options]\n\ |
|
314 \n\ |
|
315 Options:\n\ |
1119
|
316 \n\ |
1613
|
317 -d, --debug Enter parser debugging mode.\n\ |
|
318 -x, --echo-commands Echo commands as they are executed.\n\ |
|
319 --exec-path PATH Set path for executing subprograms.\n\ |
|
320 -h, -?, --help Print short help message and exit.\n\ |
2239
|
321 -f, --norc Don't read any initialization files.\n\ |
1613
|
322 --info-file FILE Use top-level info file FILE.\n\ |
|
323 --info-program PROGRAM Use PROGRAM for reading info files.\n\ |
|
324 -i, --interactive Force interactive behavior.\n\ |
2239
|
325 --no-init-file Don't read the ~/.octaverc or .octaverc files\n\ |
2212
|
326 --no-line-editing Don't use readline for command-line editing.\n\ |
2239
|
327 --no-site-file Don't read the site-wide octaverc file\n\ |
1613
|
328 -p PATH, --path PATH Set initial LOADPATH to PATH.\n\ |
|
329 -q, --silent Don't print message at startup.\n\ |
|
330 --traditional Set compatibility variables.\n\ |
|
331 -V, --verbose Enable verbose output in some cases.\n\ |
|
332 -v, --version Print version number and exit.\n\ |
1119
|
333 \n\ |
1613
|
334 FILE Execute commands from FILE.\n\ |
2375
|
335 \n\ |
|
336 Additional information about Octave is available via the WWW at\n\ |
|
337 http://www.che.wisc.edu/octave.\n\ |
|
338 \n\ |
|
339 Please report bugs to the mailing list `bug-octave@bevo.che.wisc.edu'.\n"; |
285
|
340 |
613
|
341 exit (0); |
1
|
342 } |
|
343 |
581
|
344 // Terse usage messsage. |
|
345 |
1
|
346 static void |
|
347 usage (void) |
|
348 { |
613
|
349 cerr << "usage: " << usage_string << "\n"; |
1
|
350 exit (1); |
|
351 } |
|
352 |
|
353 static void |
|
354 print_version_and_exit (void) |
|
355 { |
1107
|
356 cout << OCTAVE_NAME_AND_VERSION << "\n"; |
1
|
357 exit (0); |
|
358 } |
|
359 |
721
|
360 static void |
|
361 initialize_error_handlers () |
|
362 { |
|
363 set_liboctave_error_handler (error); |
|
364 } |
|
365 |
1410
|
366 // What happens on --traditional. |
|
367 |
|
368 static void |
|
369 maximum_braindamage (void) |
|
370 { |
|
371 bind_builtin_variable ("PS1", ">> "); |
|
372 bind_builtin_variable ("PS2", ""); |
1423
|
373 bind_builtin_variable ("beep_on_error", "true"); |
1410
|
374 bind_builtin_variable ("default_save_format", "mat-binary"); |
|
375 bind_builtin_variable ("define_all_return_values", "true"); |
|
376 bind_builtin_variable ("do_fortran_indexing", "true"); |
|
377 bind_builtin_variable ("empty_list_elements_ok", "true"); |
|
378 bind_builtin_variable ("implicit_str_to_num_ok", "true"); |
|
379 bind_builtin_variable ("ok_to_lose_imaginary_part", "true"); |
|
380 bind_builtin_variable ("page_screen_output", "false"); |
|
381 bind_builtin_variable ("prefer_column_vectors", "false"); |
|
382 bind_builtin_variable ("prefer_zero_one_indexing", "true"); |
|
383 bind_builtin_variable ("print_empty_dimensions", "false"); |
|
384 bind_builtin_variable ("treat_neg_dim_as_zero", "true"); |
|
385 bind_builtin_variable ("warn_function_name_clash", "false"); |
|
386 bind_builtin_variable ("whitespace_in_literal_matrix", "traditional"); |
|
387 } |
|
388 |
581
|
389 // You guessed it. |
|
390 |
1
|
391 int |
|
392 main (int argc, char **argv) |
|
393 { |
2205
|
394 // The order of these calls is important. The call to |
|
395 // initialize_globals must come before install_builtins because |
|
396 // default variable values must be available for the varaibles to be |
|
397 // installed, and the call to install_builtins must come before the |
|
398 // options are processed because some command line options override |
|
399 // defaults by calling bind_builtin_variable. |
721
|
400 |
1
|
401 sysdep_init (); |
|
402 |
721
|
403 initialize_error_handlers (); |
223
|
404 |
1
|
405 initialize_globals (argv[0]); |
|
406 |
1792
|
407 initialize_pathsearch (); |
1744
|
408 |
2205
|
409 install_signal_handlers (); |
|
410 |
|
411 initialize_file_io (); |
|
412 |
2375
|
413 initialize_symbol_tables (); |
|
414 |
|
415 install_types (); |
|
416 |
|
417 install_ops (); |
2205
|
418 |
|
419 install_builtins (); |
|
420 |
1817
|
421 prog_args args (argc, argv, short_opts, long_opts); |
|
422 |
139
|
423 int optc; |
1817
|
424 while ((optc = args.getopt ()) != EOF) |
1
|
425 { |
139
|
426 switch (optc) |
1
|
427 { |
793
|
428 case 'V': |
2239
|
429 verbose_flag = true; |
793
|
430 break; |
|
431 |
1
|
432 case 'd': |
|
433 yydebug++; |
|
434 break; |
777
|
435 |
1
|
436 case 'f': |
2239
|
437 read_init_files = false; |
|
438 read_site_files = false; |
1
|
439 break; |
777
|
440 |
1
|
441 case 'h': |
|
442 case '?': |
|
443 verbose_usage (); |
|
444 break; |
777
|
445 |
1
|
446 case 'i': |
|
447 forced_interactive = 1; |
|
448 break; |
777
|
449 |
1
|
450 case 'p': |
1817
|
451 if (args.optarg ()) |
2205
|
452 bind_builtin_variable ("LOADPATH", args.optarg ()); |
1
|
453 break; |
777
|
454 |
1
|
455 case 'q': |
2239
|
456 inhibit_startup_message = true; |
1
|
457 break; |
777
|
458 |
1
|
459 case 'x': |
2205
|
460 { |
|
461 double tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE); |
|
462 bind_builtin_variable ("echo_executing_commands", tmp); |
|
463 } |
1
|
464 break; |
777
|
465 |
1
|
466 case 'v': |
|
467 print_version_and_exit (); |
|
468 break; |
777
|
469 |
1613
|
470 case EXEC_PATH_OPTION: |
1817
|
471 if (args.optarg ()) |
2205
|
472 bind_builtin_variable ("EXEC_PATH", args.optarg ()); |
1613
|
473 break; |
|
474 |
186
|
475 case INFO_FILE_OPTION: |
1817
|
476 if (args.optarg ()) |
2205
|
477 bind_builtin_variable ("INFO_FILE", args.optarg ()); |
186
|
478 break; |
777
|
479 |
1613
|
480 case INFO_PROG_OPTION: |
1817
|
481 if (args.optarg ()) |
2205
|
482 bind_builtin_variable ("INFO_PROGRAM", args.optarg ()); |
1613
|
483 break; |
|
484 |
2239
|
485 case NO_INIT_FILE_OPTION: |
|
486 read_init_files = false; |
|
487 break; |
|
488 |
1821
|
489 case NO_LINE_EDITING_OPTION: |
2239
|
490 using_readline = false; |
|
491 break; |
|
492 |
|
493 case NO_SITE_FILE_OPTION: |
|
494 read_site_files = 0; |
1821
|
495 break; |
|
496 |
1410
|
497 case TRADITIONAL_OPTION: |
2239
|
498 traditional = true; |
1410
|
499 break; |
|
500 |
1
|
501 default: |
|
502 usage (); |
|
503 break; |
|
504 } |
|
505 } |
|
506 |
1651
|
507 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) |
2077
|
508 // Make sure we clean up when we exit. Also allow users to register |
|
509 // functions. If we don't have atexit or on_exit, we're going to |
|
510 // leave some junk files around if we exit abnormally. |
|
511 |
|
512 atexit (do_octave_atexit); |
|
513 |
1
|
514 atexit (cleanup_tmp_files); |
318
|
515 #endif |
1
|
516 |
1358
|
517 // These can come after command line args since none of them set any |
|
518 // defaults that might be changed by command line options. |
581
|
519 |
315
|
520 initialize_readline (); |
|
521 |
721
|
522 init_dynamic_linker (); |
|
523 |
578
|
524 if (! inhibit_startup_message) |
1106
|
525 cout << OCTAVE_STARTUP_MESSAGE "\n" << endl; |
578
|
526 |
1410
|
527 if (traditional) |
|
528 maximum_braindamage (); |
|
529 |
2239
|
530 execute_startup_files (); |
1651
|
531 |
1799
|
532 octave_command_history.read (); |
1
|
533 |
578
|
534 if (! inhibit_startup_message && reading_startup_message_printed) |
|
535 cout << endl; |
|
536 |
1358
|
537 // Avoid counting commands executed from startup files. |
|
538 |
1
|
539 current_command_number = 1; |
|
540 |
1358
|
541 // If there is an extra argument, see if it names a file to read. |
|
542 // Additional arguments are taken as command line options for the |
|
543 // script. |
1
|
544 |
1817
|
545 int last_arg_idx = args.optind (); |
|
546 int remaining_args = argc - last_arg_idx; |
1355
|
547 if (remaining_args > 0) |
149
|
548 { |
984
|
549 reading_script_file = 1; |
1817
|
550 curr_fcn_file_name = argv[last_arg_idx]; |
1608
|
551 curr_fcn_file_full_name = curr_fcn_file_name; |
1411
|
552 |
984
|
553 FILE *infile = get_input_from_file (curr_fcn_file_name); |
1411
|
554 |
529
|
555 if (infile) |
287
|
556 { |
1516
|
557 input_from_command_line_file = 1; |
|
558 |
1411
|
559 bind_builtin_variable ("program_invocation_name", |
|
560 curr_fcn_file_name); |
|
561 |
1755
|
562 size_t pos = curr_fcn_file_name.rfind ('/'); |
|
563 |
|
564 string tmp = (pos != NPOS) |
|
565 ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name; |
1411
|
566 |
|
567 bind_builtin_variable ("program_name", tmp); |
|
568 |
1817
|
569 intern_argv (remaining_args, argv+last_arg_idx); |
1411
|
570 |
287
|
571 rl_blink_matching_paren = 0; |
|
572 switch_to_buffer (create_buffer (infile)); |
|
573 } |
529
|
574 else |
|
575 clean_up_and_exit (1); |
1
|
576 } |
|
577 else |
|
578 { |
1355
|
579 // Is input coming from a terminal? If so, we are probably |
|
580 // interactive. |
1
|
581 |
|
582 interactive = (isatty (fileno (stdin)) && isatty (fileno (stdout))); |
1355
|
583 |
|
584 intern_argv (argc, argv); |
|
585 |
|
586 switch_to_buffer (create_buffer (get_input_from_stdin ())); |
1
|
587 } |
|
588 |
1358
|
589 // Force input to be echoed if not really interactive, but the user |
|
590 // has forced interactive behavior. |
1
|
591 |
1907
|
592 if (! interactive && forced_interactive) |
287
|
593 { |
|
594 rl_blink_matching_paren = 0; |
1588
|
595 |
|
596 // XXX FIXME XXX -- is this the right thing to do? |
|
597 |
|
598 bind_builtin_variable ("echo_executing_commands", |
|
599 (double) ECHO_CMD_LINE); |
287
|
600 } |
1
|
601 |
1410
|
602 if (! interactive) |
1
|
603 using_readline = 0; |
|
604 |
1907
|
605 int retval = main_loop (); |
1
|
606 |
1005
|
607 if (retval == 1 && ! error_state) |
|
608 retval = 0; |
|
609 |
1
|
610 clean_up_and_exit (retval); |
|
611 } |
|
612 |
560
|
613 /* |
1
|
614 ;;; Local Variables: *** |
|
615 ;;; mode: C++ *** |
|
616 ;;; End: *** |
|
617 */ |