summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnantha Kesari H Y <hyanantha@php.net>2005-07-07 15:39:35 +0000
committerAnantha Kesari H Y <hyanantha@php.net>2005-07-07 15:39:35 +0000
commitfcfc10f3fff73f4750ea701696875653a9440cad (patch)
tree0311c064c11a2edbef152f97ea3c841214923849
parentff870e61497610a269623dc23b4421b4956775e8 (diff)
downloadphp-git-fcfc10f3fff73f4750ea701696875653a9440cad.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
-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 b163ff8863..cd26f61b41 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -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;