With the fake readline() function, data is stored in the static "saved" variable between one line and the next. Unfortunately, if the next call is not to readline() but to getny(), as it is near the end of the third test case in test/edit, the crucial "y" character will already have been read into "saved", but getny() doesn't know anything about "saved". The best solution available under the circumstances (assuming one wishes to continue having getny() not require the user to press ENTER) seems to be to have readline() only read one byte at a time from the input. The attached patch does this (of course "saved" is now unnecessary and has been removed); thus, any bytes after the newline are left in the kernel's input buffer and delivered to subsequent code properly.
Log in to post a comment.