Reland "[libc] Implement basename and dirname in libgen.h #204554" (#205352)
Added the POSIX standard functions basename and dirname under a new libgen.h header. The implementations modify the input path in-place using cpp::string_view to determine boundaries safely.
Added find_last_not_of to cpp::string_view to support trailing slash removal.
Implemented:
libc/include/libgen.yaml, libgen.h.def: Public API definitions.
libc/src/libgen/basename.cpp, dirname.cpp: Generic implementations.
libc/test/src/libgen/: Unit and hermetic tests.
Registered the new entrypoints for all active Linux targets (x86_64, aarch64, arm, riscv) and added docgen configuration.
The tests are skipped when using ASan because death tests do not currently work with them.
Assisted-by: Automated tooling, human reviewed.
GitOrigin-RevId: dc658f1f11d3bf1da4243be9671dcdab597288b5
22 files changed