#8 Fix failing tests with fake readline


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.


  • Christopher Head

    The patch

  • Christopher Head

    "diff2" is an alternate patch which is more invasive (touches a lot more lines), but makes the readline() function smaller, simpler, and more efficient by taking advantage of the knowledge that it's only reading one byte at a time. "diff2" obsoletes patch 3259499, but "diff" does not.

  • Christopher Head

    The more invasive patch


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks