Also, you are assuming “\n” is a line delimiter. This is true under Unix according to the documentation. But it doesn’t say anything about non-Unix systems.
RnRs defined read-line to handle different newline properly. My original idea is to stick to a pure line string reader iterator helper function. So we can just use read-line to make things simpler. The more general implementation has to consider this issue out of the standard API.
The proposed generalisation could introduce extra complexity and seems like over engineering. But as I said, it's still beautiful way to go and I don't against such an effort. Only if we can spend extra effort to make it work properly.
Alright, I just elaborate my opinion before in case any misunderstanding of my previous words. Let's face the problem.
I remember there's way to detect the current platform on the fly, so that we can test for each supported OS.
How about Guile wrapped (uname), I used it in GNU Artanis to detect the kernel version. But there's also brief OS info.
I don't think we need to handle Windows case, since nowadays there's WSL and people like to run GNU things on WSL.
Best regards.