3 .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 .if !
\a\\$4
\a\a .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
7 .ie
\a\\$3
\a\a .ft \\$1
11 .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
16 .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
19 .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
22 .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
24 .de EX \" start example
41 stropt \- table driven option expression evaluator
43 .L "#include <namval.h>"
45 .L "int stropt(char* s, struct namval* tab,
47 .L " int (*fun)(void* a, struct namval* p, int n, char* v),"
52 parses option expressions in the nul-terminated string
54 using the option names in
64 The last entry must be followed by a sentinel with
68 An option expression contains 0 or more of [\fBno\fP]\fIname\fP[=\fIvalue\fP]
75 must be one of the option names in
78 is an optional value, and
80 is for Boolean options.
81 Each option is passed to
87 pointer that is passed from the
89 call but is otherwise not interpreted.
91 points to the option name value pair from
100 points to the beginning of the option
113 pointing to an internal
117 pointing to the unknown option and
121 of the sentinel entry in
126 returns non-zero then this value is returned and no further
127 options are processed.
130 returns 0 after processing all options.