Mercurial > hg > octave-lyh
diff src/octave.cc @ 149:471912bc76c4
[project @ 1993-10-05 19:11:06 by jwe]
(main): Print usage message if we are given more than one extra
argument on the command line.
Delay printing startup message until just before setting the toplevel
jump context.
author | jwe |
---|---|
date | Tue, 05 Oct 1993 19:11:06 +0000 |
parents | 7849db4b6dbc |
children | 43074bfdc8c5 |
line wrap: on
line diff
--- a/src/octave.cc +++ b/src/octave.cc @@ -387,15 +387,6 @@ } } - if (! inhibit_startup_message) - { - cout << "Octave, version " << version_string - << ". Copyright (C) 1992, 1993, John W. Eaton.\n" - << "This is free software with ABSOLUTELY NO WARRANTY.\n" - << "For details, type `warranty'.\n" - << "\n"; - } - // Make sure we clean up when we exit. atexit (cleanup_tmp_files); @@ -427,7 +418,12 @@ // If there is an extra argument, see if it names a file to read. - if (optind != argc) + int remaining_args = argc - optind; + if (remaining_args > 1) + { + usage (); + } + else if (remaining_args == 1) { FILE *infile = get_input_from_file (argv[optind]); if (infile == (FILE *) NULL) @@ -437,11 +433,11 @@ } else { + switch_to_buffer (create_buffer (get_input_from_stdin ())); + // Is input coming from a terminal? If so, we are probably // interactive. - switch_to_buffer (create_buffer (get_input_from_stdin ())); - interactive = (isatty (fileno (stdin)) && isatty (fileno (stdout))); } @@ -456,6 +452,15 @@ install_signal_handlers (); + if (! inhibit_startup_message) + { + cout << "Octave, version " << version_string + << ". Copyright (C) 1992, 1993, John W. Eaton.\n" + << "This is free software with ABSOLUTELY NO WARRANTY.\n" + << "For details, type `warranty'.\n" + << "\n"; + } + // Allow the user to interrupt us without exiting. volatile sig_handler *saved_sigint_handler = signal (SIGINT, SIG_IGN);