strnchrnul(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 through
  • count β€” the number of characters to be searched πŸŽ€ so like, the limit, the boundary, the "don't go past this" energy
  • c β€” 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 a NULL back. it means you get a pointer to the last character of the string. that's the whole point of the nul in 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