changeset 3715:e5ff21d2bac6

[project @ 2000-09-01 05:52:56 by jwe]
author jwe
date Fri, 01 Sep 2000 05:52:57 +0000
parents 38ff09748e26
children 08fe5f74c7d4
files src/ChangeLog src/syscalls.cc
diffstat 2 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Aug 25 06:10:30 2000 +0000
+++ b/src/ChangeLog	Fri Sep 01 05:52:57 2000 +0000
@@ -1,3 +1,8 @@
+2000-09-01  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* syscalls.cc (Ffcntl): Don't assume that the file id passed in is
+	the same as the underlying system file id.
+
 2000-08-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* parse.y: Use octave_time, not time.
--- a/src/syscalls.cc	Fri Aug 25 06:10:30 2000 +0000
+++ b/src/syscalls.cc	Fri Sep 01 05:52:57 2000 +0000
@@ -281,23 +281,29 @@
 
   if (nargin == 3)
     {
-      int fid = args(0).int_value (true);
-      int req = args(1).int_value (true);
-      int arg = args(2).int_value (true);
+      octave_stream strm = octave_stream_list::lookup (args (0), "fcntl");
 
       if (! error_state)
 	{
-	  // XXX FIXME XXX -- Need better checking here?
-	  if (fid < 0)
-	    error ("fcntl: invalid file id");
-	  else
+	  int fid = strm.file_number ();
+
+	  int req = args(1).int_value (true);
+	  int arg = args(2).int_value (true);
+
+	  if (! error_state)
 	    {
-	      std::string msg;
+	      // XXX FIXME XXX -- Need better checking here?
+	      if (fid < 0)
+		error ("fcntl: invalid file id");
+	      else
+		{
+		  std::string msg;
 
-	      int status = octave_syscalls::fcntl (fid, req, arg, msg);
+		  int status = octave_syscalls::fcntl (fid, req, arg, msg);
 
-	      retval(0) = static_cast<double> (status);
-	      retval(1) = msg;
+		  retval(0) = static_cast<double> (status);
+		  retval(1) = msg;
+		}
 	    }
 	}
       else