|FIGPAR_BREAK_ON_EQUALS||An equals sign (=) is normally considered part of the directive. This flag enables terminating the directive at the equals sign. Also makes equals sign optional and transient.|
|A semicolon () is normally considered part of the value. This flag enables terminating the value at the semicolon. Also allows multiple statements on a single line separated by semicolon.|
|FIGPAR_CASE_SENSITIVE||Normally directives are matched case insensitively using fnmatch(3). This flag enables directive matching to be case sensitive.|
|FIGPAR_REQUIRE_EQUALS||If a directive is not followed by an equals, processing is aborted.|
|FIGPAR_STRICT_EQUALS||Equals must be part of the directive to be considered a delimiter between directive and value.|
The options struct array pointer can be NULL and every directive will invoke the unknown function argument.
The directive for each figpar_config item in the parse_config options argument is matched against each parsed directive using fnmatch(3) until a match is found. If a match is found, the action function for that figpar_config directive is invoked with the line number, directive, and value. Otherwise if no match, the unknown function is invoked (with the same arguments).
If either action or unknown return non-zero, parse_config aborts reading the file and returns the error value to its caller.
get_config_option traverses the options-array and returns the option that matches via strcmp(3), or if no match a pointer to a static dummy struct is returned (whose values are all zero or NULL).
The use of struct figpar_config is entirely optional as-is the use of enum figpar_cfgtype or union figpar_cfgvalue. For example, you could choose to pass a NULL pointer to parse_config for the first argument and then provide a simple unknown function based on queue(3) that populates a singly-linked list of your own struct containing the directive and value.
In addition, the following miscellaneous string manipulation routines are
.In string_m.h :
|replaceall||Replace all occurrences of find in source with replace.|
|strcount||Count the number of occurrences of one string that appear in the source string. Return value is the total count. An example use would be if you need to know how large a block of memory needs to be for a replaceall series.|
|strexpand||Expand escape sequences in a buffer pointed to by source.|
|strexpandnl||Expand only the escaped newlines in a buffer pointed to by source.|
|strtolower||Convert a string to lower case.|
The figpar library first appeared in
.Fx 10.2 .
.An Devin Teske Aq dteske@FreeBSD.org
This is the first implementation of the library, and the interface may be subject to refinement.