STROPT(3)
π NAME π
okay bestie, welcome to STROPT(3) from the Library Functions Manual β this is the page for stropt, and it's literally the table driven option expression evaluator π
β¨
β¨ SYNOPSIS β¨
#include <namval.h>
int stropt(char* s, struct namval* tab,
int (*fun)(void* a, struct namval* p, int n, char* v),
void* a)
π DESCRIPTION π
okay so stropt parses option expressions in the nul-terminated string s using the option names in tab. tab is an array of struct namval name value pairs:
char* name;
int value;
and the last entry must be followed by a sentinel with name set to 0 β that's the βwe're done hereβ marker, no cap π«Ά
An option expression contains 0 or more of [no]name[=value] separate by space or tab, where name must be one of the option names in tab, value is an optional value, and no is for Boolean options. Each option is passed to fun for processing. Here's the fun tea:
aβ thevoid*pointer that is passed from thestroptcall but is otherwise not interpreted.pβ points to the option name value pair fromtab.nβ0ifnopreceded the option name.vβ points to the beginning of the option value ins.
and if name is not found in tab then fun is called with p pointing to an internal namval entry with p->name pointing to the unknown option and p->value set to the value of the sentinel entry in tab.
If fun returns non-zero then this value is returned and no further options are processed. Otherwise stropt returns 0 after processing all options. periodt π
That's the whole page, bestie β from the Library Functions Manual, STROPT(3), and the footer was just STROPT(3) with no date or version printed, so that's all the footer tea we have πβ¨π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms