That's pretty much what streams was doing a couple of weeks ago. The reason it was changed was because the stdio fgets doesn't handle non-native EOL conventions :-/.
What are your thoughts on the following: - Disable buffering for stdio streams (setvbuf(3) or similar). - read(2) using the fd obtained from fileno(3) (where valid). The stdio buffering could be restored when the stream is cast for use by third-party libraries. --Wez. On 10/04/02, "Sascha Schumann" <[EMAIL PROTECTED]> wrote: > Streams' gets function does not work with stdio, because it > uses fread(3) instead of fgets(3). Like fill_read_buffer > earlier, fread(3) does not return, unless an error occurs or > the amount of data has been read completely. It is basically > impossible to implement an _efficient_ fgets-like function > using fread(3). > > Additionally, stdio does its own buffering -- there is no > reason to add another buffer layer above it. The streams > buffer needs to be disabled, because fgets/fread would > otherwise interact wrongly. > > The attached patch does this: > > - Disables buffering for stdio using PHP_STREAM_FLAG_NO_BUFFER > - Adds a gets hook to stream ops > - Adds a gets implementation to stdio ops > - Makes stream_gets use that hook, if available > - Inverts the semantic of fill_read_buffer regarding blocking > > "make test" and entering data using stdin works. > > Comments, please. > > - Sascha -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php