From 669b2b395fda52167502e7326b9634bac7658004 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Fri, 31 Jul 2026 21:50:07 -0400 Subject: [PATCH] Record that there is no directory-reading wrapper 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) --- TODO.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/TODO.md b/TODO.md index ebb06e7..b4a3b05 100644 --- a/TODO.md +++ b/TODO.md @@ -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. The next thing worth doing is porting akbasic onto this release and 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.