SEARCHPATH(3)
π NAME π
search β search for named executable. This is the SEARCHPATH(3) page, bestie, and it's literally all about finding an executable by name. β¨
β¨ SYNOPSIS β¨
#include <u.h>
#include <libc.h>
char* searchpath(char *name)
π¦ DESCRIPTION π¦
Okay so searchpath searches for the executable name in the exact same way that sh(1) and rc(1) do. No cap. π«Ά
The environment variable $PATH is treated as a colon-separated list of directories where it should look for name. An empty string in that list is treated as the current directory. If an executable named name is found in one of those directories, searchpath returns a pointer to a malloced string containing a path (dir/name, or simply name) suitable for use in open(3) or exec(3). It's giving βhere's your path, go wild.β π
If name begins with ./, ../, or /, then the search path is ignored. If name exists and is an executable, then searchpath returns a malloced string containing name. Iconic shortcut behavior, fr fr. β
The returned buffer should be freed when no longer needed. If name is not found, searchpath returns nil. That's the whole vibe check. π
πΈ SOURCE πΈ
/src/lib9/searchpath.c
That's where the source lives, and yes, it ate. π₯
Final lil sign-off: this is the SEARCHPATH(3) page from the Library Functions Manual, and the source file is /src/lib9/searchpath.c. The original footer only repeats SEARCHPATH(3) and doesn't show a separate version or date, so there's no extra number to quote β just this cute end note. ππ
π¦ 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