changeset 11146:69b2f237060e

file-io.cc (Ffopen): argument parsing tweak
author John W. Eaton <jwe@octave.org>
date Sat, 23 Oct 2010 02:22:56 -0400
parents 3735abe5ebbe
children a81994607ca0
files src/ChangeLog src/file-io.cc
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Oct 23 02:05:54 2010 -0400
+++ b/src/ChangeLog	Sat Oct 23 02:22:56 2010 -0400
@@ -1,3 +1,8 @@
+2010-10-23  John W. Eaton  <jwe@octave.org>
+
+	* file-io.cc (Ffopen): Only handle fopen ("all") case if nargout
+	is 0 or 1.
+
 2010-10-22  John W. Eaton  <jwe@octave.org>
 
 	* octave.cc (usage): Put whitespace before and after usage message.
--- a/src/file-io.cc	Sat Oct 23 02:05:54 2010 -0400
+++ b/src/file-io.cc	Sat Oct 23 02:22:56 2010 -0400
@@ -554,7 +554,7 @@
   return retval;
 }
 
-DEFUN (fopen, args, ,
+DEFUN (fopen, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {[@var{fid}, @var{msg}] =} fopen (@var{name}, @var{mode}, @var{arch})\n\
 @deftypefnx {Built-in Function} {@var{fid_list} =} fopen (\"all\")\n\
@@ -664,7 +664,7 @@
 
   if (nargin == 1)
     {
-      if (args(0).is_string ())
+      if (nargout < 2 && args(0).is_string ())
         {
           // If there is only one argument and it is a string but it
           // is not the string "all", we assume it is a file to open