# HG changeset patch # User jwe # Date 749848266 0 # Node ID 471912bc76c40960afc4eb3d0423113c4628e41e # Parent 8f91a9cbf4519027ab8ec5c0054b2d5491ac5556 [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. diff -r 8f91a9cbf451 -r 471912bc76c4 src/octave.cc --- a/src/octave.cc Tue Oct 05 04:34:27 1993 +0000 +++ b/src/octave.cc Tue Oct 05 19:11:06 1993 +0000 @@ -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);