This adds the fgets function and its unit tests.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/stdio/fgets.cpp | ||
---|---|---|
24 | Nit: Because reinterpret_cast already shows the type, you use auto: auto *stream = ...; | |
26 | Use FileLock instead: File::FileLock lock(stream); You can use a nested block to reduce the scope of the lock. | |
libc/test/src/stdio/fgets_test.cpp | ||
71 | Add tests for error. | |
80 | Reading more should still be an EOF and not an error you mean? |
address comments
libc/src/stdio/fgets.cpp | ||
---|---|---|
26 | I tried using FileLock but it's a private part of File. | |
libc/test/src/stdio/fgets_test.cpp | ||
71 | The only true error state for fgets is a read error, which is tested above when I try to read from the write-only file. If there are other error states you see that I don't test then I'll add cases for them, but I don't see any. |
Nit: Because reinterpret_cast already shows the type, you use auto: