]> 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:39:35 +0000 (15:39 +0000)
committerAnantha Kesari H Y <hyanantha@php.net>
Thu, 7 Jul 2005 15:39:35 +0000 (15:39 +0000)
-- Kamesh

Zend/zend_stream.c

index b163ff88632bd208958a6b9d146a1c13b5b397d5..cd26f61b411db6594881c25538446d1f4444ee3c 100644 (file)
@@ -94,7 +94,16 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_
        if (file_handle->handle.stream.interactive) {
                int c = '*', 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;