]> granicus.if.org Git - php/commitdiff
zend_stream_getc uses fread internally. NetWare LibC fread reads 4(Which I believe...
authorAnantha Kesari H Y <hyanantha@php.net>
Thu, 7 Jul 2005 15:43:50 +0000 (15:43 +0000)
committerAnantha Kesari H Y <hyanantha@php.net>
Thu, 7 Jul 2005 15:43:50 +0000 (15:43 +0000)
-- Kamesh

Zend/zend_stream.c

index 95050d3d26989d80bc19fec022329a4f4371441d..22c891a2c02d1f1f21cbaeea6478003177cd70e3 100644 (file)
@@ -102,7 +102,16 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_
                int c = '*';
                size_t n; 
 
+#ifdef NETWARE
+               /*
+                       c != 4 check is there as fread of a character in NetWare LibC gives 4 upon ^D character.
+                       Ascii value 4 is actually EOT character which is not defined anywhere in the LibC
+                       or else we can use instead of hardcoded 4.
+               */
+                for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != 4 && c != '\n'; ++n )
+#else
                for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n ) 
+#endif
                        buf[n] = (char) c; 
                if ( c == '\n' )
                        buf[n++] = (char) c;