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
This commit is contained in:
Anantha Kesari H Y 2005-07-07 15:43:50 +00:00
parent 5fe199fb0f
commit 82da3f5074

View 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;