summaryrefslogtreecommitdiff
path: root/graphics/pfstools/files/epatch-src-octave-pfsopen.cpp
blob: c697f03103b82d21814c43e444eb0587529c1f5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- src/octave/pfsopen.cpp.orig	2006-04-06 12:33:02.000000000 +0000
+++ src/octave/pfsopen.cpp	2008-02-12 10:59:44.000000000 +0000
@@ -54,8 +54,9 @@
     return retval;
   }
 
-  if( !args(0).is_string() && !args(0).is_stream() ) {
+  if( !args(0).is_string() && !args(0).is_real_scalar() ) {
     error( SCRIPT_NAME ": expected file name or file descriptor as the first argument!");
+    // file descriptors are represented as integers (stored as doubles) in Octave 3.0
     return retval;
   }
 
@@ -120,8 +121,7 @@
     }
   } else {
     // File descriptor given
-    octave_stream fid = args(0).stream_value();
-    int fd = dup( fid.file_number() );
+    int fd = dup( (int) args(0).scalar_value() );
     if( writeMode ) {
       fh = fdopen( fd, "wb" );
       if( fh == NULL ) {