diff src/toplev.cc @ 3180:c17387059fd3

[project @ 1998-09-24 18:59:11 by jwe]
author jwe
date Thu, 24 Sep 1998 19:00:19 +0000
parents 7c96e85c76db
children 44d82b369c78
line wrap: on
line diff
--- a/src/toplev.cc	Wed Jul 29 19:50:02 1998 +0000
+++ b/src/toplev.cc	Thu Sep 24 19:00:19 1998 +0000
@@ -243,30 +243,33 @@
   return retval;
 }
 
-DEFUN (quit, args, ,
+DEFUN (quit, args, nargout,
   "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_value_list retval;
 
-  int exit_status = 0;
-
-  quitting_gracefully = true;
-
-  int nargin = args.length ();
-
-  if (nargin > 0)
+  if (nargout == 0)
     {
-      // XXX FIXME XXX -- need a safe uniform way to do this.
+      int exit_status = 0;
+
+      quitting_gracefully = true;
 
-      double tmp = args(0).double_value ();
+      if (args.length () > 0)
+	{
+	  // XXX FIXME XXX -- need a safe uniform way to do this.
 
-      if (! error_state && ! xisnan (tmp))
-	exit_status = NINT (tmp);
+	  double tmp = args(0).double_value ();
+
+	  if (! error_state && ! xisnan (tmp))
+	    exit_status = NINT (tmp);
+	}
+
+      clean_up_and_exit (exit_status);
     }
-
-  clean_up_and_exit (exit_status);
+  else
+    error ("quit: invalid number of output arguments");
 
   return retval;
 }