1 Commits

Author SHA1 Message Date
669b2b395f Record that there is no directory-reading wrapper
All checks were successful
libakstdlib CI Build / cmake_build (push) Successful in 2m55s
libakstdlib CI Build / sanitizers (push) Successful in 2m52s
libakstdlib CI Build / coverage (push) Successful in 2m43s
libakstdlib CI Build / mutation_test (push) Successful in 12m30s
opendir/readdir/closedir have no aksl_* counterpart, so a consumer that
wants to list a directory has to call them itself and report through errno
in a file where everything else reports through an akerr_ErrorContext *.

Found from akbasic, which needs it for Commodore BASIC's DIRECTORY verb and
refuses the verb rather than working around the gap.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 21:50:07 -04:00

20
TODO.md
View File

@@ -355,3 +355,23 @@ lists and no trees, drawing everything from fixed pools by design. A consumer th
does allocate would weight §4.1's `open`/`read`/`write` far higher than this one does allocate would weight §4.1's `open`/`read`/`write` far higher than this one
does. The next thing worth doing is porting akbasic onto this release and does. The next thing worth doing is porting akbasic onto this release and
counting the calls again. counting the calls again.
## Requested by consumers
1. **No directory-reading wrapper.** There is no `aksl_opendir` / `aksl_readdir` /
`aksl_closedir`, so a consumer that wants to list a directory has to call
`opendir(3)` itself and step outside the error convention every other call in
its file follows — reporting through `errno` where everything around it
reports through an `akerr_ErrorContext *`.
`akbasic` hit this implementing Commodore BASIC's `DIRECTORY` verb, and
refuses the verb rather than working around it: `src/runtime_disk.c` reports
"DIRECTORY is not implemented: libakstdlib has no directory-reading wrapper
yet". The shape it wants is the one the `aksl_f*` family already has — a
handle out through a pointer parameter, `NULL` on success, `ENOENT` and
`EACCES` propagated as themselves.
A wrapper would want tests for: a directory that does not exist, one that
cannot be searched, an empty one, and one whose entries outlast a single
read — plus whatever the `d_type` portability story turns out to be, since
not every filesystem fills it in.