strsep(9)
π strsep(9) β the kernel API manual, bestie edition π
okay so this is strsep, straight out of the Kernel API Manual, and honestly? she's that girl. lowkey one of the most useful little string-splitters in the whole kernel and she knows it. let's get into it β¨
β¨ NAME β¨
strsep β split a string into tokens π
π¦ SYNOPSIS π¦
char * strsep (char **s , const char *ct );
yes the spacing is weird, no we're not fixing it, that's just how she's printed. slay π
πΈ ARGUMENTS πΈ
sβ the string to be searched π (it's achar **bestie, she's getting updated, keep reading)ctβ the characters to search for π
π DESCRIPTION π
so here's the main character moment: strsep updates s to point after the token, ready for the next call. that's the whole vibe. call her, she eats the token, she bumps s forward, you call her again. iconic loop energy fr fr π
and here's the thing nobody expects: it returns empty tokens, too. like, yes, genuinely, empty ones. it behaves exactly like the libc function of that name β no cap, same semantics. in fact, it was stolen from glibc2 and de-fancy-fied. same semantics, slimmer shape. ;) π§
not me obsessed with a kernel function that literally admits it was stolen from glibc2 and then "de-fancy-fied" π the audacity, the confidence, we stan
π SEE ALSO π
kernel file ./lib/string.c, plus the whole friend group right here β go say hi to all of them π«Ά
strncasecmp(9)stpcpy(9)strcmp(9)strncmp(9)strchr(9)strchrnul(9)strnchrnul(9)strrchr(9)strnchr(9)strspn(9)strcspn(9)strpbrk(9)memset(9)memset16(9)memset32(9)memset64(9)memcpy(9)memmove(9)memcmp(9)bcmp(9)memscan(9)strstr(9)strnstr(9)memchr(9)memchr_inv(9)
and that's the page!! π this little love letter lives in ./lib and it's dated October 2026 β so go split some strings, bestie, and remember: strsep(9) said it first. mwah ππβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms