strnchrnul(9)
β¨ strnchrnul β bestie edition β¨
okay so this is a page from the Kernel API Manual (that's the manual name, iykyk π ) and honestly? it's a little icon and you're gonna love it.
πΈ NAME πΈ
strnchrnul β find and return a character in a length limited string, or end of string π
like, it's right there in the name bestie, no cap.
π SYNOPSIS π
char * strnchrnul (const char *s , size_t count , int c );
that's the whole vibe. three args, one pointer back. periodt. β¨
π¦ ARGUMENTS π¦
sβ the string to be searched πΈ this is the main character, the one getting looked throughcountβ the number of characters to be searched π so like, the limit, the boundary, the "don't go past this" energycβ the character to search for π the one we're hunting for fr fr
π DESCRIPTION π
okay so here's the tea: it returns a pointer to the first occurrence of c in s. that's it, that's the whole thing, slay. π«Ά
and if c is not found? then it returns a pointer to the last character of the string. literally not me being dramatic, that's just what it does π
β οΈ heads up bestie β read that second sentence carefully, because "not found" here does not mean you get aNULLback. it means you get a pointer to the last character of the string. that's the whole point of thenulin the name, and it's giving iconic π
π SEE ALSO π
the whole friend group, in the Kernel file ./lib/string.c:
strncasecmp(9), stpcpy(9), strcmp(9), strncmp(9), strchr(9), strchrnul(9), strrchr(9), strnchr(9), strspn(9), strcspn(9), strpbrk(9), strsep(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)
go say hi to all of them, they're all serving π§ββοΈβ¨
aaand that's the page!! π sign-off time: this one lives in ./lib, dated October 2026, and it's filed under strnchrnul(9) in case you need to find it again. love that for us ππ¦π
π¦ 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