Hi! I was using
https://man.netbsd.org/fgets.3 as a reference for the fgets() function for an application I'm writing, and when testing my application, I was surprised to discover that if fgets() reads EOF right away, it does not append a NUL character. (I confirmed this behavior on NetBSD 9.3 release.) I think it would be helpful to clarify this in the man page. Would a developer be willing to do this? If so, I'm happy to send a patch if that would be helpful, or if it's easier for a developer to just do it, that would be great too! Suggested wording is below. Here's what the NetBSD man page says at the end of the first paragraph in the Description section: Reading stops when a newline character is found, at end-of-file or error. The newline, if any, is retained, and a `\0' character is appended to end the string. I interpreted that to mean that it always appends a NUL character regardless of why it stopped reading. But that's not what it does. The FreeBSD fgets(3) man page https://man.freebsd.org/cgi/man.cgi?query=fgets&sektion=3 says the following, which I think is clearer and would have likely helped me avoid my initial misunderstanding: Reading stops when a newline character is found, at end-of-file or error. The newline, if any, is retained. If any characters are read and there is no error, a `\0' character is appended to end the string. I like this wording better because it says that the NUL character is appended only if any characters are read and there is no error. Thanks! Lewis