CLEANNAME(3)
π CLEANNAME(3) β from the Library Functions Manual β cleanname π
okay bestie, welcome to CLEANNAME(3), the page for cleanname, aka the little function that gives your path name a full lexical glow-up. no filesystem drama, just string vibes. periodt.
πΈ NAME πΈ
cleanname β clean a path name
β¨ SYNOPSIS β¨
#include <u.h>
#include <libc.h>
char* cleanname(char *filename)
π¦ DESCRIPTION π¦
So cleanname takes a filename and β by lexical processing only, bestie, no cap β returns the shortest string that names the same (possibly hypothetical) file. It is not out here checking whether the file is real; it is literally just doing string surgery and serving.
It eliminates multiple and trailing slashes, and it lexically interprets . and .. directory components in the name. The string is overwritten in place.
The shortest string cleanname can return is two bytes: the null-terminated string ".". Therefore filename must contain room for at least two bytes.
π¨ bestie, this is the part where you pay attention:filenameneeds room for at least two bytes, because"."plus its null terminator is already two bytes. do not skimp on the buffer, i am begging.
π SOURCE π
/src/lib9/cleanname.c
π SEE ALSO π
and thatβs the cute sign-off, bestie: CLEANNAME(3) β footer vibes only, mwah π πβ¨
π¦ where this page comes from
- alpine 3.24: plan9port-doc 0_git20260208-r0 Β· LPL-1.02
- arch rolling: plan9port 20261021-2 Β· custom
- nixos 26.05: plan9port 0-unstable-2025-11-10
- nixos 26.05: plan9port-wayland 0-unstable-2025-11-26
- nixpkgs unstable: plan9port 0-unstable-2025-11-10
- nixpkgs unstable: plan9port-wayland 0-unstable-2025-11-26
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms