optionGetValue(3)

✨ NAME ✨

optionGetValue - get a specific value from a hierarcical list. This is the optionGetValue(3) page, and yes, we're living in the Programmer's Manual. The word β€œhierarcical” is the original's spelling, not me being chaotic β€” preserve the artifact, bestie. πŸ˜­πŸ’–


🌸 SYNOPSIS 🌸

#include <your-opts.h>
cc [...] -o outfile infile.c -lopts [...]

const tOptionValue * optionGetValue(const tOptionValue * pOptValue, char
       const * valueName);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this routine is gonna find an entry in a nested value option or configurable. It's giving β€œsearch the group chat for exactly the right message.” πŸ’…

If valueName is NULL, then the first entry is returned. Otherwise, the first entry with a name that exactly matches the argument will be returned. No fuzzy vibes, no β€œclose enough,” this is strict bestie behavior. ✨

If there is no matching value, NULL is returned and errno is set to ENOENT. If the provided option value is not a hierarchical value, NULL is also returned and errno is set to EINVAL. Periodt. πŸ”₯

The two args, because we love a parameter moment:

  • pOptValue β€” a hierarchcal value. Again, that's the original spelling; I'm preserving the artifact, not judging. πŸ’€
  • valueName β€” name of value to get.

πŸŽ€ RETURN VALUE πŸŽ€

a compound value structure.

Not me obsessing over a one-line return value, fr fr. That's exactly what the page says, and she's iconic. πŸ‘‘


🌈 ERRORS 🌈

The returned result is NULL and errno is set:

  • EINVAL β€” the pOptValue does not point to a valid hierarchical option value. Invalid vibe, no cap. πŸ’€
  • ENOENT β€” no entry matched the given name. @end itemize β€” yes, that stray tag is literally in the original, and we leave her alone. πŸ™ˆ

🫢 SEE ALSO 🫢

The info documentation for the -lopts library. That's the official rec, bestie. πŸ“š

Also go hang out with: ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionLoadLine(3), optionMemberList(3), optionNextValue(3), optionOnlyUsage(3), optionPrintVersion(3), optionPrintVersionAndReturn(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3), β€” and yes, that trailing comma after strtransform(3), is exactly what the page has. iykyk 😌.

Catch you later, bestie: this page is optionGetValue(3) from the Programmer's Manual, dated 2018-08-26. Now go fetch that value and slay. πŸ’…πŸ’–