summaryrefslogtreecommitdiff
path: root/Zend/zend_stream.c
diff options
context:
space:
mode:
authorAnantha Kesari H Y <hyanantha@php.net>2005-07-07 15:43:50 +0000
committerAnantha Kesari H Y <hyanantha@php.net>2005-07-07 15:43:50 +0000
commit82da3f50746d4d49bdf9f14d2daa30b472e3576c (patch)
treef1c85139bc611a2498e6d97fa0ed4a0f53c04218 /Zend/zend_stream.c
parent5fe199fb0fb71bab90a293fafb2ac2b3a37bbbba (diff)
downloadphp-git-82da3f50746d4d49bdf9f14d2daa30b472e3576c.tar.gz
zend_stream_getc uses fread internally. NetWare LibC fread reads 4(Which I believe EOT) for EOF(^D) character. This happens when fread is asked to read one and only character as is the case with cl interactive mode.
-- Kamesh
Diffstat (limited to 'Zend/zend_stream.c')
-rw-r--r--Zend/zend_stream.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 95050d3d26..22c891a2c0 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -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;