optionNextValue(3)

πŸ’… optionNextValue(3) β€” okay bestie, let's talk ✨

This one is straight from the Programmer's Manual (manual name folded in near the top, cute and compliant πŸ’–). It's all about walking a hierarchical list one value at a time, and it's lowkey iconic.


🌸 NAME 🌸

optionNextValue β€” get the next value from a hierarchical list. Periodt.

✨ SYNOPSIS ✨

okay so here's the exact include-and-compile vibe:

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

const tOptionValue * optionNextValue(const tOptionValue * pOptValue,
const tOptionValue * pOldValue);

πŸ’– DESCRIPTION πŸ’–

This routine is your list-walking bestie: it returns the next entry after the entry you passed in. At the end of the list, NULL gets returned. If the entry is not found on the list, NULL gets returned and errno is set to EINVAL.

The pOldValue must have been gotten from a prior call to this routine or to opitonGetValue() β€” yes, that's the spelling on the page, and no, I'm not fixing it, we respect the lore πŸ’€.

  • pOptValue β€” a hierarchical list value. The page spells it hierarchcal; typo and all, we move 🫢.
  • pOldValue β€” a value from this list.

🫢 RETURN VALUE 🫢

a compound value structure. That's the whole return-value tea, no cap. ✨

😭 ERRORS 😭

The returned result is NULL and errno is set:

  • EINVAL β€” the pOptValue does not point to a valid hierarchical option value or pOldValue does not point to a member of that option value.
  • ENOENT β€” the supplied pOldValue pointed to the last entry. @end itemize
bestie, yes, the original page really has that stray @end itemize sitting there. Not me. I just preserved the artifact 😭.

πŸ”₯ SEE ALSO πŸ”₯

The info documentation for the -lopts library.


Signed off on 2018-08-26 by optionNextValue(3) β€” Programmer's Manual energy, mwah πŸ’‹πŸ’–