get_options(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… get_options(9) β€” like, the kernel's little number-parsing bestie

okay so this is a page from the Kernel API Manual (yes, that one, the big one) and honestly? she's lowkey iconic. get_options is the function that takes your messy little string and turns it into a nice tidy list of integers. no cap, it's giving "personal assistant for numbers." πŸŽ€


✨ NAME ✨

get_options β€” Parse a string into a list of integers. that's it, that's the whole vibe. 🫢


🌸 SYNOPSIS 🌸

char * get_options (const char *str , int nints , int *ints );

literally just three arguments, bestie, you got this πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • str β€” the string to be parsed. yes, that string, the one you've been staring at πŸ’€
  • nints β€” size of the integer array. she's the bouncer at the club, controls how many numbers get in πŸšͺ
  • ints β€” the integer array itself. must have room for at least one element β€” do not test her on this, okay? at least one, minimum, periodt πŸ™ˆ

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's what she actually does πŸ”₯

She parses a string that contains any of these three situations:

  • a comma-separated list of integers,
  • a hyphen-separated range of positive integers (emphasis on positive, bestie β€” that's the original's underscore energy, not mine ✨),
  • or honestly a combination of both, because why not, main character energy πŸ’…

The parse halts when the array is full, or when no more numbers can be retrieved from the string. She stops when the club's full or when there's nobody left in line. simple as. πŸ’€

When nints is 0, the function just validates the given str and returns the amount of parseable integers as described below. so like, a vibe check, but for your string. no writing, just judging 🧚

The first element is filled by the number of collected integers in the range. the rest is what was parsed from the str. so element zero is the headcount πŸ“‹ and everybody else is the actual crew 🌈

Return value is the character in the string which caused the parse to end β€” typically a null terminator, if str is completely parseable. so if you got the '\0', congratulations, you ate and left no crumbs ⭐

ngl, remembering the return is a character in the string and not a number is the whole game here. that's the tea πŸ“

πŸ’œ SEE ALSO πŸ’œ

go read them, they're the friend group, iykyk 😭



and that's the page, bestie!! πŸ¦‹ mwah πŸ’– this one's from ./lib, dated October 2026, and yes she absolutely knew you'd be reading this in the future πŸ‘‘βœ¨ slay πŸŽ€

πŸ“¦ where this page comes from