# HG changeset patch # User jwe # Date 967787577 0 # Node ID e5ff21d2bac6cfe8c2b61b36db56e6f7589e4fac # Parent 38ff09748e261af6b14cf535f262fef49bbf72d1 [project @ 2000-09-01 05:52:56 by jwe] diff -r 38ff09748e26 -r e5ff21d2bac6 src/ChangeLog --- 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 + + * 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 * parse.y: Use octave_time, not time. diff -r 38ff09748e26 -r e5ff21d2bac6 src/syscalls.cc --- 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 (status); - retval(1) = msg; + retval(0) = static_cast (status); + retval(1) = msg; + } } } else