diff options
author | Anantha Kesari H Y <hyanantha@php.net> | 2005-07-07 15:39:35 +0000 |
---|---|---|
committer | Anantha Kesari H Y <hyanantha@php.net> | 2005-07-07 15:39:35 +0000 |
commit | fcfc10f3fff73f4750ea701696875653a9440cad (patch) | |
tree | 0311c064c11a2edbef152f97ea3c841214923849 | |
parent | ff870e61497610a269623dc23b4421b4956775e8 (diff) | |
download | php-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.c | 9 |
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; |