Mercurial > hg > octave-nkf
diff src/toplev.cc @ 2068:18365b6332a8
[project @ 1996-04-17 23:37:35 by jwe]
author | jwe |
---|---|
date | Wed, 17 Apr 1996 23:37:35 +0000 |
parents | 6f3428b0d2c7 |
children | 2d03b8eb891d |
line wrap: on
line diff
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -385,25 +385,31 @@ return retval; } -DEFUN (flops, args, , - "flops (): count floating point operations") +DEFUN (quit, args, , + "quit (STATUS): exit Octave gracefully, returning STATUS to the system.\n\ +\n\ +STATUS should be an integer value. If STATUS is missing, 0 is assumed.") { + Octave_object retval; + + int exit_status = 0; + + quitting_gracefully = 1; + int nargin = args.length (); if (nargin > 0) - print_usage ("flops"); + { + // XXX FIXME XXX -- need a safe uniform way to do this. - warning ("flops is a flop, always returning zero"); - - return 0.0; -} + double tmp = args(0).double_value (); -DEFUN (quit, , , - "quit (): exit Octave gracefully") -{ - Octave_object retval; - quitting_gracefully = 1; - clean_up_and_exit (0); + if (! error_state && ! xisnan (tmp)) + exit_status = NINT (tmp); + } + + clean_up_and_exit (exit_status); + return retval; }