get_option(9)
π get_option(9) β from the Kernel API Manual, bestie β¨
Okay so real talk: get_option is literally the girl who reads integers out of option strings. That's her whole job. She parses int values out of your command-line-ish strings and she does it flawlessly. Periodt. π
β¨ SYNOPSIS β¨
int get_option (char **str , int *pint );
Like, that signature? Iconic. Chef's kiss. π«Ά
πΈ ARGUMENTS πΈ
strβ the option string, aka the text she's gonna dig through. The main character of the operation, honestly.pintβ the (optional output) integer value parsed fromstr. Optional!! We love a flexible queen. π
π¦ DESCRIPTION π¦
So what she does is: read an int from an option string. And if there's a subsequent comma available? She accepts it too. Not greedy, just thorough. π
When pint is NULL, that's your cue to use this function as a validator of the current option in the string. No output, just vibes β she'll tell you whether there's an int there or not. iykyk. π
Also super important, no cap: a leading hyphen without an integer is no integer case. But β and this is the tea β we consume it anyway for the sake of simplification. She takes the hyphen on the way out. Rude? Maybe. Convenient? Absolutely. π
π₯ RETURN π₯
The vibe check results, in number form:
0β no int in string. Sad. π Empty-handed.1β int found, no subsequent comma. Clean, simple, slay. β¨2β int found including a subsequent comma. Overachiever behaviour. π3β hyphen found to denote a range. Ooh, a range. Fancy. π
β οΈ Heads up bestie: these are the only the return values the page gives you, so don't go assuming anything else, fr fr.
π SEE ALSO π
Go check out these icons, they're all in the kernel file ./lib/cmdline.c:
Okay bye bestie, go parse some ints πβ¨
Sign-off cuteness: this whole page lives in ./lib, dated October 2026, and it's get_option(9) β the Kernel API Manual's finest. π§ββοΈπ
π¦ 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